-
-
Notifications
You must be signed in to change notification settings - Fork 76
Closed
Description
Bug report
| Question | Answer |
|---|---|
| PHP-Scoper version | 0.17.5 |
| PHP version | 8 |
| Platform with version | MacOS |
Hi there,
In a project I'm working on, we have 2 packages with the same vendor name, example "my-company". When scoping the packages, they're both scoped, however the folder structure of one of them is completely broken.
In the configuration below: the package with name "first-package" is correctly scoped under dependencies/first-package - the 2nd package however, for some reason, it's using the entire project structure and becomes dependencies/project-name-here/vendor/my-company/second-package but what I'd need it to be is dependencies/second-package.
Any idea what's causing this?
Note: the 1st package is symlinked locally. The 2nd isn't.
scoper.inc.php
<?php
declare( strict_types=1 );
use Isolated\Symfony\Component\Finder\Finder;
return [
// The prefix configuration. If a non null value will be used, a random prefix will be generated.
'prefix' => 'My_Company\\Plugin\\Test_Plugin\\Dependencies',
/**
* By default when running php-scoper add-prefix, it will prefix all relevant code found in the current working
* directory. You can however define which files should be scoped by defining a collection of Finders in the
* following configuration key.
*
* For more see: https://github.com/humbug/php-scoper#finders-and-paths.
*/
'finders' => [
Finder::create()->
files()->
ignoreVCS( true )->
ignoreDotFiles( true )->
notName( '/LICENSE|.*\\.md|.*\\.dist|Makefile|composer\\.(json|lock)/' )->
exclude(
[
'doc',
'test',
'build',
'test_old',
'tests',
'Tests',
'vendor-bin',
'wp-coding-standards',
'squizlabs',
'phpcompatibility',
'dealerdirect',
'bin',
'vendor'
]
)->
in( [
'vendor/my-company/first-package',
'vendor/my-company/second-package'
] )->
name( [ '*.php' ] ),
],
'patchers' => [
function ( string $file_path, string $prefix, string $contents ): string {
// Change the contents here.
return str_replace(
'Symfony\\\\',
sprintf( '%s\\\\Symfony\\\\', addslashes( $prefix ) ),
$contents
);
},
],
];Output
$ bin/php-scoper add-prefix --config .scoper.inc.php --output-dir dependencies/
> outputReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels