Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly define the class \Hal\Component\Ast\NodeTraverser to make PhpMetrics work using composer --classmap-authoritative. #402

Merged
merged 1 commit into from
Dec 22, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions src/Hal/Component/Ast/NodeTraverser.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,18 @@
namespace Hal\Component\Ast;

if (PHP_VERSION_ID >= 70000) {
class_alias(Php7NodeTraverser::class, __NAMESPACE__ . '\\NodeTraverser');
class_alias(Php7NodeTraverser::class, __NAMESPACE__ . '\\ActualNodeTraverser');
} else {
class_alias(Php5NodeTraverser::class, __NAMESPACE__ . '\\NodeTraverser');
class_alias(Php5NodeTraverser::class, __NAMESPACE__ . '\\ActualNodeTraverser');
}

/**
* Empty class to refer the good ActualNodeTraverser depending on the PHP version.
* This class must be hard-coded and not directly used as an alias because composer can not handle class-aliases when
* flag --classmap-authoritative is set.
* @see https://github.com/phpmetrics/PhpMetrics/issues/373
*/
/** @noinspection PhpUndefinedClassInspection */
class NodeTraverser extends ActualNodeTraverser
{
}