-
-
Notifications
You must be signed in to change notification settings - Fork 738
Incorrect behavior of AssertRegExpRector #8669
Copy link
Copy link
Closed
rectorphp/rector-phpunit
#334Labels
Description
Bug Report
| Subject | Details |
|---|---|
| Rector version | last dev-main |
| Installed as | composer dependency |
Minimal PHP Code Causing Issue
<?php
final class DemoTest extends PHPUnit\Framework\TestCase
{
public function testFoo(): void
{
$string = 'keys=1000';
$this->assertSame(1, preg_match('/^keys=(?P<count>\d+)/', $string, $matches));
$this->assertSame(1000, (int) $matches['count']);
}
}Responsible rules
AssertRegExpRector
Expected Behavior
It should skip the assert if the $matches variable is used subsequently.
Reactions are currently unavailable