Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP Lint: allow short open tags #602

Merged
merged 3 commits into from
Feb 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions doc/tasks/phplint.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ parameters:
phplint:
exclude: []
jobs: ~
short_open_tag: false
ignore_patterns: []
triggered_by: ['php', 'phtml', 'php3', 'php4', 'php5']
```
Expand All @@ -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: []*
Expand Down
1 change: 1 addition & 0 deletions spec/Task/PhpLintSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
3 changes: 3 additions & 0 deletions src/Task/PhpLint.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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');

Expand Down