@@ -144,11 +144,6 @@ public function tryLoad(string $type): void
144144 */
145145 public function addDirectory (...$ paths ): self
146146 {
147- if (is_array ($ paths [0 ] ?? null )) {
148- trigger_error (__METHOD__ . '() use variadics ...$paths to add an array of paths. ' , E_USER_WARNING );
149- $ paths = $ paths [0 ];
150- }
151-
152147 $ this ->scanPaths = array_merge ($ this ->scanPaths , $ paths );
153148 return $ this ;
154149 }
@@ -167,11 +162,6 @@ public function reportParseErrors(bool $on = true): self
167162 */
168163 public function excludeDirectory (...$ paths ): self
169164 {
170- if (is_array ($ paths [0 ] ?? null )) {
171- trigger_error (__METHOD__ . '() use variadics ...$paths to add an array of paths. ' , E_USER_WARNING );
172- $ paths = $ paths [0 ];
173- }
174-
175165 $ this ->excludeDirs = array_merge ($ this ->excludeDirs , $ paths );
176166 return $ this ;
177167 }
@@ -283,31 +273,22 @@ private function createFileIterator(string $dir): Nette\Utils\Finder
283273
284274 $ dir = realpath ($ dir ) ?: $ dir ; // realpath does not work in phar
285275
286- if (is_string ($ ignoreDirs = $ this ->ignoreDirs )) {
287- trigger_error (self ::class . ': $ignoreDirs must be an array. ' , E_USER_WARNING );
288- $ ignoreDirs = preg_split ('#[,\s]+# ' , $ ignoreDirs );
289- }
290276
291277 $ disallow = [];
292- foreach (array_merge ($ ignoreDirs , $ this ->excludeDirs ) as $ item ) {
278+ foreach (array_merge ($ this -> ignoreDirs , $ this ->excludeDirs ) as $ item ) {
293279 if ($ item = realpath ($ item )) {
294280 $ disallow [str_replace ('\\' , '/ ' , $ item )] = true ;
295281 }
296282 }
297283
298- if (is_string ($ acceptFiles = $ this ->acceptFiles )) {
299- trigger_error (self ::class . ': $acceptFiles must be an array. ' , E_USER_WARNING );
300- $ acceptFiles = preg_split ('#[,\s]+# ' , $ acceptFiles );
301- }
302-
303- $ iterator = Nette \Utils \Finder::findFiles (...$ acceptFiles )
284+ $ iterator = Nette \Utils \Finder::findFiles (...$ this ->acceptFiles )
304285 ->filter (function (SplFileInfo $ file ) use (&$ disallow ) {
305286 return $ file ->getRealPath () === false
306287 ? true
307288 : !isset ($ disallow [str_replace ('\\' , '/ ' , $ file ->getRealPath ())]);
308289 })
309290 ->from ($ dir )
310- ->exclude (...$ ignoreDirs )
291+ ->exclude (...$ this -> ignoreDirs )
311292 ->filter ($ filter = function (SplFileInfo $ dir ) use (&$ disallow ) {
312293 if ($ dir ->getRealPath () === false ) {
313294 return true ;
0 commit comments