Skip to content

Commit 05d1818

Browse files
authored
Added regression test
1 parent 52e33e2 commit 05d1818

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

tests/PHPStan/Rules/Methods/ReturnTypeRuleTest.php

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

1262+
#[RequiresPhp('>= 8.0')]
1263+
public function testBug7225(): void
1264+
{
1265+
$this->analyse([__DIR__ . '/data/bug-7225.php'], []);
1266+
}
1267+
12621268
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php // lint >= 8.0
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)