forked from qossmic/deptrac-src
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscoper.inc.php
65 lines (57 loc) · 1.87 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
<?php
declare(strict_types=1);
use Isolated\Symfony\Component\Finder\Finder;
$polyfillsBootstrap = Finder::create()
->files()
->in(__DIR__.'/vendor/symfony/polyfill-*')
->name('*.php');
return [
'prefix' => 'DEPTRAC_INTERNAL',
'finders' => [
Finder::create()->files()->in([
'config',
'src',
'vendor',
])->append([
'bin/deptrac',
'composer.json',
])->exclude([
'bin',
'tests',
'test',
])->notName('/.*\\.(xml|md|dist|neon|zip)|Makefile|composer\\.json|composer\\.lock/'),
],
'patchers' => [
static function (string $filePath, string $prefix, string $content): string {
if (str_contains($filePath, 'src/Supportive/Console/Application.php')) {
// resolve current tag
exec('git tag --points-at', $output, $result_code);
if (0 !== $result_code) {
throw new InvalidArgumentException('Ensure to run compile from composer git repository clone and that git binary is available.');
}
if ([] !== $output) {
$tag = $output[0];
if ('' !== $tag) {
return str_replace('@git-version@', $tag, $content);
}
}
}
return $content;
},
],
'tag-declarations-as-internal' => false,
'exclude-files' => array_map(
static function ($file) {
return $file->getPathName();
},
iterator_to_array($polyfillsBootstrap)
),
'exclude-namespaces' => [
'Qossmic\Deptrac',
'Symfony\Polyfill',
],
'expose-functions' => ['trigger_deprecation'],
'expose-global-constants' => false,
'expose-global-classes' => false,
'expose-global-functions' => false,
];