forked from phpstan/phpstan-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbug-7391b.php
More file actions
30 lines (24 loc) · 886 Bytes
/
bug-7391b.php
File metadata and controls
30 lines (24 loc) · 886 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php declare(strict_types = 1);
namespace Bug7391B;
use function PHPStan\Testing\assertType;
class Foo
{
public function __construct(int $needsAtLeastOneArg) {
assertType('int', $needsAtLeastOneArg);
}
public static function m() {
assertType('Bug7391B\Foo', self::m());
assertType('static(Bug7391B\Foo)', static::m());
assertType('Bug7391B\Foo', (self::class)::m());
assertType('static(Bug7391B\Foo)', (static::class)::m());
assertType('Bug7391B\Foo', get_class(new self(2))::m());
assertType('static(Bug7391B\Foo)', get_class(new static(2))::m());
throw new \Error('For static analysis only, return type is resolved purely by DynamicStaticMethodReturnTypeExtension');
}
}
function () {
assertType('Bug7391B\Foo', Foo::m());
assertType('Bug7391B\Foo', (Foo::class)::m());
$fooCl = Foo::class;
assertType('Bug7391B\Foo', get_class(new $fooCl(2))::m());
};