Bug Report
| Subject |
Details |
| Rector version |
v2.2.3 |
I have some services in a symfony container that requires nikic/php-parser.
When invoking this service in an end-to-end test, the dumped service container adds several lines
to include include_once $root . '/vendor/nikic/php-parser/lib/PhpParser/Parser.php';
When running tests,
I encounter PHP Fatal error: Cannot declare interface PhpParser\Parser, because the name is already in use in ##redacted##/vendor/nikic/php-parser/lib/PhpParser/Parser.php on line 5
Minimal PHP Code Causing Issue
Not related with a code change. It does not work
Suppose this test file in tests directory
final class PhpParserBreakTest extends TestCase
{
public function testItBreaksWhenIncludingLocalPhpParserInPHPUnitTest(): void
{
$this->expectNotToPerformAssertions();
include_once \dirname(__DIR__, 4).'/vendor/nikic/php-parser/lib/PhpParser/Parser.php';
include_once \dirname(__DIR__, 4).'/vendor/nikic/php-parser/lib/PhpParser/ParserFactory.php';
}
}
Expected Behaviour
Test should be pass without issues
Bug Report
I have some services in a symfony container that requires nikic/php-parser.
When invoking this service in an end-to-end test, the dumped service container adds several lines
to include
include_once $root . '/vendor/nikic/php-parser/lib/PhpParser/Parser.php';When running tests,
I encounter
PHP Fatal error: Cannot declare interface PhpParser\Parser, because the name is already in use in ##redacted##/vendor/nikic/php-parser/lib/PhpParser/Parser.php on line 5Minimal PHP Code Causing Issue
Not related with a code change. It does not work
Suppose this test file in tests directory
Expected Behaviour
Test should be pass without issues