Skip to content

Commit cfa69ca

Browse files
Add tests
1 parent e6490cd commit cfa69ca

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace Bug1452;
4+
5+
use function PHPStan\Testing\assertType;
6+
7+
$dateInterval = (new \DateTimeImmutable('now -60 minutes'))->diff(new \DateTimeImmutable('now'));
8+
9+
assertType('lowercase-string&non-empty-string&numeric-string&uppercase-string', $dateInterval->format('%a'));

tests/PHPStan/Rules/Operators/InvalidBinaryOperationRuleTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,13 @@ public function testBenevolentUnion(): void
795795
]);
796796
}
797797

798+
public function testBug1452(): void
799+
{
800+
$this->checkImplicitMixed = true;
801+
802+
$this->analyse([__DIR__ . '/data/bug-1452.php'], []);
803+
}
804+
798805
public function testBug7863(): void
799806
{
800807
$this->checkImplicitMixed = true;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace Bug1452;
4+
5+
$dateInterval = (new \DateTimeImmutable('now -60 minutes'))->diff(new \DateTimeImmutable('now'));
6+
7+
echo $dateInterval->format('%a') * 60;

0 commit comments

Comments
 (0)