File tree 3 files changed +32
-1
lines changed
tests/PHPStan/Rules/Classes
3 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -2316,7 +2316,7 @@ public function resolveTypeByName(Name $name): TypeWithClassName
2316
2316
2317
2317
$ originalClass = $ this ->resolveName ($ name );
2318
2318
if ($ this ->isInClass ()) {
2319
- if ($ this ->inClosureBindScopeClass !== null && $ this -> inClosureBindScopeClass !== ' static ' && $ originalClass === $ this -> getClassReflection ()-> getName () ) {
2319
+ if ($ this ->inClosureBindScopeClass === $ originalClass ) {
2320
2320
if ($ this ->reflectionProvider ->hasClass ($ this ->inClosureBindScopeClass )) {
2321
2321
return new ThisType ($ this ->reflectionProvider ->getClass ($ this ->inClosureBindScopeClass ));
2322
2322
}
Original file line number Diff line number Diff line change @@ -276,4 +276,10 @@ public function testRuleWithNullsafeVariant(): void
276
276
$ this ->analyse ([__DIR__ . '/data/class-constant-nullsafe.php ' ], []);
277
277
}
278
278
279
+ public function testBug7675 (): void
280
+ {
281
+ $ this ->phpVersion = PHP_VERSION_ID ;
282
+ $ this ->analyse ([__DIR__ . '/data/bug-7675.php ' ], []);
283
+ }
284
+
279
285
}
Original file line number Diff line number Diff line change
1
+ <?php declare (strict_types = 1 );
2
+
3
+ namespace Bug7675 ;
4
+
5
+ use Closure ;
6
+ use Throwable ;
7
+
8
+ class Handler
9
+ {
10
+ }
11
+
12
+ class SpladeCore
13
+ {
14
+ const HEADER_SPLADE = 'x-splade ' ;
15
+ public static function exceptionHandler (Handler $ exceptionHandler ): Closure
16
+ {
17
+ return Closure::bind (function (Throwable $ e , $ request ) {
18
+ if (!$ request ->header (SpladeCore::HEADER_SPLADE )) {
19
+ return null ;
20
+ }
21
+
22
+ return true ;
23
+ }, $ exceptionHandler , get_class ($ exceptionHandler ));
24
+ }
25
+ }
You can’t perform that action at this time.
0 commit comments