Skip to content

Commit 9ecc9d8

Browse files
committed
Added path check for phpcs executable
1 parent a0a7655 commit 9ecc9d8

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

bin/phpcs-diff

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
* @license https://github.com/olivertappin/phpcs-diff/blob/master/LICENCE.md MIT Licence
88
*/
99

10-
if (is_file(__DIR__ . '/../../../autoload.php') === true) {
10+
if (is_file(__DIR__ . '/../../../autoload.php')) {
1111
include_once __DIR__ . '/../../../autoload.php';
12-
} elseif (is_file(__DIR__ . '/../autoload.php') === true) {
12+
} elseif (is_file(__DIR__ . '/../autoload.php')) {
1313
include_once __DIR__ . '/../autoload.php';
1414
} else {
1515
include_once 'vendor/autoload.php';

src/PhpcsDiff.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,16 @@ public function run()
196196
*/
197197
protected function runPhpcs(array $files = [], $ruleset = 'ruleset.xml')
198198
{
199+
$exec = 'vendor/bin/phpcs';
200+
201+
if (is_file(__DIR__ . '/../../../bin/phpcs')) {
202+
$exec = __DIR__ . '/../../../bin/phpcs';
203+
} elseif (is_file(__DIR__ . '/../bin/phpcs')) {
204+
$exec = realpath(__DIR__ . '/../bin/phpcs');
205+
}
206+
199207
return json_decode(
200-
shell_exec('vendor/bin/phpcs --report=json --standard=' . $ruleset . ' ' . implode(' ', $files)),
208+
shell_exec($exec . ' --report=json --standard=' . $ruleset . ' ' . implode(' ', $files)),
201209
true
202210
);
203211
}

0 commit comments

Comments
 (0)