Skip to content

Commit

Permalink
Bump PHPStan to 2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
xificurk committed Jan 16, 2025
1 parent 532a790 commit a1b4a8e
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 20 deletions.
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
"require-dev": {
"nette/tester": "2.5.4",
"mockery/mockery": "1.6.12",
"phpstan/phpstan": "1.12.7",
"phpstan/phpstan-strict-rules": "1.6.1",
"phpstan/phpstan-nette": "1.3.8",
"phpstan/phpstan-mockery": "1.1.3",
"nepada/phpstan-nette-tester": "1.2.1",
"spaze/phpstan-disallowed-calls": "4.0.1",
"shipmonk/phpstan-rules": "3.2.1",
"phpstan/phpstan": "2.1.1",
"phpstan/phpstan-strict-rules": "2.0.1",
"phpstan/phpstan-nette": "2.0.2",
"phpstan/phpstan-mockery": "2.0.0",
"nepada/phpstan-nette-tester": "2.0.0",
"spaze/phpstan-disallowed-calls": "4.1.1",
"shipmonk/phpstan-rules": "4.1.0",
"php-parallel-lint/php-parallel-lint": "1.4.0",
"nepada/coding-standard": "7.14.1",
"nette/di": "^3.0.6@dev",
Expand Down
30 changes: 30 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,33 @@ parameters:
message: "#^Overwriting variable \\$resource while changing its type from Nette\\\\Security\\\\Resource to string$#"
count: 1
path: src/SecurityAnnotations/AccessValidators/PermissionValidator.php
- # pre-validated config
message: '#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\.$#'
identifier: foreach.nonIterable
count: 1
path: src/Bridges/SecurityAnnotationsDI/SecurityAnnotationsExtension.php
- # pre-validated config
message: '#^Parameter \#1 \$validator of method Nepada\\Bridges\\SecurityAnnotationsDI\\SecurityAnnotationsExtension\:\:getValidatorService\(\) expects string, mixed given\.$#'
identifier: argument.type
count: 1
path: src/Bridges/SecurityAnnotationsDI/SecurityAnnotationsExtension.php
- # pre-validated config
message: '#^Parameter \#2 \.\.\.\$arrays of function array_merge expects array, mixed given\.$#'
identifier: argument.type
count: 1
path: src/Bridges/SecurityAnnotationsDI/SecurityAnnotationsExtension.php
-
message: '#^Parameter \#1 \$callback of function array_map expects \(callable\(mixed\)\: mixed\)\|null, Closure\(Nette\\Security\\Role\|string\)\: string given\.$#'
identifier: argument.type
count: 1
path: src/SecurityAnnotations/AccessValidators/RoleValidator.php
- # covered by tests
message: '#^Trait Nepada\\SecurityAnnotations\\SecuredComponents is used zero times and is not analysed\.$#'
identifier: trait.unused
count: 1
path: src/SecurityAnnotations/SecuredComponents.php
- # covered by tests
message: '#^Trait Nepada\\SecurityAnnotations\\SecurityAnnotations is used zero times and is not analysed\.$#'
identifier: trait.unused
count: 1
path: src/SecurityAnnotations/SecurityAnnotations.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface AnnotationsReader
{

/**
* @return object[]
* @return list<object>
*/
public function getAll(\Reflector $element): array;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ final class AttributesReader implements AnnotationsReader
use Nette\SmartObject;

/**
* @return object[]
* @return list<object>
*/
public function getAll(\Reflector $element): array
{
Expand Down
8 changes: 4 additions & 4 deletions src/SecurityAnnotations/AnnotationReaders/UnionReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@ final class UnionReader implements AnnotationsReader
use Nette\SmartObject;

/**
* @var AnnotationsReader[]
* @var list<AnnotationsReader>
*/
private array $readers;

public function __construct(AnnotationsReader ...$readers)
{
$this->readers = $readers;
$this->readers = array_values($readers);
}

/**
* @return object[]
* @return list<object>
*/
public function getAll(\Reflector $element): array
{
$annotations = [];
foreach ($this->readers as $reader) {
$annotations = array_merge($annotations, array_values($reader->getAll($element)));
$annotations = array_merge($annotations, $reader->getAll($element));
}
return $annotations;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class PermissionValidatorTest extends TestCase
}

/**
* @return mixed[]
* @return list<mixed[]>
*/
protected function getDataForAccessAllowed(): array
{
Expand Down Expand Up @@ -79,7 +79,7 @@ class PermissionValidatorTest extends TestCase
}

/**
* @return mixed[]
* @return list<mixed[]>
*/
protected function getDataForAccessDenied(): array
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class RoleValidatorTest extends TestCase
}

/**
* @return mixed[]
* @return list<mixed[]>
*/
protected function getDataForAccessAllowed(): array
{
Expand Down Expand Up @@ -79,7 +79,7 @@ class RoleValidatorTest extends TestCase
}

/**
* @return mixed[]
* @return list<mixed[]>
*/
protected function getDataForAccessDenied(): array
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ final class DummyAnnotationReader implements AnnotationsReader
{

/**
* @var object[]
* @var list<object>
*/
private array $annotations;

/**
* @param object[] $annotations
* @param list<object> $annotations
*/
public function __construct(array $annotations)
{
$this->annotations = $annotations;
}

/**
* @return object[]
* @return list<object>
*/
public function getAll(\Reflector $element): array
{
Expand Down

0 comments on commit a1b4a8e

Please sign in to comment.