Skip to content

Commit

Permalink
switch condition order
Browse files Browse the repository at this point in the history
  • Loading branch information
fbecker-complex authored and scheb committed Feb 4, 2025
1 parent 2d8cba4 commit 4eafa1c
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/analyzer/Stock/ParserTombstoneProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,12 @@ public static function create(array $config, ConsoleOutputInterface $consoleOutp
{
$sourceRootPath = new RootPath($config['source_code']['root_directory']);

// This if enables php-parser in version ^5.0. The ‘create’ function no longer exists here.
if (method_exists(ParserFactory::class, 'create')) {
$parser = (new ParserFactory())->create(ParserFactory::PREFER_PHP7, new Lexer());
} else {
// This if enables nikic/php-parser in version ^5.0. The ‘create’ function no longer exists here.
if (method_exists(ParserFactory::class, 'createForVersion')) {
$parser = (new ParserFactory())->createForVersion(PhpVersion::getHostVersion());
} else {
$parser = (new ParserFactory())->create(ParserFactory::PREFER_PHP7, new Lexer());

Check failure on line 47 in src/analyzer/Stock/ParserTombstoneProvider.php

View workflow job for this annotation

GitHub Actions / Coding Standards - PHP 8.3

UndefinedConstant

src/analyzer/Stock/ParserTombstoneProvider.php:47:53: UndefinedConstant: Constant PhpParser\ParserFactory::PREFER_PHP7 is not defined (see https://psalm.dev/020)
}
$parser = (new ParserFactory())->create(ParserFactory::PREFER_PHP7, new Lexer());
$traverser = new NodeTraverser();
$extractor = new TombstoneExtractor($parser, $traverser, $sourceRootPath);
$traverser->addVisitor(new TombstoneNodeVisitor($extractor, $config['tombstones']['parser']['function_names']));
Expand Down

0 comments on commit 4eafa1c

Please sign in to comment.