Skip to content

Commit

Permalink
minor #183 [ci] backport phpstan in 1.x
Browse files Browse the repository at this point in the history
  • Loading branch information
jrushlow authored Apr 16, 2024
1 parent 07c7515 commit d3c4b20
Show file tree
Hide file tree
Showing 5 changed files with 249 additions and 74 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@ jobs:
uses: SymfonyCasts/.github/.github/workflows/php-cs-fixer.yaml@main

sca:
uses: SymfonyCasts/.github/.github/workflows/psalm.yaml@main
uses: SymfonyCasts/.github/.github/workflows/phpstan.yaml@main
with:
php: 8.3
install-phpunit-bridge: true
6 changes: 5 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"doctrine/orm": "^2.7",
"doctrine/persistence": "^2.0",
"symfony/framework-bundle": "^5.4 | ^6.0 | ^7.0",
"symfony/phpunit-bridge": "^5.4 | ^6.0 | ^7.0"
"symfony/phpunit-bridge": "^5.4 | ^6.0 | ^7.0",
"phpstan/phpstan": "^1.11.x-dev"
},
"autoload": {
"psr-4": {
Expand All @@ -28,5 +29,8 @@
"psr-4": {
"SymfonyCasts\\Bundle\\VerifyEmail\\Tests\\": "tests/"
}
},
"scripts": {
"phpstan": "vendor/bin/phpstan"
}
}
231 changes: 231 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,231 @@
parameters:
ignoreErrors:
-
message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeDefinition\\:\\:children\\(\\)\\.$#"
count: 1
path: src/DependencyInjection/Configuration.php

-
message: "#^Instantiated class Symfony\\\\Component\\\\HttpKernel\\\\UriSigner not found\\.$#"
count: 1
path: src/Factory/UriSignerFactory.php

-
message: "#^Method SymfonyCasts\\\\Bundle\\\\VerifyEmail\\\\Factory\\\\UriSignerFactory\\:\\:createUriSigner\\(\\) has invalid return type Symfony\\\\Component\\\\HttpKernel\\\\UriSigner\\.$#"
count: 1
path: src/Factory/UriSignerFactory.php

-
message: "#^Parameter \\#2 \\$data of function hash_hmac expects string, string\\|false given\\.$#"
count: 1
path: src/Generator/VerifyEmailTokenGenerator.php

-
message: "#^Method SymfonyCasts\\\\Bundle\\\\VerifyEmail\\\\Model\\\\VerifyEmailSignatureComponents\\:\\:getExpirationMessageData\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: src/Model/VerifyEmailSignatureComponents.php

-
message: "#^Parameter \\#1 \\$targetObject of method DateTimeInterface\\:\\:diff\\(\\) expects DateTimeInterface, DateTimeImmutable\\|false given\\.$#"
count: 1
path: src/Model/VerifyEmailSignatureComponents.php

-
message: "#^Method SymfonyCasts\\\\Bundle\\\\VerifyEmail\\\\Util\\\\VerifyEmailQueryUtility\\:\\:getQueryParams\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: src/Util/VerifyEmailQueryUtility.php

-
message: "#^Offset 'query' on array\\{scheme\\?\\: string, host\\?\\: string, port\\?\\: int\\<0, 65535\\>, user\\?\\: string, pass\\?\\: string, path\\?\\: string, query\\: string, fragment\\?\\: string\\} on left side of \\?\\? always exists and is not nullable\\.$#"
count: 1
path: src/Util/VerifyEmailQueryUtility.php

-
message: "#^Parameter \\#2 \\$array of function array_key_exists expects array, array\\<string, int\\|string\\>\\|false given\\.$#"
count: 1
path: src/Util/VerifyEmailQueryUtility.php

-
message: "#^Call to method check\\(\\) on an unknown class Symfony\\\\Component\\\\HttpKernel\\\\UriSigner\\.$#"
count: 1
path: src/VerifyEmailHelper.php

-
message: "#^Call to method sign\\(\\) on an unknown class Symfony\\\\Component\\\\HttpKernel\\\\UriSigner\\.$#"
count: 1
path: src/VerifyEmailHelper.php

-
message: "#^Method SymfonyCasts\\\\Bundle\\\\VerifyEmail\\\\VerifyEmailHelper\\:\\:__construct\\(\\) has parameter \\$uriSigner with no type specified\\.$#"
count: 1
path: src/VerifyEmailHelper.php

-
message: "#^Method SymfonyCasts\\\\Bundle\\\\VerifyEmail\\\\VerifyEmailHelper\\:\\:generateSignature\\(\\) has parameter \\$extraParams with no value type specified in iterable type array\\.$#"
count: 1
path: src/VerifyEmailHelper.php

-
message: "#^Parameter \\#1 \\$expiresAt of class SymfonyCasts\\\\Bundle\\\\VerifyEmail\\\\Model\\\\VerifyEmailSignatureComponents constructor expects DateTimeInterface, DateTimeImmutable\\|false given\\.$#"
count: 1
path: src/VerifyEmailHelper.php

-
message: "#^Property SymfonyCasts\\\\Bundle\\\\VerifyEmail\\\\VerifyEmailHelper\\:\\:\\$queryUtility has no type specified\\.$#"
count: 1
path: src/VerifyEmailHelper.php

-
message: "#^Property SymfonyCasts\\\\Bundle\\\\VerifyEmail\\\\VerifyEmailHelper\\:\\:\\$router has no type specified\\.$#"
count: 1
path: src/VerifyEmailHelper.php

-
message: "#^Property SymfonyCasts\\\\Bundle\\\\VerifyEmail\\\\VerifyEmailHelper\\:\\:\\$tokenGenerator has no type specified\\.$#"
count: 1
path: src/VerifyEmailHelper.php

-
message: "#^Property SymfonyCasts\\\\Bundle\\\\VerifyEmail\\\\VerifyEmailHelper\\:\\:\\$uriSigner has unknown class Symfony\\\\Component\\\\HttpKernel\\\\UriSigner as its type\\.$#"
count: 1
path: src/VerifyEmailHelper.php

-
message: "#^Method SymfonyCasts\\\\Bundle\\\\VerifyEmail\\\\VerifyEmailHelperInterface\\:\\:generateSignature\\(\\) has parameter \\$extraParams with no value type specified in iterable type array\\.$#"
count: 1
path: src/VerifyEmailHelperInterface.php

-
message: "#^Access to an undefined property object\\:\\:\\$helper\\.$#"
count: 3
path: tests/AcceptanceTests/VerifyEmailAcceptanceTest.php

-
message: "#^Cannot access offset 'query' on array\\{scheme\\?\\: string, host\\?\\: string, port\\?\\: int\\<0, 65535\\>, user\\?\\: string, pass\\?\\: string, path\\?\\: string, query\\?\\: string, fragment\\?\\: string\\}\\|false\\.$#"
count: 1
path: tests/AcceptanceTests/VerifyEmailAcceptanceTest.php

-
message: "#^Parameter \\#2 \\$data of function hash_hmac expects string, string\\|false given\\.$#"
count: 3
path: tests/AcceptanceTests/VerifyEmailAcceptanceTest.php

-
message: "#^Parameter \\#2 \\$user_string of function hash_equals expects string, array\\|string given\\.$#"
count: 1
path: tests/AcceptanceTests/VerifyEmailAcceptanceTest.php

-
message: "#^Property SymfonyCasts\\\\Bundle\\\\VerifyEmail\\\\Tests\\\\AcceptanceTests\\\\VerifyEmailAcceptanceFixture\\:\\:\\$helper has no type specified\\.$#"
count: 1
path: tests/AcceptanceTests/VerifyEmailAcceptanceTest.php

-
message: "#^Cannot access offset 'query' on array\\{scheme\\?\\: string, host\\?\\: string, port\\?\\: int\\<0, 65535\\>, user\\?\\: string, pass\\?\\: string, path\\?\\: string, query\\?\\: string, fragment\\?\\: string\\}\\|false\\.$#"
count: 2
path: tests/FunctionalTests/VerifyEmailHelperFunctionalTest.php

-
message: "#^Instantiated class Symfony\\\\Component\\\\HttpKernel\\\\UriSigner not found\\.$#"
count: 1
path: tests/FunctionalTests/VerifyEmailHelperFunctionalTest.php

-
message: "#^Parameter \\#2 \\$data of function hash_hmac expects string, string\\|false given\\.$#"
count: 1
path: tests/FunctionalTests/VerifyEmailHelperFunctionalTest.php

-
message: "#^Parameter \\#2 \\$user_string of function hash_equals expects string, array\\|string given\\.$#"
count: 2
path: tests/FunctionalTests/VerifyEmailHelperFunctionalTest.php

-
message: "#^Property SymfonyCasts\\\\Bundle\\\\VerifyEmail\\\\Tests\\\\FunctionalTests\\\\VerifyEmailHelperFunctionalTest\\:\\:\\$expiryTimestamp has no type specified\\.$#"
count: 1
path: tests/FunctionalTests/VerifyEmailHelperFunctionalTest.php

-
message: "#^Property SymfonyCasts\\\\Bundle\\\\VerifyEmail\\\\Tests\\\\FunctionalTests\\\\VerifyEmailHelperFunctionalTest\\:\\:\\$mockRouter has no type specified\\.$#"
count: 1
path: tests/FunctionalTests/VerifyEmailHelperFunctionalTest.php

-
message: "#^Constructor of class SymfonyCasts\\\\Bundle\\\\VerifyEmail\\\\Tests\\\\IntegrationTests\\\\VerifyEmailHelperAutowireTest has an unused parameter \\$helper\\.$#"
count: 1
path: tests/IntegrationTests/VerifyEmailBundleAutowireTest.php

-
message: "#^Property SymfonyCasts\\\\Bundle\\\\VerifyEmail\\\\Tests\\\\IntegrationTests\\\\DefinitionPublicCompilerPass\\:\\:\\$definition has no type specified\\.$#"
count: 1
path: tests/IntegrationTests/VerifyEmailServiceDefinitionTest.php

-
message: "#^Property SymfonyCasts\\\\Bundle\\\\VerifyEmail\\\\Tests\\\\IntegrationTests\\\\VerifyEmailDefinitionTestKernel\\:\\:\\$compilerPass has no type specified\\.$#"
count: 1
path: tests/IntegrationTests/VerifyEmailServiceDefinitionTest.php

-
message: "#^Call to an undefined method object\\:\\:getReason\\(\\)\\.$#"
count: 1
path: tests/UnitTests/Exception/VerifyEmailExceptionTest.php

-
message: "#^Parameter \\#2 \\$data of function hash_hmac expects string, string\\|false given\\.$#"
count: 1
path: tests/UnitTests/Generator/VerifyEmailTokenGeneratorTest.php

-
message: "#^Parameter \\#1 \\$expiresAt of class SymfonyCasts\\\\Bundle\\\\VerifyEmail\\\\Model\\\\VerifyEmailSignatureComponents constructor expects DateTimeInterface, DateTimeImmutable\\|false given\\.$#"
count: 2
path: tests/UnitTests/Model/VerifyEmailSignatureComponentsTest.php

-
message: "#^Class Symfony\\\\Component\\\\HttpKernel\\\\UriSigner not found\\.$#"
count: 1
path: tests/UnitTests/VerifyEmailHelperTest.php

-
message: "#^Property SymfonyCasts\\\\Bundle\\\\VerifyEmail\\\\Tests\\\\UnitTests\\\\VerifyEmailHelperTest\\:\\:\\$mockQueryUtility has no type specified\\.$#"
count: 1
path: tests/UnitTests/VerifyEmailHelperTest.php

-
message: "#^Property SymfonyCasts\\\\Bundle\\\\VerifyEmail\\\\Tests\\\\UnitTests\\\\VerifyEmailHelperTest\\:\\:\\$mockRouter has no type specified\\.$#"
count: 1
path: tests/UnitTests/VerifyEmailHelperTest.php

-
message: "#^Property SymfonyCasts\\\\Bundle\\\\VerifyEmail\\\\Tests\\\\UnitTests\\\\VerifyEmailHelperTest\\:\\:\\$mockSigner has no type specified\\.$#"
count: 1
path: tests/UnitTests/VerifyEmailHelperTest.php

-
message: "#^Property SymfonyCasts\\\\Bundle\\\\VerifyEmail\\\\Tests\\\\UnitTests\\\\VerifyEmailHelperTest\\:\\:\\$tokenGenerator has no type specified\\.$#"
count: 1
path: tests/UnitTests/VerifyEmailHelperTest.php

-
message: "#^Method SymfonyCasts\\\\Bundle\\\\VerifyEmail\\\\Tests\\\\VerifyEmailTestKernel\\:\\:__construct\\(\\) has parameter \\$routes with no value type specified in iterable type array\\.$#"
count: 1
path: tests/VerifyEmailTestKernel.php

-
message: "#^Property SymfonyCasts\\\\Bundle\\\\VerifyEmail\\\\Tests\\\\VerifyEmailTestKernel\\:\\:\\$builder has no type specified\\.$#"
count: 1
path: tests/VerifyEmailTestKernel.php

-
message: "#^Property SymfonyCasts\\\\Bundle\\\\VerifyEmail\\\\Tests\\\\VerifyEmailTestKernel\\:\\:\\$extraBundles has no type specified\\.$#"
count: 1
path: tests/VerifyEmailTestKernel.php

-
message: "#^Property SymfonyCasts\\\\Bundle\\\\VerifyEmail\\\\Tests\\\\VerifyEmailTestKernel\\:\\:\\$routes has no type specified\\.$#"
count: 1
path: tests/VerifyEmailTestKernel.php

-
identifier: argument.type
count: 1
path: tests/UnitTests/Exception/VerifyEmailExceptionTest.php
9 changes: 9 additions & 0 deletions phpstan.dist.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
includes:
- phpstan-baseline.neon
parameters:
level: 9
bootstrapFiles:
- vendor/autoload.php
paths:
- src
- tests
72 changes: 0 additions & 72 deletions psalm.xml

This file was deleted.

0 comments on commit d3c4b20

Please sign in to comment.