File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed
tests/PHPStan/Rules/Methods Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -3667,4 +3667,15 @@ public function testBug12735(): void
36673667 $ this ->analyse ([__DIR__ . '/data/bug-12735.php ' ], []);
36683668 }
36693669
3670+ public function testBug12735b (): void
3671+ {
3672+ $ this ->checkThisOnly = false ;
3673+ $ this ->checkNullables = true ;
3674+ $ this ->checkUnionTypes = true ;
3675+ $ this ->checkExplicitMixed = true ;
3676+ $ this ->checkImplicitMixed = true ;
3677+
3678+ $ this ->analyse ([__DIR__ . '/data/bug-12735b.php ' ], []);
3679+ }
3680+
36703681}
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Bug12735b ;
4+
5+ use DateTimeImmutable ;
6+
7+ class HelloWorld
8+ {
9+ public function test (): void
10+ {
11+ $ now = null ;
12+ if (rand (0 ,1 )) {
13+ $ now = new DateTimeImmutable ();
14+ }
15+
16+ $ this ->foo (
17+ $ now ??= new DateTimeImmutable (),
18+ $ now ,
19+ );
20+
21+ $ this ->foo ($ now , $ now );
22+ }
23+
24+ private function foo (DateTimeImmutable $ a , DateTimeImmutable $ b ): void {}
25+ }
You can’t perform that action at this time.
0 commit comments