-
-
Notifications
You must be signed in to change notification settings - Fork 75
PSR-0 dependencies are not correctly prefixed #127
Copy link
Copy link
Closed
Description
| Question | Answer |
|---|---|
| PHP-Scoper version | master 1ca326d |
| PHP version | 7.1.4 |
| Composer version | 1.5.2 2017-09-11 16:59:25 |
| Github Repo | https://github.com/borNfreee/php-scoper-bug |
I'm trying to prefix Infection application but faced an issue with PSR-0 dependency which is not correctly resolved.
I've created a github repo with reproducible issue - just a very small application with only 1 dependency - Pimple container which uses PSR-0 in its composer.json.
How to reproduce:
git clone https://github.com/borNfreee/php-scoper-bug
cd php-scoper-bug
composer install
# check it works
php src/main.php // prints "Hello"
# run PHP-Scoper
php-scoper add-prefix --output-dir=build-prefixed --force --prefix=Mutant
composer dump-autoload --working-dir=build-prefixed/ --classmap-authoritative --no-dev
# Then try to run prefixed application:
cd build-prefixed
php src/main.phpThis throws an error:
PHP Fatal error: Uncaught Error: Class 'Mutant\Pimple\Container' not found in php-scoper-bug/build-prefixed/src/Application.php:10
Stack trace: ...Please note that composer create autoload_static.php with the following content for PSR-0 dependencies:
public static $prefixesPsr0 = array (
'P' =>
array (
'Pimple' => // <------- this is not prefixed
array (
0 => __DIR__ . '/..' . '/pimple/pimple/src',
),
),
);
while PSR-4 dependencies are prefixed:
public static $prefixDirsPsr4 = array (
'Mutant\\ScoperBug\\' =>
array (
0 => __DIR__ . '/../..' . '/src',
),
'Mutant\\Psr\\Container\\' =>
array (
0 => __DIR__ . '/..' . '/psr/container/src',
),
);Did I miss something?
Hope this helps!
Reactions are currently unavailable