-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Scope dependencies --------- Co-authored-by: Matthias Simonis <github@matthias-simonis.de>
- Loading branch information
1 parent
d8ae6d6
commit 7f0d56f
Showing
9 changed files
with
219 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ | |
|
||
$CONFIG = [ | ||
'skeletondirectory' => '', | ||
'debug' => true, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
memory_limit=-1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
use Isolated\Symfony\Component\Finder\Finder; | ||
|
||
// You can do your own things here, e.g. collecting symbols to expose dynamically | ||
// or files to exclude. | ||
// However beware that this file is executed by PHP-Scoper, hence if you are using | ||
// the PHAR it will be loaded by the PHAR. So it is highly recommended to avoid | ||
// to auto-load any code here: it can result in a conflict or even corrupt | ||
// the PHP-Scoper analysis. | ||
|
||
// Example of collecting files to include in the scoped build but to not scope | ||
// leveraging the isolated finder. | ||
// $excludedFiles = array_map( | ||
// static fn (SplFileInfo $fileInfo) => $fileInfo->getPathName(), | ||
// iterator_to_array( | ||
// Finder::create()->files()->in(__DIR__), | ||
// false, | ||
// ), | ||
// ); | ||
$excludedFiles = ['templates/admin.php']; | ||
|
||
return [ | ||
// The prefix configuration. If a non-null value is used, a random prefix | ||
// will be generated instead. | ||
// | ||
// For more see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#prefix | ||
'prefix' => 'OCA\\GDataVaas\\Vendor', | ||
|
||
// The base output directory for the prefixed files. | ||
// This will be overridden by the 'output-dir' command line option if present. | ||
'output-dir' => null, | ||
|
||
// 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. | ||
// | ||
// This configuration entry is completely ignored when using Box. | ||
// | ||
// For more see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#finders-and-paths | ||
'finders' => [ | ||
Finder::create() | ||
->files() | ||
->ignoreVCS(true) | ||
->ignoreDotFiles(true) | ||
->exclude([ | ||
'build', | ||
'.devcontainer', | ||
'nextcloud-server', | ||
'tests', | ||
'tmp', | ||
'test', | ||
'examples' | ||
]) | ||
->in(__DIR__), | ||
], | ||
|
||
// List of excluded files, i.e. files for which the content will be left untouched. | ||
// Paths are relative to the configuration file unless if they are already absolute | ||
// | ||
// For more see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#patchers | ||
'exclude-files' => [ | ||
// 'src/an-excluded-file.php', | ||
...$excludedFiles, | ||
], | ||
|
||
// PHP version (e.g. `'7.2'`) in which the PHP parser and printer will be configured into. This will affect what | ||
// level of code it will understand and how the code will be printed. | ||
// If none (or `null`) is configured, then the host version will be used. | ||
'php-version' => null, | ||
|
||
// When scoping PHP files, there will be scenarios where some of the code being scoped indirectly references the | ||
// original namespace. These will include, for example, strings or string manipulations. PHP-Scoper has limited | ||
// support for prefixing such strings. To circumvent that, you can define patchers to manipulate the file to your | ||
// heart contents. | ||
// | ||
// For more see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#patchers | ||
'patchers' => [ | ||
static function (string $filePath, string $prefix, string $contents): string { | ||
// Change the contents here. | ||
|
||
if (str_ends_with($filePath, 'vendor/netresearch/jsonmapper/src/JsonMapper.php') === true) { | ||
$contents = str_replace("namespace $prefix;", "namespace $prefix\\JsonMapper;", $contents); | ||
} | ||
|
||
if (str_ends_with($filePath, 'vendor/netresearch/jsonmapper/src/JsonMapper/Exception.php') === true) { | ||
$contents = str_replace("namespace $prefix;", "namespace $prefix\\JsonMapper;", $contents); | ||
} | ||
|
||
if (str_ends_with($filePath, 'vendor/gdata/vaas/Vaas.php') === true) { | ||
$contents = str_replace('use OCA\GDataVaas\Vendor\JsonMapper', 'use OCA\GDataVaas\Vendor\JsonMapper\JsonMapper', $contents); | ||
} | ||
|
||
return $contents; | ||
}, | ||
], | ||
|
||
// List of symbols to consider internal i.e. to leave untouched. | ||
// | ||
// For more information see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#excluded-symbols | ||
'exclude-namespaces' => [ | ||
'Psr', | ||
'OCA', | ||
'OCP', | ||
'OC\Files', | ||
'OC\SystemTag', | ||
'Symfony', | ||
'Icewind' | ||
], | ||
'exclude-classes' => [ | ||
'OC', | ||
], | ||
'exclude-functions' => [ | ||
], | ||
'exclude-constants' => [ | ||
// 'STDIN', | ||
], | ||
|
||
// List of symbols to expose. | ||
// | ||
// For more information see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#exposed-symbols | ||
'expose-global-constants' => false, | ||
'expose-global-classes' => false, | ||
'expose-global-functions' => false, | ||
'expose-namespaces' => [ | ||
// 'Acme\Foo' // The Acme\Foo namespace (and sub-namespaces) | ||
// '~^PHPUnit\\\\Framework$~', // The whole namespace PHPUnit\Framework (but not sub-namespaces) | ||
// '~^$~', // The root namespace only | ||
// '', // Any namespace | ||
], | ||
'expose-classes' => [], | ||
'expose-functions' => [], | ||
'expose-constants' => [], | ||
]; |