@@ -31,10 +31,12 @@ public function getConfigurableOptions()
31
31
$ resolver ->setDefaults (array (
32
32
'jobs ' => null ,
33
33
'exclude ' => array (),
34
+ 'triggered_by ' => array ('php ' ),
34
35
));
35
36
36
37
$ resolver ->setAllowedTypes ('jobs ' , array ('int ' , 'null ' ));
37
38
$ resolver ->setAllowedTypes ('exclude ' , 'array ' );
39
+ $ resolver ->setAllowedTypes ('triggered_by ' , 'array ' );
38
40
39
41
return $ resolver ;
40
42
}
@@ -52,11 +54,8 @@ public function canRunInContext(ContextInterface $context)
52
54
*/
53
55
public function run (ContextInterface $ context )
54
56
{
55
- $ fileNames = array_map (function (\SplFileInfo $ file ) {
56
- return $ file ->getPathname ();
57
- }, iterator_to_array ($ context ->getFiles ()->extensions (array ('php ' ))));
58
-
59
57
$ config = $ this ->getConfiguration ();
58
+ $ files = $ context ->getFiles ()->extensions ($ config ['triggered_by ' ]);
60
59
61
60
$ args = $ this ->processBuilder ->createArgumentsForCommand ('parallel-lint ' );
62
61
$ args ->add ('--no-colors ' );
@@ -65,7 +64,9 @@ public function run(ContextInterface $context)
65
64
$ args ->add ($ config ['jobs ' ]);
66
65
}
67
66
$ args ->addArgumentArrayWithSeparatedValue ('--exclude ' , $ config ['exclude ' ]);
68
- $ args ->addArgumentArray ('%s ' , $ fileNames );
67
+ $ args ->add ('-e ' );
68
+ $ args ->addOptionalCommaSeparatedArgument ('%s ' , $ config ['triggered_by ' ]);
69
+ $ args ->addFiles ($ files );
69
70
70
71
$ process = $ this ->processBuilder ->buildProcess ($ args );
71
72
$ process ->run ();
0 commit comments