PHP code example of gian-tiaga / phpstan-strict-rules
1. Go to this page and download the library: Download gian-tiaga/phpstan-strict-rules library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
gian-tiaga / phpstan-strict-rules example snippets
namespace App\Example;
declare(strict_types=1);
namespace App\Example;
$user = new User('[email protected]', 'Иван');
$logger->info('message', ['userId' => $userId]);
final class MarkNotificationsRead
{
public function __construct(
private readonly DatabaseInterface $database,
) {}
public function run(): void
{
$this->database->update('notifications');
}
}
final class MarkNotificationsRead implements SetBasedWrite
{
public function __construct(
private readonly DatabaseInterface $database,
) {}
public function run(): void
{
$this->database->update('notifications');
}
}
final class StockChangedEvent implements IntegrationEventContract
{
public string $traceId = 'trace-1';
public function __construct(
public array $rows,
public mixed $anything,
public object $payload,
) {}
}
final readonly class StockChangedEvent implements IntegrationEventContract
{
/** @param list<StockLine> $rows */
public function __construct(
public string $clientId,
public StockReason $reason,
public \DateTimeImmutable $occurredAt,
public array $rows,
) {}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.