# Bug Report <!-- First, thank you for reporting a bug. That takes time and we appreciate that! --> | Subject | Details | | :------------- | :--------------------| | Rector version | last dev-main | | Installed as | composer dependency | ## Minimal PHP Code Causing Issue See https://getrector.com/demo/7a410258-130e-42f2-b522-7cd7065ee20b ```php <?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 <!-- How should Rector change the code? Or should Rector skip it? --> It should skip the assert if the `$matches` variable is used subsequently.
Bug Report
Minimal PHP Code Causing Issue
See https://getrector.com/demo/7a410258-130e-42f2-b522-7cd7065ee20b
Responsible rules
AssertRegExpRectorExpected Behavior
It should skip the assert if the
$matchesvariable is used subsequently.