-
Notifications
You must be signed in to change notification settings - Fork 3
/
.scoper.inc.php
114 lines (103 loc) · 4.69 KB
/
.scoper.inc.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<?php
declare(strict_types=1);
use Isolated\Symfony\Component\Finder\Finder;
const AVATAR_PRIVACY_EXCLUDED_FILES = '.*\\.dist|Makefile|composer\\.json|composer\\.lock|phpcs\\.xml|phpunit.xml|phpbench\\.json|.*\\.md|.*\\.txt';
const AVATAR_PRIVACY_EXCLUDED_DIRS = [
'bin',
'doc',
'test',
'test_old',
'tests',
'Tests',
'vendor-bin',
// Partial templates will be copied by Grunt.
'partials'
];
return [
// The prefix configuration. If a non null value will be used, a random prefix will be generated.
'prefix' => 'Avatar_Privacy\Vendor',
// 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' => [
// The DI container needs only one file.
Finder::create()
->files()
->ignoreVCS(true)
->notName( '/' . AVATAR_PRIVACY_EXCLUDED_FILES . '/' )
->exclude( [
'Extra',
'Loader',
'tests',
] )
->in('vendor/level-2'),
// Our own vendor modules.
Finder::create()
->files()
->ignoreVCS(true)
->notName( '/' . AVATAR_PRIVACY_EXCLUDED_FILES . '/' )
->exclude( AVATAR_PRIVACY_EXCLUDED_DIRS )
->in('vendor/mundschenk-at'),
// Various other dependencies.
Finder::create()
->files()
->ignoreVCS(true)
->notName( '/' . AVATAR_PRIVACY_EXCLUDED_FILES . '/' )
->exclude( AVATAR_PRIVACY_EXCLUDED_DIRS )
->in('vendor/mistic100'),
Finder::create()
->files()
->ignoreVCS(true)
->notName( '/' . AVATAR_PRIVACY_EXCLUDED_FILES . '/' )
->exclude( AVATAR_PRIVACY_EXCLUDED_DIRS )
->in('vendor/jdenticon'),
Finder::create()
->files()
->ignoreVCS(true)
->notName( '/' . AVATAR_PRIVACY_EXCLUDED_FILES . '/' )
->exclude( AVATAR_PRIVACY_EXCLUDED_DIRS )
->in('vendor/splitbrain'),
Finder::create()->append([
'composer.json',
'vendor/composer/installed.json',
]),
],
// Whitelists a list of files. Unlike the other whitelist related features, this one is about completely leaving
// a file untouched.
// Paths are relative to the configuration file unless if they are already absolute
'exclude-files' => [],
'exclude-namespaces' => [],
'exclude-classes' => \array_merge(
\json_decode( \file_get_contents( 'vendor/sniccowp/php-scoper-wordpress-excludes/generated/exclude-wordpress-classes.json' ) ),
\json_decode( \file_get_contents( 'vendor/sniccowp/php-scoper-wordpress-excludes/generated/exclude-wordpress-interfaces.json' ) ),
),
'exclude-functions' => \json_decode( \file_get_contents( 'vendor/sniccowp/php-scoper-wordpress-excludes/generated/exclude-wordpress-functions.json' ) ),
'exclude-constants' => \json_decode( \file_get_contents( 'vendor/sniccowp/php-scoper-wordpress-excludes/generated/exclude-wordpress-constants.json' ) ),
// 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#patchers
/*
'patchers' => [
function (string $file_path, string $prefix, string $contents): string {
return $contents;
},
],
*/
// If `true` then the user defined constants belonging to the global namespace will not be prefixed.
//
// For more see https://github.com/humbug/php-scoper#constants--constants--functions-from-the-global-namespace
'expose-global-constants' => true,
// If `true` then the user defined classes belonging to the global namespace will not be prefixed.
//
// For more see https://github.com/humbug/php-scoper#constants--constants--functions-from-the-global-namespace
'expose-global-classes' => true,
// If `true` then the user defined functions belonging to the global namespace will not be prefixed.
//
// For more see https://github.com/humbug/php-scoper#constants--constants--functions-from-the-global-namespace
'expose-global-functions' => true,
];