2019-06-09 01:51:40 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
$vendor_path = 'vendor-bin/box/vendor/humbug/php-scoper/src/PhpParser/NodeVisitor/ClassAliasStmtAppender.php';
|
|
|
|
|
|
|
|
if (!file_exists($vendor_path)) {
|
|
|
|
die('Vendor file does not exist' . PHP_EOL);
|
|
|
|
}
|
|
|
|
|
|
|
|
$search = '/* @var FullyQualified $originalName */
|
|
|
|
|
|
|
|
$stmts[] = $this->createAliasStmt($originalName, $stmt);';
|
|
|
|
|
|
|
|
$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\'
|
|
|
|
)
|
2019-06-09 02:10:51 +02:00
|
|
|
),
|
|
|
|
new Node\Arg(
|
|
|
|
new Node\Expr\ConstFetch(
|
|
|
|
new Node\Name(\'false\')
|
|
|
|
)
|
2019-06-09 01:51:40 +02:00
|
|
|
)
|
|
|
|
]
|
|
|
|
),
|
|
|
|
[\'stmts\' => [$aliasStmt]]
|
|
|
|
);';
|
|
|
|
|
|
|
|
$contents = file_get_contents($vendor_path);
|
|
|
|
|
|
|
|
$contents = str_replace($search, $replace, $contents);
|
|
|
|
|
|
|
|
file_put_contents($vendor_path, $contents);
|