Skip to content

Commit 7311411

Browse files
committed
uses nette/phpstan-rules
1 parent 0f0c17e commit 7311411

4 files changed

Lines changed: 34 additions & 3 deletions

File tree

composer.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
"require-dev": {
2323
"nette/tester": "^2.6",
2424
"tracy/tracy": "^2.9",
25-
"phpstan/phpstan": "^2.0@stable"
25+
"phpstan/phpstan": "^2.1@stable",
26+
"phpstan/extension-installer": "^1.4@stable",
27+
"nette/phpstan-rules": "^1.0"
2628
},
2729
"autoload": {
2830
"classmap": ["src/"],
@@ -39,5 +41,10 @@
3941
"branch-alias": {
4042
"dev-master": "4.1-dev"
4143
}
44+
},
45+
"config": {
46+
"allow-plugins": {
47+
"phpstan/extension-installer": true
48+
}
4249
}
4350
}

phpstan.neon

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ parameters:
44
paths:
55
- src
66

7-
checkMissingCallableSignature: true
8-
97
ignoreErrors:
108
-
119
message: '#^Method Nette\\Loaders\\RobotLoader\:\:scanPhp\(\) should return list\<class\-string\> but returns list\<non\-falsy\-string\>\.$#'

tests/types/TypesTest.phpt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
require __DIR__ . '/../bootstrap.php';
6+
7+
use Nette\PHPStan\Tester\TypeAssert;
8+
9+
TypeAssert::assertTypes(__DIR__ . '/robotloader-types.php');

tests/types/robotloader-types.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
/**
4+
* PHPStan type tests.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
use Nette\Loaders\RobotLoader;
10+
use function PHPStan\Testing\assertType;
11+
12+
13+
function testGetIndexedClasses(RobotLoader $loader): void
14+
{
15+
$result = $loader->getIndexedClasses();
16+
assertType('array<class-string, string>', $result);
17+
}

0 commit comments

Comments
 (0)