File tree Expand file tree Collapse file tree
tests/PHPStan/Rules/Methods Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -814,6 +814,18 @@ public function testBug11067(): void
814814 ]);
815815 }
816816
817+ public function testBug12272 (): void
818+ {
819+ $ this ->phpVersionId = PHP_VERSION_ID ;
820+ $ this ->analyse ([__DIR__ . '/data/bug-12272.php ' ], []);
821+ }
822+
823+ public function testBug12830 (): void
824+ {
825+ $ this ->phpVersionId = PHP_VERSION_ID ;
826+ $ this ->analyse ([__DIR__ . '/data/bug-12830.php ' ], []);
827+ }
828+
817829 public function testBug9524 (): void
818830 {
819831 $ this ->phpVersionId = PHP_VERSION_ID ;
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Bug12272 ;
4+
5+ interface ExceptionContract
6+ {
7+ public function __construct (string $ message );
8+ }
9+
10+ class BaseException extends Exception implements ExceptionContract
11+ {
12+ public function __construct (string $ message , ?Throwable $ previous = null )
13+ {
14+ parent ::__construct ($ message , 0 , $ previous );
15+ }
16+ }
17+
18+ class SomeException extends BaseException
19+ {
20+ }
21+
22+ class SpecificException extends SomeException
23+ {
24+ public function __construct (string $ message , int $ code = 0 )
25+ {
26+ if ($ code ) {
27+ echo 1 ;
28+ }
29+
30+ parent ::__construct ($ message );
31+ }
32+ }
Original file line number Diff line number Diff line change 1+ <?php declare (strict_types=1 );
2+
3+ namespace Bug12830 ;
4+
5+ interface I
6+ {
7+ public function __construct (string $ mustBeString );
8+ }
9+
10+ class A implements I
11+ {
12+ public string $ MustBeString ;
13+ public int $ CanBeInt ;
14+
15+ public function __construct (string $ mustBeString , int $ canBeInt = -1 )
16+ {
17+ $ this ->MustBeString = $ mustBeString ;
18+ $ this ->CanBeInt = $ canBeInt ;
19+ }
20+ }
21+
22+ class B extends A
23+ {
24+ public bool $ CanBeBool ;
25+
26+ public function __construct (string $ mustBeString , bool $ canBeBool = false )
27+ {
28+ $ this ->MustBeString = $ mustBeString ;
29+ $ this ->CanBeBool = $ canBeBool ;
30+ }
31+ }
32+
33+ var_dump ([
34+ new A ('A ' , 1 ),
35+ new B ('B ' , true ),
36+ ]);
You can’t perform that action at this time.
0 commit comments