File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -9981,6 +9981,11 @@ public function dataIsNumeric(): array
99819981 return $ this ->gatherAssertTypes (__DIR__ . '/data/is-numeric.php ' );
99829982 }
99839983
9984+ public function dataIsA (): array
9985+ {
9986+ return $ this ->gatherAssertTypes (__DIR__ . '/data/is-a.php ' );
9987+ }
9988+
99849989 public function dataBug3142 (): array
99859990 {
99869991 return $ this ->gatherAssertTypes (__DIR__ . '/data/bug-3142.php ' );
@@ -10537,6 +10542,7 @@ private function gatherAssertTypes(string $file): array
1053710542 * @dataProvider dataExtDs
1053810543 * @dataProvider dataArrowFunctionReturnTypeInference
1053910544 * @dataProvider dataIsNumeric
10545+ * @dataProvider dataIsA
1054010546 * @dataProvider dataBug3142
1054110547 * @dataProvider dataArrayShapeKeysStrings
1054210548 * @dataProvider dataBug1216
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ function (object $ foo ) {
4+ if (is_a ($ foo , Foo::class)) {
5+ \PHPStan \Analyser \assertType ('Foo ' , $ foo );
6+ }
7+ };
8+
9+ function (object $ foo ) {
10+ /** @var class-string<Foo> $fooClassString */
11+ $ fooClassString = 'Foo ' ;
12+
13+ if (is_a ($ foo , $ fooClassString )) {
14+ \PHPStan \Analyser \assertType ('Foo ' , $ foo );
15+ }
16+ };
17+
18+ function (string $ foo ) {
19+ if (is_a ($ foo , Foo::class, true )) {
20+ \PHPStan \Analyser \assertType ('class-string<Foo> ' , $ foo );
21+ }
22+ };
23+
24+ function (string $ foo , string $ someString ) {
25+ if (is_a ($ foo , $ someString , true )) {
26+ \PHPStan \Analyser \assertType ('class-string<object> ' , $ foo );
27+ }
28+ };
You can’t perform that action at this time.
0 commit comments