1. Go to this page and download the library: Download knplabs/phpstan-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/ */
knplabs / phpstan-rules example snippets
$a = new DateTime();
$b = new DateTime('now');
$c = new DateTimeImmutable();
$d = new DateTimeImmutable('now');
$e = new DateTimeImmutable('yesterday');
$f = new DateTimeImmutable('tomorrow');
$g = new DateTime('+1 day');
$h = new DateTimeImmutable('next Monday');
$a = new DateTime('2023-01-01');
$b = new DateTimeImmutable('2023-12-31 23:59:59');
$c = new DateTimeImmutable($dateVariable);
use Psr\Clock\ClockInterface;
final class MyService
{
public function __construct(private readonly ClockInterface $clock) {}
public function doSomething(): void
{
$now = $this->clock->now();
// ...
}
}
use Psr\Clock\ClockInterface;
final class MyService
{
public function __construct(private readonly ClockInterface $clock) {}
public function doSomething(): void
{
$now = $this->clock->now();
// ...
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.