Skip to content

Commit 65143d1

Browse files
committed
test
1 parent 4b41e8b commit 65143d1

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

tests/PHPStan/Analyser/nsrt/bug-x.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php declare(strict_types = 1);
2+
3+
use function PHPStan\Testing\assertType;
4+
5+
class Foo
6+
{
7+
protected const A = 'Foo';
8+
9+
/** @return positive-int */
10+
function bbb(): int
11+
{
12+
return 1;
13+
}
14+
}
15+
16+
final class Bar extends Foo
17+
{
18+
protected const A = 'Bar';
19+
20+
/** @return 2 */
21+
#[\Override]
22+
function bbb(): int
23+
{
24+
return 2;
25+
}
26+
}
27+
28+
assertType("'Foo'", Closure::bind(static fn () => Foo::A, null, Foo::class)());
29+
//assertType("'Foo'", Closure::bind(static fn () => self::A, null, Foo::class)());
30+
assertType("'Foo'", Closure::bind(static fn () => Foo::A, null, Bar::class)());
31+
//assertType("'Foo'", Closure::bind(static fn () => parent::A, null, Bar::class)());
32+
assertType("'Foo'", Closure::bind(static fn () => Bar::A, null, Bar::class)());
33+
//assertType("'Bar'", Closure::bind(static fn () => self::A, null, Bar::class)());
34+
35+
// assertType("'Foo'", Closure::bind(static fn () => Closure::bind(static fn () => self::A, null, Foo::class)(), null, Bar::class)());

0 commit comments

Comments
 (0)