Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions tests/PHPStan/Rules/Methods/ReturnTypeRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1259,4 +1259,9 @@ public function testBug12928(): void
]);
}

public function testBug7225(): void
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs RequiresPhp >= 8.0

{
$this->analyse([__DIR__ . '/data/bug-7225.php'], []);
}

}
18 changes: 18 additions & 0 deletions tests/PHPStan/Rules/Methods/data/bug-7225.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php // lint >= 8.0

namespace Bug7225;

use DateTimeImmutable;

class CustomDateTimeImmutable extends DateTimeImmutable
{
public function test(): self
{
return CustomDateTimeImmutable::createFromInterface(new DateTime());
}

public function fromFormat(): CustomDateTimeImmutable|false
{
return CustomDateTimeImmutable::createFromFormat('H:i:s', '00:00:00');
}
}
Loading