Skip to content

Commit bbbccd2

Browse files
phpstan-botclaude
andcommitted
Add rule test verifying no binary operation error for DateInterval::format('%a') * 60
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent af487e4 commit bbbccd2

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

tests/PHPStan/Rules/Operators/InvalidBinaryOperationRuleTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -853,4 +853,9 @@ public function testBug10349(): void
853853
]);
854854
}
855855

856+
public function testBug1452(): void
857+
{
858+
$this->analyse([__DIR__ . '/data/bug-1452.php'], []);
859+
}
860+
856861
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace BugRuleTest1452;
4+
5+
use DateTimeImmutable;
6+
7+
function doFoo(): void {
8+
$dateInterval = (new DateTimeImmutable('now -60 minutes'))->diff(new DateTimeImmutable('now'));
9+
$minutes = $dateInterval->format('%a') * 60;
10+
}

0 commit comments

Comments
 (0)