From 1ecf1c41134953e464d6fed6cc9fbce6bb77c4d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20FIDRY?= Date: Sat, 5 May 2018 01:43:43 +0100 Subject: [PATCH] Update Box --- .gitignore | 2 +- bin/build-phar.sh | 7 +------ box.json.dist | 18 +++++++----------- scoper.inc.php | 10 ++++++++++ 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/.gitignore b/.gitignore index 1ca53917d..a44c25f7b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -/bin/psalm.phar +/build/ /vendor/ /.DS_Store /.php_cs.cache diff --git a/bin/build-phar.sh b/bin/build-phar.sh index 493f93a20..15dbaca20 100755 --- a/bin/build-phar.sh +++ b/bin/build-phar.sh @@ -1,11 +1,6 @@ #!/usr/bin/env bash -if ! php -r 'extension_loaded("bz2") or exit(1);' ; then - echo "You need to install (or enable) bz2 php extension" - exit 1 -fi - composer bin box install vendor/bin/box compile -bin/psalm.phar --config=bin/phar.psalm.xml --root=src +build/psalm.phar --config=bin/phar.psalm.xml diff --git a/box.json.dist b/box.json.dist index 1077461ac..c927932ff 100644 --- a/box.json.dist +++ b/box.json.dist @@ -1,16 +1,12 @@ { - "main" : "psalm", - "output" : "bin/psalm.phar", - "directories" : [ - "assets", - "src", - "vendor" - ], - "files" : [ - "composer.json", - "composer.lock", - "config.xsd" + "output" : "build/psalm.phar", + "files": [ + "src/command_functions.php", + "src/psalm.php", + "src/psalter.php" ], + "files-bin": ["config.xsd"], + "directories-bin" : ["assets"], "intercept" : false, "compactors" : [ "KevinGH\\Box\\Compactor\\PhpScoper" diff --git a/scoper.inc.php b/scoper.inc.php index 677dae19b..dedd86dc9 100644 --- a/scoper.inc.php +++ b/scoper.inc.php @@ -18,6 +18,13 @@ return [ return $contents; }, + function ($filePath, $prefix, $contents) { + return str_replace( + '\\'.$prefix.'\Composer\Autoload\ClassLoader', + '\Composer\Autoload\ClassLoader', + $contents + ); + }, function ($filePath, $prefix, $contents) { if ($filePath === realpath(__DIR__ . '/src/Psalm/Config.php')) { return str_replace( @@ -108,4 +115,7 @@ return [ return $contents; }, ], + 'whitelist' => [ + \Composer\Autoload\ClassLoader::class, + ] ];