Skip to content

Commit 9403b5d

Browse files
Dave13hDan Cryer
authored and
Dan Cryer
committed
Contribution Type: feature
This pull request affects the following areas: Front-End Builder Build Plugins In raising this pull request, I confirm the following (please check boxes): I have read and understood the contributing guidelines? I have checked that another pull request for this purpose does not exist. I have considered, and confirmed that this submission will be valuable to others. I have created or updated the relevant documentation for this change on the PHPCI Wiki. Do the PHPCI tests pass? Detailed description of change: Add the option to pass the short tags (-s) argument to PHP Parallel Lint so that files using PHP Short Tags can be linted.
1 parent 4282688 commit 9403b5d

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

PHPCI/Plugin/PhpParallelLint.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,18 @@ class PhpParallelLint implements \PHPCI\Plugin
4646
*/
4747
protected $extensions;
4848

49+
/**
50+
* @var bool - enable short tags
51+
*/
52+
protected $shortTag;
53+
4954
/**
5055
* Standard Constructor
5156
*
5257
* $options['directory'] Output Directory. Default: %BUILDPATH%
5358
* $options['filename'] Phar Filename. Default: build.phar
5459
* $options['extensions'] Filename extensions. Default: php
60+
* $options['shorttags'] Enable short tags. Default: false
5561
* $options['stub'] Stub Content. No Default Value
5662
*
5763
* @param Builder $phpci
@@ -65,6 +71,7 @@ public function __construct(Builder $phpci, Build $build, array $options = array
6571
$this->directory = $phpci->buildPath;
6672
$this->ignore = $this->phpci->ignore;
6773
$this->extensions = 'php';
74+
$this->shortTag = false;
6875

6976
if (isset($options['directory'])) {
7077
$this->directory = $phpci->buildPath.$options['directory'];
@@ -74,6 +81,10 @@ public function __construct(Builder $phpci, Build $build, array $options = array
7481
$this->ignore = $options['ignore'];
7582
}
7683

84+
if (isset($options['shorttags'])) {
85+
$this->shortTag = (strtolower($options['shorttags']) == 'true');
86+
}
87+
7788
if (isset($options['extensions'])) {
7889
// Only use if this is a comma delimited list
7990
$pattern = '/^[a-z]*,\ *[a-z]*$/';
@@ -93,10 +104,11 @@ public function execute()
93104

94105
$phplint = $this->phpci->findBinary('parallel-lint');
95106

96-
$cmd = $phplint . ' -e %s' . ' %s "%s"';
107+
$cmd = $phplint . ' -e %s' . '%s %s "%s"';
97108
$success = $this->phpci->executeCommand(
98109
$cmd,
99110
$this->extensions,
111+
($this->shortTag ? ' -s' : ''),
100112
$ignore,
101113
$this->directory
102114
);

0 commit comments

Comments
 (0)