diff --git a/doc/tasks/phplint.md b/doc/tasks/phplint.md index 8512c2cb1..0d6be1b9d 100644 --- a/doc/tasks/phplint.md +++ b/doc/tasks/phplint.md @@ -17,6 +17,7 @@ parameters: phplint: exclude: [] jobs: ~ + short_open_tag: false ignore_patterns: [] triggered_by: ['php', 'phtml', 'php3', 'php4', 'php5'] ``` @@ -35,6 +36,12 @@ The number of jobs you wish to use for parallel processing. If no number is given, it is left up to parallel-lint itself, which currently defaults to 10. +**short_open_tag** + +*Default: false* + +This option can allow PHP short open tags. + **ignore_patterns** *Default: []* diff --git a/spec/Task/PhpLintSpec.php b/spec/Task/PhpLintSpec.php index 1dbccdfb9..ebf9fd739 100644 --- a/spec/Task/PhpLintSpec.php +++ b/spec/Task/PhpLintSpec.php @@ -42,6 +42,7 @@ function it_should_have_configurable_options() $options = $this->getConfigurableOptions(); $options->shouldBeAnInstanceOf(OptionsResolver::class); $options->getDefinedOptions()->shouldContain('jobs'); + $options->getDefinedOptions()->shouldContain('short_open_tag'); $options->getDefinedOptions()->shouldContain('exclude'); $options->getDefinedOptions()->shouldContain('ignore_patterns'); $options->getDefinedOptions()->shouldContain('triggered_by'); diff --git a/src/Task/PhpLint.php b/src/Task/PhpLint.php index 425418772..99f587a4b 100644 --- a/src/Task/PhpLint.php +++ b/src/Task/PhpLint.php @@ -24,12 +24,14 @@ public function getConfigurableOptions(): OptionsResolver $resolver = new OptionsResolver(); $resolver->setDefaults([ 'jobs' => null, + 'short_open_tag' => false, 'exclude' => [], 'ignore_patterns' => [], 'triggered_by' => ['php', 'phtml', 'php3', 'php4', 'php5'], ]); $resolver->setAllowedTypes('jobs', ['int', 'null']); + $resolver->setAllowedTypes('short_open_tag', 'bool'); $resolver->setAllowedTypes('exclude', 'array'); $resolver->addAllowedTypes('ignore_patterns', ['array']); $resolver->setAllowedTypes('triggered_by', 'array'); @@ -54,6 +56,7 @@ public function run(ContextInterface $context): TaskResultInterface $arguments = $this->processBuilder->createArgumentsForCommand('parallel-lint'); $arguments->add('--no-colors'); $arguments->addOptionalArgumentWithSeparatedValue('-j', $config['jobs']); + $arguments->addOptionalArgument('--short', $config['short_open_tag']); $arguments->addArgumentArrayWithSeparatedValue('--exclude', $config['exclude']); $arguments->add('--stdin');