Skip to content

Commit 4eafa1c

Browse files
fbecker-complexscheb
authored andcommitted
switch condition order
1 parent 2d8cba4 commit 4eafa1c

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/analyzer/Stock/ParserTombstoneProvider.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,12 @@ public static function create(array $config, ConsoleOutputInterface $consoleOutp
4040
{
4141
$sourceRootPath = new RootPath($config['source_code']['root_directory']);
4242

43-
// This if enables php-parser in version ^5.0. The ‘create’ function no longer exists here.
44-
if (method_exists(ParserFactory::class, 'create')) {
45-
$parser = (new ParserFactory())->create(ParserFactory::PREFER_PHP7, new Lexer());
46-
} else {
43+
// This if enables nikic/php-parser in version ^5.0. The ‘create’ function no longer exists here.
44+
if (method_exists(ParserFactory::class, 'createForVersion')) {
4745
$parser = (new ParserFactory())->createForVersion(PhpVersion::getHostVersion());
46+
} else {
47+
$parser = (new ParserFactory())->create(ParserFactory::PREFER_PHP7, new Lexer());
4848
}
49-
$parser = (new ParserFactory())->create(ParserFactory::PREFER_PHP7, new Lexer());
5049
$traverser = new NodeTraverser();
5150
$extractor = new TombstoneExtractor($parser, $traverser, $sourceRootPath);
5251
$traverser->addVisitor(new TombstoneNodeVisitor($extractor, $config['tombstones']['parser']['function_names']));

0 commit comments

Comments
 (0)