File tree 3 files changed +17
-2
lines changed
3 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -8,5 +8,6 @@ parameters:
8
8
unusedClassElements : true
9
9
readComposerPhpVersion : true
10
10
dateTimeInstantiation : true
11
+ detectDuplicateStubFiles : true
11
12
stubFiles :
12
13
- ../stubs/SplObjectStorage.stub
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ parameters:
21
21
unusedClassElements : false
22
22
readComposerPhpVersion : false
23
23
dateTimeInstantiation : false
24
+ detectDuplicateStubFiles : false
24
25
fileExtensions :
25
26
- php
26
27
checkAlwaysTrueCheckTypeFunctionCall : false
@@ -165,8 +166,9 @@ parametersSchema:
165
166
nullCoalesce : bool (),
166
167
fileWhitespace : bool (),
167
168
unusedClassElements : bool (),
168
- readComposerPhpVersion : bool ()
169
- dateTimeInstantiation : bool ()
169
+ readComposerPhpVersion : bool (),
170
+ dateTimeInstantiation : bool (),
171
+ detectDuplicateStubFiles : bool ()
170
172
])
171
173
fileExtensions : listOf (string ())
172
174
checkAlwaysTrueCheckTypeFunctionCall : bool ()
Original file line number Diff line number Diff line change @@ -385,7 +385,19 @@ public static function begin(
385
385
throw new \PHPStan \Command \InceptionNotSuccessfulException ();
386
386
}
387
387
388
+ $ alreadyAddedStubFiles = [];
388
389
foreach ($ container ->getParameter ('stubFiles ' ) as $ stubFile ) {
390
+ if (
391
+ $ container ->getParameter ('featureToggles ' )['detectDuplicateStubFiles ' ]
392
+ && array_key_exists ($ stubFile , $ alreadyAddedStubFiles )
393
+ ) {
394
+ $ errorOutput ->writeLineFormatted (sprintf ('Stub file %s is added multiple times. ' , $ stubFile ));
395
+
396
+ throw new \PHPStan \Command \InceptionNotSuccessfulException ();
397
+ }
398
+
399
+ $ alreadyAddedStubFiles [$ stubFile ] = true ;
400
+
389
401
if (is_file ($ stubFile )) {
390
402
continue ;
391
403
}
You can’t perform that action at this time.
0 commit comments