File tree 4 files changed +56
-5
lines changed 4 files changed +56
-5
lines changed Original file line number Diff line number Diff line change 15
15
"require": {
16
16
"php": "^7.2 || ^8.0",
17
17
"ext-simplexml": "*",
18
- "phpstan/phpstan": "^1.9.4 "
18
+ "phpstan/phpstan": "^1.9.18 "
19
19
},
20
20
"conflict": {
21
21
"symfony/framework-bundle": "<3.0"
Original file line number Diff line number Diff line change @@ -58,8 +58,6 @@ parameters:
58
58
- stubs/Symfony/Component/Security/Core/Authentication/Token/TokenInterface.stub
59
59
- stubs/Symfony/Component/Security/Core/Authorization/Voter/Voter.stub
60
60
- stubs/Symfony/Component/Security/Core/Authorization/Voter/VoterInterface.stub
61
- - stubs/Symfony/Component/Security/Core/User/PasswordAuthenticatedUserInterface.stub
62
- - stubs/Symfony/Component/Security/Core/User/PasswordUpgraderInterface.stub
63
61
- stubs/Symfony/Component/Serializer/Encoder/ContextAwareDecoderInterface.stub
64
62
- stubs/Symfony/Component/Serializer/Encoder/DecoderInterface.stub
65
63
- stubs/Symfony/Component/Serializer/Encoder/EncoderInterface.stub
@@ -298,6 +296,10 @@ services:
298
296
class: PHPStan\Symfony\InputBagStubFilesExtension
299
297
tags:
300
298
- phpstan.stubFilesExtension
299
+ -
300
+ class: PHPStan\Symfony\PasswordAuthenticatedUserStubFilesExtension
301
+ tags:
302
+ - phpstan.stubFilesExtension
301
303
302
304
# FormInterface::getErrors() return type
303
305
-
Original file line number Diff line number Diff line change 2
2
3
3
namespace PHPStan\Symfony;
4
4
5
+ use PHPStan\BetterReflection\Reflector\Exception\IdentifierNotFound;
6
+ use PHPStan\BetterReflection\Reflector\Reflector;
5
7
use PHPStan\PhpDoc\StubFilesExtension;
6
- use function class_exists;
7
8
8
9
class InputBagStubFilesExtension implements StubFilesExtension
9
10
{
10
11
12
+ /** @var Reflector */
13
+ private $reflector;
14
+
15
+ public function __construct(
16
+ Reflector $reflector
17
+ )
18
+ {
19
+ $this->reflector = $reflector;
20
+ }
21
+
11
22
public function getFiles(): array
12
23
{
13
- if (!class_exists('Symfony\Component\HttpFoundation\InputBag')) {
24
+ try {
25
+ $this->reflector->reflectClass('Symfony\Component\HttpFoundation\InputBag');
26
+ } catch (IdentifierNotFound $e) {
14
27
return [];
15
28
}
16
29
Original file line number Diff line number Diff line change
1
+ <?php declare(strict_types = 1);
2
+
3
+ namespace PHPStan\Symfony;
4
+
5
+ use PHPStan\BetterReflection\Reflector\Exception\IdentifierNotFound;
6
+ use PHPStan\BetterReflection\Reflector\Reflector;
7
+ use PHPStan\PhpDoc\StubFilesExtension;
8
+
9
+ class PasswordAuthenticatedUserStubFilesExtension implements StubFilesExtension
10
+ {
11
+
12
+ /** @var Reflector */
13
+ private $reflector;
14
+
15
+ public function __construct(
16
+ Reflector $reflector
17
+ )
18
+ {
19
+ $this->reflector = $reflector;
20
+ }
21
+
22
+ public function getFiles(): array
23
+ {
24
+ try {
25
+ $this->reflector->reflectClass('Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface');
26
+ } catch (IdentifierNotFound $e) {
27
+ return [];
28
+ }
29
+
30
+ return [
31
+ __DIR__ . '/../../stubs/Symfony/Component/Security/Core/User/PasswordAuthenticatedUserInterface.stub',
32
+ __DIR__ . '/../../stubs/Symfony/Component/Security/Core/User/PasswordUpgraderInterface.stub',
33
+ ];
34
+ }
35
+
36
+ }
You can’t perform that action at this time.
0 commit comments