-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscoper.inc.php
More file actions
67 lines (60 loc) · 1.83 KB
/
scoper.inc.php
File metadata and controls
67 lines (60 loc) · 1.83 KB
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
<?php
/**
* PHP-Scoper is a tool which essentially moves any body of code, including all
* dependencies such as vendor directories, to a new and distinct namespace.
*
* @package PluginWP
*/
use Isolated\Symfony\Component\Finder\Finder;
return array(
// 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' => 'PluginWP\Dependencies',
// The base output directory for the prefixed files.
// This will be overridden by the 'output-dir' command line option if present.
'output-dir' => 'vendor_prefixed',
// 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/blob/master/docs/configuration.md#finders-and-paths.
'finders' => array(
Finder::create()
->files()
->ignoreVCS( true )
->notName(
array(
'README.md',
'/\.dist/',
'Makefile',
'composer.json',
'composer.lock',
)
)
->exclude(
array(
'doc',
'test',
'test_old',
'tests',
'Tests',
'vendor-bin',
'composer',
)
)
->in( 'vendor' ),
),
'patchers' => array(
function ( $file_path, $prefix, $content ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter
// ERROR date() is affected by runtime timezone changes which can cause date/time to be incorrectly displayed. Use gmdate() instead. (WordPress.DateTime.RestrictedFunctions.date_date).
$content = preg_replace(
'/(\W)date([\(;])/',
'$1gmdate$2',
$content
);
return $content;
},
),
);