1- <?php
2-
3- declare (strict_types=1 );
1+ <?php declare (strict_types=1 );
42
53use Isolated \Symfony \Component \Finder \Finder ;
64
7- return [
8- 'prefix ' => 'OTWSystems \\WpOidcLogin \\Vendor ' ,
5+ function getWpExcludedSymbols (string $ fileName ): array
6+ {
7+ $ filePath = __DIR__ . '/vendor/sniccowp/php-scoper-wordpress-excludes/generated/ ' . $ fileName ;
8+
9+ return json_decode (
10+ file_get_contents ($ filePath ),
11+ true ,
12+ );
13+ }
914
15+ $ wpConstants = getWpExcludedSymbols ('exclude-wordpress-constants.json ' );
16+ $ wpClasses = getWpExcludedSymbols ('exclude-wordpress-classes.json ' );
17+ $ wpFunctions = getWpExcludedSymbols ('exclude-wordpress-functions.json ' );
18+
19+ return [
20+ 'prefix ' => 'OTWSystems\WpOidcLogin\Vendor ' ,
1021 'finders ' => [
1122 Finder::create ()
1223 ->files ()
1324 ->ignoreVCS (true )
14- ->notName ('/.* \\ .dist|Makefile|scoper.inc.php|build.sh|public-signing-key.pub|composer.json|composer.lock/ ' )
25+ ->notName ('/.*\.dist|Makefile|scoper.inc.php|build.sh|public-signing-key.pub|composer.json|composer.lock/ ' )
1526 ->exclude ([
1627 'doc ' ,
1728 'test ' ,
2031 'Tests ' ,
2132 'vendor-bin ' ,
2233 ])
23- ->in (['vendor ' , '. ' ]),
24-
34+ ->in (['vendor ' , '. ' ]),
2535 Finder::create ()->append ([
2636 'composer.json ' ,
2737 ]),
2838 ],
29-
30- 'exclude-constants ' => [
39+ 'exclude-constants ' => array_merge ([
3140 'ABSPATH ' ,
3241 'WP_OIDC_LOGIN_VERSION ' ,
33- ],
34-
42+ ], $ wpConstants ),
43+ 'exclude-classes ' => $ wpClasses ,
44+ 'exclude-functions ' => $ wpFunctions ,
3545 'exclude-namespaces ' => [
3646 '/^OTWSystems \\\\WpOidcLogin \\\\/ ' ,
3747 '/^OTWSystems \\\\WpOidcLogin/ ' ,
38- '/^Psr \\\/ ' ,
48+ '/^Psr \\\\ / ' ,
3949 ],
40-
41- 'expose-global-constants ' => false ,
42- 'expose-global-classes ' => false ,
43- 'expose-global-functions ' => false ,
44-
50+ 'expose-global-constants ' => false ,
51+ 'expose-global-classes ' => false ,
52+ 'expose-global-functions ' => false ,
4553 'patchers ' => [
4654 static function (string $ filePath , string $ prefix , string $ content ): string {
4755 // Fix the string reference of a scoped dependency in the Math lib
@@ -51,15 +59,15 @@ static function (string $filePath, string $prefix, string $content): string {
5159 str_ends_with ($ filePath , 'vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/Engine.php ' )
5260 ) {
5361 $ content = str_replace (
54- 'phpseclib3 \\ Math \\ BigInteger \ \Engines \\\\' ,
62+ 'phpseclib3\Math\BigInteger\Engines \\\\' ,
5563 "{$ escapedPrefix }\\\\phpseclib3 \\\\Math \\\\BigInteger \\\\Engines \\\\" ,
5664 $ content
5765 );
5866 }
5967
6068 if (str_ends_with ($ filePath , 'vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/AsymmetricKey.php ' )) {
6169 $ content = str_replace (
62- 'phpseclib3 \\ Crypt \\\\' ,
70+ 'phpseclib3\Crypt \\\\' ,
6371 "{$ escapedPrefix }\\\\phpseclib3 \\\\Crypt \\\\" ,
6472 $ content
6573 );
0 commit comments