1. Go to this page and download the library: Download steevanb/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/ */
steevanb / phpstan-rules example snippets
str_pad('x', 3, pad_type: STR_PAD_LEFT); // ✔ pad_string is skipped
str_pad('x', 3, ' ', pad_type: STR_PAD_LEFT); // ✘ Named argument pad_type of str_pad() is unnecessary
str_pad(length: 3, string: 'x'); // ✘ Named arguments string, length of str_pad() are unnecessary
namespace App\Tests\Unit\Foo;
#[CoversClass(\App\Foo\Bar::class)] // ✔
final class BarTest extends TestCase {}
#[CoversClass(\App\Foo\Baz::class)] // ✘ covers App\Foo\Baz, a test class covers the class or trait it mirrors
final class BarTest extends TestCase {}
final class FooTest extends TestCase
{
public function testType(): void
{
static::assertSame(Foo::TYPE, new Foo()->getType()); // ✘ Using App\Foo::TYPE in tests is disallowed
static::assertSame('foo', new Foo()->getType()); // ✔
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.