mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 20:34:47 +01:00
Hack around PHP 7.3 polyfill scoping
This commit is contained in:
parent
08d029b3c5
commit
bfbe9a527a
@ -60,8 +60,8 @@ jobs:
|
||||
- vendor/bin/phpcs
|
||||
|
||||
- stage: Phar build
|
||||
php: 7.2
|
||||
env: DEPS="low"
|
||||
php: 7.3
|
||||
env: DEPS="high"
|
||||
script: bin/build-phar.sh
|
||||
deploy:
|
||||
# deploy tagged releases to github releases page
|
||||
|
@ -4,6 +4,10 @@ set -e
|
||||
|
||||
composer bin box install
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
|
||||
php $DIR/improve_class_alias.php
|
||||
|
||||
vendor/bin/box compile
|
||||
|
||||
if [[ "$GPG_ENCRYPTION" != '' ]] ; then
|
||||
|
36
bin/improve_class_alias.php
Normal file
36
bin/improve_class_alias.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?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\'
|
||||
)
|
||||
)
|
||||
]
|
||||
),
|
||||
[\'stmts\' => [$aliasStmt]]
|
||||
);';
|
||||
|
||||
$contents = file_get_contents($vendor_path);
|
||||
|
||||
$contents = str_replace($search, $replace, $contents);
|
||||
|
||||
file_put_contents($vendor_path, $contents);
|
||||
|
Loading…
Reference in New Issue
Block a user