Skip to content

Commit f830e4f

Browse files
committed
Added regression test
1 parent e036b15 commit f830e4f

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
namespace Bug14791;
4+
5+
use function PHPStan\Testing\assertType;
6+
7+
$name = 'c054-foo';
8+
9+
if (preg_match('/^c(0[0-9]{2})-foo/', $name, $matches)) {
10+
assertType('non-falsy-string&numeric-string', $matches[1]); // should not be decimal-int-string
11+
if ($matches[1] === '054') { // should not error
12+
// ...
13+
}
14+
}

tests/PHPStan/Rules/Comparison/StrictComparisonOfDifferentTypesRuleTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,4 +1239,9 @@ public function testBug14473(): void
12391239
$this->analyse([__DIR__ . '/data/bug-14519.php'], []);
12401240
}
12411241

1242+
public function testBug14791(): void
1243+
{
1244+
$this->analyse([__DIR__ . '/../../Analyser/nsrt/bug-14791.php'], []);
1245+
}
1246+
12421247
}

0 commit comments

Comments
 (0)