From a7755f866380a3159be74fd234386fa0b951d6cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Thu, 27 Dec 2018 19:08:15 +0100 Subject: [PATCH] Fix: Method can also return null --- .../Component/Process/ExecutableFinder.php | 2 +- .../Process/Tests/ExecutableFinderTest.php | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Process/ExecutableFinder.php b/src/Symfony/Component/Process/ExecutableFinder.php index ccfa4c09b0..ad2c76ab60 100644 --- a/src/Symfony/Component/Process/ExecutableFinder.php +++ b/src/Symfony/Component/Process/ExecutableFinder.php @@ -46,7 +46,7 @@ class ExecutableFinder * @param string $default The default to return if no executable is found * @param array $extraDirs Additional dirs to check into * - * @return string The executable path or default value + * @return string|null The executable path or default value */ public function find($name, $default = null, array $extraDirs = array()) { diff --git a/src/Symfony/Component/Process/Tests/ExecutableFinderTest.php b/src/Symfony/Component/Process/Tests/ExecutableFinderTest.php index ee25eda02b..7959b5dc5e 100644 --- a/src/Symfony/Component/Process/Tests/ExecutableFinderTest.php +++ b/src/Symfony/Component/Process/Tests/ExecutableFinderTest.php @@ -65,6 +65,21 @@ class ExecutableFinderTest extends TestCase $this->assertEquals($expected, $result); } + public function testFindWithNullAsDefault() + { + if (ini_get('open_basedir')) { + $this->markTestSkipped('Cannot test when open_basedir is set'); + } + + $this->setPath(''); + + $finder = new ExecutableFinder(); + + $result = $finder->find('foo'); + + $this->assertNull($result); + } + public function testFindWithExtraDirs() { if (ini_get('open_basedir')) {