diff --git a/src/Symfony/Component/Finder/Exception/DirectoryNotFoundException.php b/src/Symfony/Component/Finder/Exception/DirectoryNotFoundException.php new file mode 100644 index 0000000000000..c6cc0f2736370 --- /dev/null +++ b/src/Symfony/Component/Finder/Exception/DirectoryNotFoundException.php @@ -0,0 +1,19 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Exception; + +/** + * @author Andreas Erhard + */ +class DirectoryNotFoundException extends \InvalidArgumentException +{ +} diff --git a/src/Symfony/Component/Finder/Finder.php b/src/Symfony/Component/Finder/Finder.php index f791f8cf32a8f..33b1805979469 100644 --- a/src/Symfony/Component/Finder/Finder.php +++ b/src/Symfony/Component/Finder/Finder.php @@ -13,6 +13,7 @@ use Symfony\Component\Finder\Comparator\DateComparator; use Symfony\Component\Finder\Comparator\NumberComparator; +use Symfony\Component\Finder\Exception\DirectoryNotFoundException; use Symfony\Component\Finder\Iterator\CustomFilterIterator; use Symfony\Component\Finder\Iterator\DateRangeFilterIterator; use Symfony\Component\Finder\Iterator\DepthRangeFilterIterator; @@ -585,7 +586,7 @@ public function ignoreUnreadableDirs($ignore = true) * * @return $this * - * @throws \InvalidArgumentException if one of the directories does not exist + * @throws DirectoryNotFoundException if one of the directories does not exist */ public function in($dirs) { @@ -597,7 +598,7 @@ public function in($dirs) } elseif ($glob = glob($dir, (\defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) { $resolvedDirs = array_merge($resolvedDirs, array_map([$this, 'normalizeDir'], $glob)); } else { - throw new \InvalidArgumentException(sprintf('The "%s" directory does not exist.', $dir)); + throw new DirectoryNotFoundException(sprintf('The "%s" directory does not exist.', $dir)); } } diff --git a/src/Symfony/Component/Finder/Tests/FinderTest.php b/src/Symfony/Component/Finder/Tests/FinderTest.php index 6b9a4b00c6d68..2e4e55b3b5d86 100644 --- a/src/Symfony/Component/Finder/Tests/FinderTest.php +++ b/src/Symfony/Component/Finder/Tests/FinderTest.php @@ -888,7 +888,7 @@ public function testIn() } /** - * @expectedException \InvalidArgumentException + * @expectedException \Symfony\Component\Finder\Exception\DirectoryNotFoundException */ public function testInWithNonExistentDirectory() { @@ -896,6 +896,15 @@ public function testInWithNonExistentDirectory() $finder->in('foobar'); } + /** + * @expectedException \InvalidArgumentException + */ + public function testInWithNonExistentDirectoryLegacyException() + { + $finder = new Finder(); + $finder->in('foobar'); + } + public function testInWithGlob() { $finder = $this->buildFinder(); pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy