45
45
'exclude-files ' => $ stubs ,
46
46
'php-version ' => '7.4 ' ,
47
47
'patchers ' => [
48
- function (string $ filePath , string $ prefix , string $ content ): string {
49
- if ($ filePath !== 'bin/phpstan ' ) {
50
- return $ content ;
51
- }
52
- return str_replace ('__DIR__ . \'/.. ' , '\'phar://phpstan.phar ' , $ content );
53
- },
54
- function (string $ filePath , string $ prefix , string $ content ): string {
55
- if ($ filePath !== 'bin/phpstan ' ) {
56
- return $ content ;
57
- }
58
- return str_replace (sprintf ('%s \\\\__PHPSTAN_RUNNING__ ' , $ prefix ), '__PHPSTAN_RUNNING__ ' , $ content );
59
- },
60
48
function (string $ filePath , string $ prefix , string $ content ): string {
61
49
if ($ filePath !== 'vendor/nette/di/src/DI/Compiler.php ' ) {
62
50
return $ content ;
63
51
}
64
- return str_replace ('|Nette \\\\ DI \\\\ Statement ' , sprintf ('| \\\\ %s \\\\ Nette \\\\ DI \\ \\Statement ' , $ prefix ), $ content );
52
+ return str_replace ('|Nette \\DI \\Statement ' , sprintf ('| \\%s \\Nette \\DI \\Statement ' , $ prefix ), $ content );
65
53
},
66
54
function (string $ filePath , string $ prefix , string $ content ): string {
67
55
if ($ filePath !== 'vendor/nette/di/src/DI/Extensions/DefinitionSchema.php ' ) {
68
56
return $ content ;
69
57
}
70
58
$ content = str_replace (
71
- sprintf ('\'%s \\\\callable ' , $ prefix ),
72
- '\'callable ' ,
73
- $ content
74
- );
75
- $ content = str_replace (
76
- '|Nette \\\\DI \\\\Definitions \\\\Statement ' ,
77
- sprintf ('|%s \\\\Nette \\\\DI \\\\Definitions \\\\Statement ' , $ prefix ),
59
+ '|Nette \\DI \\Definitions \\Statement ' ,
60
+ sprintf ('|%s \\Nette \\DI \\Definitions \\Statement ' , $ prefix ),
78
61
$ content
79
62
);
80
63
@@ -85,28 +68,13 @@ function (string $filePath, string $prefix, string $content): string {
85
68
return $ content ;
86
69
}
87
70
$ content = str_replace (
88
- sprintf ('\'%s \\\\string ' , $ prefix ),
89
- '\'string ' ,
90
- $ content
91
- );
92
- $ content = str_replace (
93
- '|Nette \\\\DI \\\\Definitions \\\\Statement ' ,
94
- sprintf ('|%s \\\\Nette \\\\DI \\\\Definitions \\\\Statement ' , $ prefix ),
71
+ '|Nette \\DI \\Definitions \\Statement ' ,
72
+ sprintf ('|%s \\Nette \\DI \\Definitions \\Statement ' , $ prefix ),
95
73
$ content
96
74
);
97
75
98
76
return $ content ;
99
77
},
100
- function (string $ filePath , string $ prefix , string $ content ): string {
101
- if (strpos ($ filePath , 'src/ ' ) !== 0 ) {
102
- return $ content ;
103
- }
104
-
105
- $ content = str_replace (sprintf ('\'%s \\\\r \\\\n \'' , $ prefix ), '\'\\\\r \\\\n \'' , $ content );
106
- $ content = str_replace (sprintf ('\'%s \\\\' , $ prefix ), '\'' , $ content );
107
-
108
- return $ content ;
109
- },
110
78
function (string $ filePath , string $ prefix , string $ content ): string {
111
79
if (strpos ($ filePath , '.neon ' ) === false ) {
112
80
return $ content ;
@@ -178,21 +146,12 @@ function (string $filePath, string $prefix, string $content): string {
178
146
179
147
return str_replace (sprintf ('%s \\Composer \\InstalledVersions ' , $ prefix ), 'Composer \\InstalledVersions ' , $ content );
180
148
},
181
- function (string $ filePath , string $ prefix , string $ content ): string {
182
- if ($ filePath !== 'vendor/jetbrains/phpstorm-stubs/PhpStormStubsMap.php ' ) {
183
- return $ content ;
184
- }
185
-
186
- $ content = str_replace ('\'' . $ prefix . '\\\\' , '\'' , $ content );
187
-
188
- return $ content ;
189
- },
190
149
function (string $ filePath , string $ prefix , string $ content ): string {
191
150
if ($ filePath !== 'vendor/phpstan/php-8-stubs/Php8StubsMap.php ' ) {
192
151
return $ content ;
193
152
}
194
153
195
- $ content = str_replace ('\'' . $ prefix . '\\\\ ' , '\'' , $ content );
154
+ $ content = str_replace ('\'' . $ prefix . '\\' , '\'' , $ content );
196
155
197
156
return $ content ;
198
157
},
@@ -208,7 +167,7 @@ function (string $filePath, string $prefix, string $content): string {
208
167
return $ content ;
209
168
}
210
169
211
- return str_replace (sprintf ('\'%s \\\\ JetBrains \\\\ ' , $ prefix ), '\'JetBrains \\ \\' , $ content );
170
+ return str_replace (sprintf ('\'%s \\JetBrains \\' , $ prefix ), '\'JetBrains \\' , $ content );
212
171
},
213
172
function (string $ filePath , string $ prefix , string $ content ): string {
214
173
if (!str_starts_with ($ filePath , 'vendor/nikic/php-parser/lib ' )) {
@@ -244,12 +203,6 @@ function (string $filePath, string $prefix, string $content): string {
244
203
245
204
return str_replace ('#[Language( \'RegExp \')] ' , '' , $ content );
246
205
},
247
- function (string $ filePath , string $ prefix , string $ content ): string {
248
- if ($ filePath !== 'vendor/fidry/cpu-core-counter/src/Finder/WindowsRegistryLogicalFinder.php ' ) {
249
- return $ content ;
250
- }
251
- return str_replace (sprintf ('%s \\\\reg query ' , $ prefix ), 'reg query ' , $ content );
252
- },
253
206
],
254
207
'exclude-namespaces ' => [
255
208
'PHPStan ' ,
0 commit comments