From b13eaa20d279e37bc5083bde749147c3265f40df Mon Sep 17 00:00:00 2001 From: Matthew Brown Date: Sat, 8 Jun 2019 20:27:49 -0400 Subject: [PATCH] Fix namespacing of generated if --- bin/improve_class_alias.php | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/bin/improve_class_alias.php b/bin/improve_class_alias.php index f6f051048..6b6f34ff2 100644 --- a/bin/improve_class_alias.php +++ b/bin/improve_class_alias.php @@ -13,22 +13,24 @@ $search = '/* @var FullyQualified $originalName */ $replace = '/* @var FullyQualified $originalName */ $aliasStmt = $this->createAliasStmt($originalName, $stmt); - $stmts[] = new If_( - new FuncCall( - new FullyQualified(\'class_exists\'), - [ - new Node\Arg( - new Node\Expr\ClassConstFetch( - $originalName, - \'class\' + $stmts[] = new Node\Stmt\If_( + new Node\Expr\BooleanNot( + new Node\Expr\FuncCall( + new FullyQualified(\'class_exists\'), + [ + new Node\Arg( + new Node\Expr\ClassConstFetch( + $originalName, + \'class\' + ) + ), + new Node\Arg( + new Node\Expr\ConstFetch( + new Node\Name(\'false\') + ) ) - ), - new Node\Arg( - new Node\Expr\ConstFetch( - new Node\Name(\'false\') - ) - ) - ] + ] + ) ), [\'stmts\' => [$aliasStmt]] );';