Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
Use a dedicated exception in the file locator#19511
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
| * | ||
| * @author Leo Feyer <https://github.com/leofeyer> | ||
| */ | ||
| class FileLocatorFileNotFoundException extends \InvalidArgumentException |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Why not simplyFileNotFoundException? The current name is verbose
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Because the other exception classes also use a prefix:https://github.com/symfony/symfony/tree/master/src/Symfony/Component/Config/Exception
Just wanted to keep things consistent.
dosten commentedAug 2, 2016
In some way this can be a BC break, while your example works fine, but what happens if someone do something like this: |
leofeyer commentedAug 2, 2016 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
You would normally check |
| /** | ||
| * @expectedException\InvalidArgumentException | ||
| * @expectedExceptionFileLocatorFileNotFoundException |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
phpunit doesn't handle use statements, should beSymfony\Component\Config\Exception\FileLocatorFileNotFoundException (same below)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I have updated the PR accordingly. However,use statements seem to work in phpunit under PHP 5.6 and PHP 7. Is this a known issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
PHP 7 requires a phpunit 5.* whereas phpunit 4.8 is the only option for PHP5.3 to 5.5.
Maybe phpunit 5.* handlesuse, but since we still support PHP 5.3, we can't use them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
That cannot be true. I am using PhpUnit 4.8 with PHP 7.0.
leofeyer:core-bundle$ vendor/bin/phpunit --versionPHPUnit 4.8.27 by Sebastian Bergmann and contributors.leofeyer:core-bundle$ php -vPHP 7.0.9 (cli) (built: Jul 21 2016 14:50:47) ( NTS )Copyright (c) 1997-2016 The PHP GroupZend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies with Zend OPcache v7.0.9, Copyright (c) 1999-2016, by Zend Technologies with blackfire v1.11.1, https://blackfire.io, by Blackfireio Inc.Jean85 commentedAug 5, 2016
Status: reviewed |
nicolas-grekas commentedAug 9, 2016
👍 |
fabpot commentedAug 9, 2016
Thank you@leofeyer. |
This PR adds a dedicated
FileLocatorFileNotFoundExceptionclass to the file locator, so it is possible to catch file locator exceptions separately from invalid argument exceptions.With the dedicated exceptions, we could do this: