File tree Expand file tree Collapse file tree 2 files changed +24
-4
lines changed
Expand file tree Collapse file tree 2 files changed +24
-4
lines changed Original file line number Diff line number Diff line change @@ -127,6 +127,10 @@ extensions:
127127 whitelist:
128128 - src
129129 - lib
130+ # or to apply filtering on files names
131+ #- directory: src
132+ # suffix: "Controller.php"
133+ # prefix: "Get"
130134 #
131135 # Whiltelist files for which code generation should be done
132136 # Default: empty
@@ -137,6 +141,10 @@ extensions:
137141 # Blacklist directories for which code generation should NOT be done
138142 #blacklist:
139143 #- src/legacy
144+ # or to apply filtering on files names
145+ #- directory: src/legacy
146+ # suffix: "Spec.php"
147+ # prefix: "Test"
140148 #
141149 # Blacklist files for which code generation should NOT be done
142150 #blacklist_files:
@@ -161,10 +169,12 @@ extensions:
161169* `high_lower_bound` (optional) sets high lower bound for code coverage
162170 (default `70`)
163171* `whitelist` takes an array of directories to whitelist (default: `lib`,
164- ` src` ).
172+ ` src` ). The array can be made more specific if an associative array is
173+ given with the following keys (`directory`, `prefix`, `suffix`)
165174* `whitelist_files` takes an array of files to whitelist (default: none).
166175* `blacklist` takes an array of directories to blacklist (default: `test,
167- vendor, spec`)
176+ vendor, spec`). The array can be made more specific if an associative
177+ array is given with the following keys (`directory`, `prefix`, `suffix`)
168178* `blacklist_files` takes an array of files to blacklist
169179
170180# # Authors
Original file line number Diff line number Diff line change 2121use SebastianBergmann \CodeCoverage \Report ;
2222use Symfony \Component \EventDispatcher \EventSubscriberInterface ;
2323
24+ use function is_string ;
25+
2426/**
2527 * @author Henrik Bjornskov
2628 */
@@ -146,11 +148,19 @@ public function beforeSuite(SuiteEvent $event): void
146148 $ filter = $ this ->coverage ->filter ();
147149
148150 foreach ($ this ->options ['whitelist ' ] as $ option ) {
149- $ filter ->includeDirectory ($ option );
151+ if (is_string ($ option )) {
152+ $ option = ['directory ' => $ option ];
153+ }
154+ $ option = $ option + ['suffix ' => '.php ' , 'prefix ' => '' ];
155+ $ filter ->includeDirectory ($ option ['directory ' ], $ option ['suffix ' ], $ option ['prefix ' ]);
150156 }
151157
152158 foreach ($ this ->options ['blacklist ' ] as $ option ) {
153- $ filter ->excludeDirectory ($ option );
159+ if (is_string ($ option )) {
160+ $ option = ['directory ' => $ option ];
161+ }
162+ $ option = $ option + ['suffix ' => '.php ' , 'prefix ' => '' ];
163+ $ filter ->excludeDirectory ($ option ['directory ' ], $ option ['suffix ' ], $ option ['prefix ' ]);
154164 }
155165
156166 $ filter ->includeFiles ($ this ->options ['whitelist_files ' ]);
You can’t perform that action at this time.
0 commit comments