This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Component
Fabien Potencier ccb684a833 feature #19511 Use a dedicated exception in the file locator (leofeyer)
This PR was squashed before being merged into the 3.2-dev branch (closes #19511).

Discussion
----------

Use a dedicated exception in the file locator

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

This PR adds a dedicated `FileLocatorFileNotFoundException` class to the file locator, so it is possible to catch file locator exceptions separately from invalid argument exceptions.

```php
try {
    foreach ($container->get('file_locator')->locate('file.php', null, false) as $file) {
        include $file;
    }
} catch (\InvalidArgumentException $e) {
    // this will catch both file locator exceptions as well as
    // any invalid argument exception thrown in an included file
}
```

With the dedicated exceptions, we could do this:

```php
try {
    foreach ($container->get('file_locator')->locate('file.php', null, false) as $file) {
        include $file;
    }
} catch (FileLocatorFileNotFoundException $e) {
    // this will only ignore file locator exceptions
}
```

Commits
-------

ee4adaa Use a dedicated exception in the file locator
2016-08-09 07:23:21 -07:00
..
Asset Merge branch '3.1' 2016-07-01 18:08:10 +02:00
BrowserKit Merge branch '3.1' 2016-07-26 10:08:27 +02:00
Cache [Cache] Fix TagAwareAdapter::hasItem() 2016-08-07 18:24:25 +02:00
ClassLoader [ClassLoader] Add ClassCollectionLoader::inline() to generate inlined-classes files 2016-07-18 14:55:56 +02:00
Config Use a dedicated exception in the file locator 2016-08-09 07:23:16 -07:00
Console Merge branch '3.1' 2016-07-30 03:26:43 -04:00
CssSelector Merge branch '3.1' 2016-06-29 07:43:10 +02:00
Debug Merge branch '3.1' 2016-07-30 03:26:43 -04:00
DependencyInjection Merge branch '2.8' into 3.1 2016-08-05 10:37:39 +02:00
DomCrawler Merge branch '2.8' into 3.1 2016-08-05 10:37:39 +02:00
EventDispatcher Merge branch '2.7' into 2.8 2016-07-28 12:56:28 -04:00
ExpressionLanguage fixed CS 2016-06-21 08:43:40 +02:00
Filesystem [Filesystem] Add a cross-platform readlink/realpath methods for nested links 2016-07-29 17:37:06 +02:00
Finder Merge branch '2.7' into 2.8 2016-07-26 10:02:44 +02:00
Form Merge branch '2.7' into 2.8 2016-07-30 03:20:35 -04:00
HttpFoundation Merge branch '2.7' into 2.8 2016-07-30 03:20:35 -04:00
HttpKernel Merge branch '3.1' 2016-08-05 10:52:18 +02:00
Inflector Merge branch '3.1' 2016-06-14 13:18:32 +02:00
Intl Merge branch '2.8' into 3.1 2016-08-05 10:37:39 +02:00
Ldap Merge branch '3.1' 2016-07-28 13:15:50 +02:00
OptionsResolver Merge branch '2.7' into 2.8 2016-06-29 07:29:29 +02:00
Process Merge branch '3.1' 2016-08-07 17:19:41 +02:00
PropertyAccess Merge branch '2.8' into 3.1 2016-08-05 10:37:39 +02:00
PropertyInfo Merge branch '3.1' 2016-07-20 08:56:17 +03:00
Routing Merge branch '3.1' 2016-08-07 17:19:41 +02:00
Security Minor fixes 2016-07-30 03:17:26 -04:00
Serializer Merge branch '3.1' 2016-07-17 16:08:33 +02:00
Stopwatch Merge branch '3.1' 2016-06-29 07:43:10 +02:00
Templating Merge branch '2.8' into 3.1 2016-08-05 10:37:39 +02:00
Translation Merge branch '3.1' 2016-07-30 03:26:43 -04:00
Validator Merge branch '3.1' 2016-08-07 17:19:41 +02:00
VarDumper Merge branch '3.1' 2016-08-05 10:52:18 +02:00
Workflow fixed CS 2016-06-30 09:48:58 +02:00
Yaml feature #19529 Add Yaml::PARSE_EXCEPTION_ON_DUPLICATE to throw exceptions on duplicates (Alex Pott) 2016-08-09 06:44:53 -07:00