File tree Expand file tree Collapse file tree 3 files changed +17
-2
lines changed
Expand file tree Collapse file tree 3 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -8,5 +8,6 @@ parameters:
88 unusedClassElements : true
99 readComposerPhpVersion : true
1010 dateTimeInstantiation : true
11+ detectDuplicateStubFiles : true
1112 stubFiles :
1213 - ../stubs/SplObjectStorage.stub
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ parameters:
2121 unusedClassElements : false
2222 readComposerPhpVersion : false
2323 dateTimeInstantiation : false
24+ detectDuplicateStubFiles : false
2425 fileExtensions :
2526 - php
2627 checkAlwaysTrueCheckTypeFunctionCall : false
@@ -165,8 +166,9 @@ parametersSchema:
165166 nullCoalesce : bool (),
166167 fileWhitespace : bool (),
167168 unusedClassElements : bool (),
168- readComposerPhpVersion : bool ()
169- dateTimeInstantiation : bool ()
169+ readComposerPhpVersion : bool (),
170+ dateTimeInstantiation : bool (),
171+ detectDuplicateStubFiles : bool ()
170172 ])
171173 fileExtensions : listOf (string ())
172174 checkAlwaysTrueCheckTypeFunctionCall : bool ()
Original file line number Diff line number Diff line change @@ -385,7 +385,19 @@ public static function begin(
385385 throw new \PHPStan \Command \InceptionNotSuccessfulException ();
386386 }
387387
388+ $ alreadyAddedStubFiles = [];
388389 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+
389401 if (is_file ($ stubFile )) {
390402 continue ;
391403 }
You can’t perform that action at this time.
0 commit comments