Skip to content

Commit

Permalink
[PHPStan] Fixed PHPStan baseline (#371)
Browse files Browse the repository at this point in the history
For more details see #371

* [PHPStan] Aligned baseline after PHPStan update

* [PHPStan] Moved inlined PHP < 8.2 issue to the proper baseline file

* [PHPStan] Moved PHP < 8.3 issues from the main baseline file

* [PHPStan] Renamed baseline file for PHP >= 8.0
  • Loading branch information
alongosz authored May 15, 2024
1 parent 63492be commit 868c475
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 6 deletions.
File renamed without changes.
6 changes: 6 additions & 0 deletions phpstan-baseline-lte-8.1.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
parameters:
ignoreErrors:
-
message: "#^Class SensitiveParameterValue not found\\.$#"
count: 1
path: tests/lib/Repository/User/PasswordHashServiceTest.php
21 changes: 21 additions & 0 deletions phpstan-baseline-lte-8.2.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
parameters:
ignoreErrors:
-
message: "#^Offset 'uri' does not exist on array\\{timed_out\\: bool, blocked\\: bool, eof\\: bool, unread_bytes\\: int, stream_type\\: string, wrapper_type\\: string, wrapper_data\\: mixed, mode\\: string, \\.\\.\\.\\}\\.$#"
count: 1
path: src/bundle/Core/Imagine/IORepositoryResolver.php

-
message: "#^Offset 'uri' does not exist on array\\{timed_out\\: bool, blocked\\: bool, eof\\: bool, unread_bytes\\: int, stream_type\\: string, wrapper_type\\: string, wrapper_data\\: mixed, mode\\: string, \\.\\.\\.\\}\\.$#"
count: 1
path: src/bundle/Core/Imagine/PlaceholderProvider/GenericProvider.php

-
message: "#^Offset 'uri' does not exist on array\\{timed_out\\: bool, blocked\\: bool, eof\\: bool, unread_bytes\\: int, stream_type\\: string, wrapper_type\\: string, wrapper_data\\: mixed, mode\\: string, \\.\\.\\.\\}\\.$#"
count: 1
path: src/bundle/Core/Imagine/PlaceholderProvider/RemoteProvider.php

-
message: "#^Offset 'uri' does not exist on array\\{timed_out\\: bool, blocked\\: bool, eof\\: bool, unread_bytes\\: int, stream_type\\: string, wrapper_type\\: string, wrapper_data\\: mixed, mode\\: string, \\.\\.\\.\\}\\.$#"
count: 1
path: src/bundle/Core/Command/ResizeOriginalImagesCommand.php
28 changes: 24 additions & 4 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,11 @@ parameters:
count: 1
path: src/bundle/Core/Command/RegenerateUrlAliasesCommand.php

-
message: "#^Cannot access offset int on iterable\\<Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Content\\>\\.$#"
count: 1
path: src/bundle/Core/Command/RegenerateUrlAliasesCommand.php

-
message: "#^Method Ibexa\\\\Bundle\\\\Core\\\\Command\\\\RegenerateUrlAliasesCommand\\:\\:configure\\(\\) has no return type specified\\.$#"
count: 1
Expand Down Expand Up @@ -3687,7 +3692,7 @@ parameters:

-
message: "#^Cannot access offset string on Ibexa\\\\Bundle\\\\Core\\\\Imagine\\\\PlaceholderProvider\\.$#"
count: 2
count: 3
path: src/bundle/Core/Imagine/PlaceholderProviderRegistry.php

-
Expand Down Expand Up @@ -14952,12 +14957,12 @@ parameters:

-
message: "#^Cannot access offset int\\|string on Ibexa\\\\Contracts\\\\Core\\\\Persistence\\\\Content\\\\Field\\.$#"
count: 1
count: 3
path: src/lib/Persistence/Legacy/Content/FieldHandler.php

-
message: "#^Cannot access offset string on Ibexa\\\\Contracts\\\\Core\\\\Persistence\\\\Content\\\\Field\\.$#"
count: 2
count: 5
path: src/lib/Persistence/Legacy/Content/FieldHandler.php

-
Expand Down Expand Up @@ -20195,6 +20200,11 @@ parameters:
count: 1
path: src/lib/Repository/Mapper/ContentDomainMapper.php

-
message: "#^Cannot access offset mixed on iterable\\<Ibexa\\\\Contracts\\\\Core\\\\Persistence\\\\Content\\>\\.$#"
count: 1
path: src/lib/Repository/Mapper/ContentDomainMapper.php

-
message: "#^Cannot call method error\\(\\) on Psr\\\\Log\\\\LoggerInterface\\|null\\.$#"
count: 1
Expand Down Expand Up @@ -23082,7 +23092,7 @@ parameters:

-
message: "#^Cannot access offset string on iterable\\<string, Ibexa\\\\Contracts\\\\Core\\\\Variation\\\\VariationHandler\\>\\.$#"
count: 2
count: 3
path: src/lib/Variation/VariationHandlerRegistry.php

-
Expand Down Expand Up @@ -27340,6 +27350,11 @@ parameters:
count: 1
path: tests/integration/Core/Repository/ContentServiceTest.php

-
message: "#^Cannot access offset mixed on iterable\\<Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\VersionInfo\\>\\.$#"
count: 1
path: tests/integration/Core/Repository/ContentServiceTest.php

-
message: "#^Cannot access property \\$sortField on Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Location\\|null\\.$#"
count: 1
Expand Down Expand Up @@ -57985,6 +58000,11 @@ parameters:
count: 3
path: tests/lib/Repository/Service/Mock/ContentTest.php

-
message: "#^Cannot access offset mixed on Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Field\\.$#"
count: 1
path: tests/lib/Repository/Service/Mock/ContentTest.php

-
message: "#^Cannot access offset string on Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Field\\.$#"
count: 1
Expand Down
10 changes: 9 additions & 1 deletion phpstan-baseline.neon.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,15 @@
if (PHP_VERSION_ID < 80000) {
$includes[] = __DIR__ . '/phpstan-baseline-7.4.neon';
} else {
$includes[] = __DIR__ . '/phpstan-baseline-8.0.neon';
$includes[] = __DIR__ . '/phpstan-baseline-gte-8.0.neon';
}

if (PHP_VERSION_ID < 80200) {
$includes[] = __DIR__ . '/phpstan-baseline-lte-8.1.neon';
}

if (PHP_VERSION_ID < 80300) {
$includes[] = __DIR__ . '/phpstan-baseline-lte-8.2.neon';
}

$config = [];
Expand Down
1 change: 0 additions & 1 deletion tests/lib/Repository/User/PasswordHashServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ public function testCreatePasswordHashExceptionHidesSensitiveParameter(): void
if (\PHP_VERSION_ID < 80200) {
self::assertEquals($password, $stackTrace[0]['args'][0]);
} else {
// @phpstan-ignore-next-line This class is PHP 8.2+ only, but older PHP never reaches this else-block.
self::assertInstanceOf(\SensitiveParameterValue::class, $stackTrace[0]['args'][0]);
}
}
Expand Down

0 comments on commit 868c475

Please sign in to comment.