Skip to content

Commit 51c19e7

Browse files
committed
Added regression test
1 parent 52e33e2 commit 51c19e7

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

tests/PHPStan/Rules/Methods/ReturnTypeRuleTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,4 +1259,9 @@ public function testBug12928(): void
12591259
]);
12601260
}
12611261

1262+
public function testBug7225(): void
1263+
{
1264+
$this->analyse([__DIR__ . '/data/bug-7225.php'], []);
1265+
}
1266+
12621267
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace Bug7225;
4+
5+
use DateTimeImmutable;
6+
7+
class CustomDateTimeImmutable extends DateTimeImmutable
8+
{
9+
public function test(): self
10+
{
11+
return CustomDateTimeImmutable::createFromInterface(new DateTime());
12+
}
13+
14+
public function fromFormat(): CustomDateTimeImmutable|false
15+
{
16+
return CustomDateTimeImmutable::createFromFormat('H:i:s', '00:00:00');
17+
}
18+
}

0 commit comments

Comments
 (0)