Skip to content

Commit 13a8d0f

Browse files
committed
cleanup scoper
1 parent 112880d commit 13a8d0f

File tree

2 files changed

+3
-55
lines changed

2 files changed

+3
-55
lines changed

prefix-code.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ php -d memory_limit=-1 php-scoper.phar add-prefix bin src vendor composer.json -
3434

3535
# the output code is in "/scoped-code", lets move it up
3636
# the local directories have to be empty to move easily
37-
rm -r bin src vendor composer.json stubs
37+
rm -r bin src vendor composer.json
3838
mv scoped-code/* .
3939

4040
note "Dumping Composer Autoload"

scoper.php

Lines changed: 2 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -12,68 +12,16 @@
1212

1313
// see https://github.com/humbug/php-scoper
1414
return [
15-
'prefix' => 'SwissKnife' . $timestamp,
15+
'prefix' => 'Jack' . $timestamp,
1616
'expose-constants' => ['#^SYMFONY\_[\p{L}_]+$#'],
1717
'exclude-namespaces' => [
18-
'#^Rector\\\\SwissKnife#',
18+
'#^Rector\\\\Jack#',
1919
'#^Symfony\\\\Polyfill#',
2020
'#^PHPUnit\\\\',
21-
'#^Symfony\\\\Component\\\\Config#',
22-
'#^Symfony\\\\Component\\\\DependencyInjection#',
2321
],
2422
'exclude-files' => [
2523
// do not prefix "trigger_deprecation" from symfony - https://github.com/symfony/symfony/commit/0032b2a2893d3be592d4312b7b098fb9d71aca03
2624
// these paths are relative to this file location, so it should be in the root directory
2725
'vendor/symfony/deprecation-contracts/function.php',
28-
'stubs/PHPUnit/PHPUnit_Framework_TestCase.php',
29-
30-
// keep class references
31-
'src/Enum/SymfonyExtensionClass.php',
32-
33-
// uses native PHPUnit TestCase class in the project
34-
'src/Testing/PHPUnitMocker.php',
35-
'src/Testing/MockWire.php',
36-
],
37-
'patchers' => [
38-
// unprefix test case class names
39-
function (string $filePath, string $prefix, string $content): string {
40-
if (! str_ends_with($filePath, 'packages/Testing/UnitTestFilter.php')
41-
&&
42-
! str_ends_with($filePath, 'src/Testing/MockWire.php')
43-
) {
44-
return $content;
45-
}
46-
47-
$content = Strings::replace(
48-
$content,
49-
'#' . $prefix . '\\\\PHPUnit\\\\Framework\\\\TestCase#',
50-
'PHPUnit\Framework\TestCase'
51-
);
52-
53-
return Strings::replace(
54-
$content,
55-
'#' . $prefix . '\\\\PHPUnit_Framework_TestCase#',
56-
'PHPUnit_Framework_TestCase'
57-
);
58-
},
59-
60-
// unprefix kernerl test case class names
61-
function (string $filePath, string $prefix, string $content): string {
62-
if (! str_ends_with($filePath, 'packages/Testing/UnitTestFilter.php')) {
63-
return $content;
64-
}
65-
66-
$content = Strings::replace(
67-
$content,
68-
'#' . $prefix . '\\\\Symfony\\\\Bundle\\\\FrameworkBundle\\\\Test\\\\KernelTestCase#',
69-
'Symfony\Bundle\FrameworkBundle\Test\KernelTestCase'
70-
);
71-
72-
return Strings::replace(
73-
$content,
74-
'#' . $prefix . '\\\\Symfony\\\\Component\\\\Form\\\\Test\\\\TypeTestCase',
75-
'Symfony\Component\Form\Test\TypeTestCase'
76-
);
77-
},
7826
],
7927
];

0 commit comments

Comments
 (0)