Skip to content

Commit 2151dda

Browse files
Fixed 'null' comparison and missed 'self::isExecutable' calls
1 parent 90734d7 commit 2151dda

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/Util/Cli.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,18 @@ public static function detectCmdLocation($cmd, $path = null, $optionalLocations
6767
// explicit path given, so check it out
6868
if (null !== $path) {
6969
$command = $path . DIRECTORY_SEPARATOR . $cmd;
70-
if (!is_executable($command)) {
70+
$bin = self::isExecutable($command);
71+
if (null === $bin) {
7172
throw new RuntimeException(sprintf('wrong path specified for \'%s\': %s', $cmd, $path));
7273
}
73-
return $command;
74+
return $bin;
7475
}
7576

7677
// on nx systems use 'which' command.
7778
if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
7879
$command = `which $cmd`;
7980
$bin = self::isExecutable($command);
80-
if ($bin) {
81+
if (null !== $bin) {
8182
return $bin;
8283
}
8384
}
@@ -87,7 +88,7 @@ public static function detectCmdLocation($cmd, $path = null, $optionalLocations
8788
foreach ($pathList as $path) {
8889
$command = $path . DIRECTORY_SEPARATOR . $cmd;
8990
$bin = self::isExecutable($command);
90-
if ($bin) {
91+
if (null !== $bin) {
9192
return $bin;
9293
}
9394
}
@@ -96,7 +97,7 @@ public static function detectCmdLocation($cmd, $path = null, $optionalLocations
9697
foreach ($optionalLocations as $path) {
9798
$command = $path . DIRECTORY_SEPARATOR . $cmd;
9899
$bin = self::isExecutable($command);
99-
if ($bin) {
100+
if (null !== $bin) {
100101
return $bin;
101102
}
102103
}

0 commit comments

Comments
 (0)