Skip to content

Commit

Permalink
Added test for promoted properties typehinting.
Browse files Browse the repository at this point in the history
  • Loading branch information
mad-briller committed Jul 22, 2022
1 parent 63190f4 commit a66d96f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,15 @@ public function testFilterIteratorChildClass(): void
$this->analyse([__DIR__ . '/data/filter-iterator-child-class.php'], []);
}

public function testBug7662(): void
{
$this->analyse([__DIR__ . '/data/bug-7662.php'], [
[
'Method Bug7662\Foo::__construct() has parameter $bar with no value type specified in iterable type array.',
6,
MissingTypehintCheck::MISSING_ITERABLE_VALUE_TYPE_TIP,
],
]);
}

}
7 changes: 7 additions & 0 deletions tests/PHPStan/Rules/Methods/data/bug-7662.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php declare(strict_types = 1);

namespace Bug7662;

class Foo {
public function __construct(public array $bar) {}
}

0 comments on commit a66d96f

Please sign in to comment.