Skip to content

[Config] Rename FileLoaderLoadException to LoaderLoadException #28027

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions UPGRADE-4.2.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Config
------

* Deprecated constructing a `TreeBuilder` without passing root node information.
* Deprecated `FileLoaderLoadException`, use `LoaderLoadException` instead.

Console
-------
Expand Down
1 change: 1 addition & 0 deletions UPGRADE-5.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Config
* Dropped support for constructing a `TreeBuilder` without passing root node information.
* Added the `getChildNodeDefinitions()` method to `ParentNodeDefinitionInterface`.
* The `Processor` class has been made final
* Removed `FileLoaderLoadException`, use `LoaderLoadException` instead.

Console
-------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
namespace Symfony\Bundle\FrameworkBundle\Routing;

use Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser;
use Symfony\Component\Config\Exception\FileLoaderLoadException;
use Symfony\Component\Config\Exception\LoaderLoadException;
use Symfony\Component\Config\Loader\DelegatingLoader as BaseDelegatingLoader;
use Symfony\Component\Config\Loader\LoaderResolverInterface;

Expand Down Expand Up @@ -64,7 +64,7 @@ public function load($resource, $type = null)
// - this handles the case and prevents the second fatal error
// by triggering an exception beforehand.

throw new FileLoaderLoadException($resource, null, null, null, $type);
throw new LoaderLoadException($resource, null, null, null, $type);
}
$this->loading = true;

Expand Down
1 change: 1 addition & 0 deletions src/Symfony/Component/Config/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ CHANGELOG
-----

* deprecated constructing a `TreeBuilder` without passing root node information
* renamed `FileLoaderLoadException` to `LoaderLoadException`

4.1.0
-----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class FileLoaderImportCircularReferenceException extends FileLoaderLoadException
class FileLoaderImportCircularReferenceException extends LoaderLoadException
{
public function __construct(array $resources, int $code = null, \Exception $previous = null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
* Exception class for when a resource cannot be loaded or imported.
*
* @author Ryan Weaver <ryan@thatsquality.com>
*
* @deprecated since Symfony 4.2, use LoaderLoadException instead.
*/
class FileLoaderLoadException extends \Exception
{
Expand Down
21 changes: 21 additions & 0 deletions src/Symfony/Component/Config/Exception/LoaderLoadException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Component\Config\Exception;

/**
* Exception class for when a resource cannot be loaded or imported.
*
* @author Ryan Weaver <ryan@thatsquality.com>
*/
class LoaderLoadException extends FileLoaderLoadException
{
}
4 changes: 2 additions & 2 deletions src/Symfony/Component/Config/Loader/DelegatingLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace Symfony\Component\Config\Loader;

use Symfony\Component\Config\Exception\FileLoaderLoadException;
use Symfony\Component\Config\Exception\LoaderLoadException;

/**
* DelegatingLoader delegates loading to other loaders using a loader resolver.
Expand All @@ -34,7 +34,7 @@ public function __construct(LoaderResolverInterface $resolver)
public function load($resource, $type = null)
{
if (false === $loader = $this->resolver->resolve($resource, $type)) {
throw new FileLoaderLoadException($resource, null, null, null, $type);
throw new LoaderLoadException($resource, null, null, null, $type);
}

return $loader->load($resource, $type);
Expand Down
8 changes: 4 additions & 4 deletions src/Symfony/Component/Config/Loader/FileLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
namespace Symfony\Component\Config\Loader;

use Symfony\Component\Config\Exception\FileLoaderImportCircularReferenceException;
use Symfony\Component\Config\Exception\FileLoaderLoadException;
use Symfony\Component\Config\Exception\FileLocatorFileNotFoundException;
use Symfony\Component\Config\Exception\LoaderLoadException;
use Symfony\Component\Config\FileLocatorInterface;
use Symfony\Component\Config\Resource\FileExistenceResource;
use Symfony\Component\Config\Resource\GlobResource;
Expand Down Expand Up @@ -66,7 +66,7 @@ public function getLocator()
*
* @return mixed
*
* @throws FileLoaderLoadException
* @throws LoaderLoadException
* @throws FileLoaderImportCircularReferenceException
* @throws FileLocatorFileNotFoundException
*/
Expand Down Expand Up @@ -161,11 +161,11 @@ private function doImport($resource, $type = null, bool $ignoreErrors = false, $
} catch (\Exception $e) {
if (!$ignoreErrors) {
// prevent embedded imports from nesting multiple exceptions
if ($e instanceof FileLoaderLoadException) {
if ($e instanceof LoaderLoadException) {
throw $e;
}

throw new FileLoaderLoadException($resource, $sourceResource, null, $e, $type);
throw new LoaderLoadException($resource, $sourceResource, null, $e, $type);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/Symfony/Component/Config/Loader/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace Symfony\Component\Config\Loader;

use Symfony\Component\Config\Exception\FileLoaderLoadException;
use Symfony\Component\Config\Exception\LoaderLoadException;

/**
* Loader is the abstract class used by all built-in loaders.
Expand Down Expand Up @@ -59,7 +59,7 @@ public function import($resource, $type = null)
*
* @return $this|LoaderInterface
*
* @throws FileLoaderLoadException If no loader is found
* @throws LoaderLoadException If no loader is found
*/
public function resolve($resource, $type = null)
{
Expand All @@ -70,7 +70,7 @@ public function resolve($resource, $type = null)
$loader = null === $this->resolver ? false : $this->resolver->resolve($resource, $type);

if (false === $loader) {
throw new FileLoaderLoadException($resource, null, null, null, $type);
throw new LoaderLoadException($resource, null, null, null, $type);
}

return $loader;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,37 @@
namespace Symfony\Component\Config\Tests\Exception;

use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Exception\FileLoaderLoadException;
use Symfony\Component\Config\Exception\LoaderLoadException;

class FileLoaderLoadExceptionTest extends TestCase
class LoaderLoadExceptionTest extends TestCase
{
public function testMessageCannotLoadResource()
{
$exception = new FileLoaderLoadException('resource', null);
$exception = new LoaderLoadException('resource', null);
$this->assertEquals('Cannot load resource "resource".', $exception->getMessage());
}

public function testMessageCannotLoadResourceWithType()
{
$exception = new FileLoaderLoadException('resource', null, null, null, 'foobar');
$exception = new LoaderLoadException('resource', null, null, null, 'foobar');
$this->assertEquals('Cannot load resource "resource". Make sure there is a loader supporting the "foobar" type.', $exception->getMessage());
}

public function testMessageCannotLoadResourceWithAnnotationType()
{
$exception = new FileLoaderLoadException('resource', null, null, null, 'annotation');
$exception = new LoaderLoadException('resource', null, null, null, 'annotation');
$this->assertEquals('Cannot load resource "resource". Make sure annotations are installed and enabled.', $exception->getMessage());
}

public function testMessageCannotImportResourceFromSource()
{
$exception = new FileLoaderLoadException('resource', 'sourceResource');
$exception = new LoaderLoadException('resource', 'sourceResource');
$this->assertEquals('Cannot import resource "resource" from "sourceResource".', $exception->getMessage());
}

public function testMessageCannotImportBundleResource()
{
$exception = new FileLoaderLoadException('@resource', 'sourceResource');
$exception = new LoaderLoadException('@resource', 'sourceResource');
$this->assertEquals(
'Cannot import resource "@resource" from "sourceResource". '.
'Make sure the "resource" bundle is correctly registered and loaded in the application kernel class. '.
Expand All @@ -53,7 +53,7 @@ public function testMessageCannotImportBundleResource()

public function testMessageHasPreviousErrorWithDotAndUnableToLoad()
{
$exception = new FileLoaderLoadException(
$exception = new LoaderLoadException(
'resource',
null,
null,
Expand All @@ -67,7 +67,7 @@ public function testMessageHasPreviousErrorWithDotAndUnableToLoad()

public function testMessageHasPreviousErrorWithoutDotAndUnableToLoad()
{
$exception = new FileLoaderLoadException(
$exception = new LoaderLoadException(
'resource',
null,
null,
Expand All @@ -81,7 +81,7 @@ public function testMessageHasPreviousErrorWithoutDotAndUnableToLoad()

public function testMessageHasPreviousErrorAndUnableToLoadBundle()
{
$exception = new FileLoaderLoadException(
$exception = new LoaderLoadException(
'@resource',
null,
null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function testLoad()
}

/**
* @expectedException \Symfony\Component\Config\Exception\FileLoaderLoadException
* @expectedException \Symfony\Component\Config\Exception\LoaderLoadException
*/
public function testLoadThrowsAnExceptionIfTheResourceCannotBeLoaded()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Config/Tests/Loader/LoaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function testResolve()
}

/**
* @expectedException \Symfony\Component\Config\Exception\FileLoaderLoadException
* @expectedException \Symfony\Component\Config\Exception\LoaderLoadException
*/
public function testResolveWhenResolverCannotFindLoader()
{
Expand Down
10 changes: 5 additions & 5 deletions src/Symfony/Component/Routing/RouteCollectionBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace Symfony\Component\Routing;

use Symfony\Component\Config\Exception\FileLoaderLoadException;
use Symfony\Component\Config\Exception\LoaderLoadException;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\Config\Resource\ResourceInterface;

Expand Down Expand Up @@ -54,7 +54,7 @@ public function __construct(LoaderInterface $loader = null)
*
* @return self
*
* @throws FileLoaderLoadException
* @throws LoaderLoadException
*/
public function import($resource, $prefix = '/', $type = null)
{
Expand Down Expand Up @@ -347,7 +347,7 @@ private function generateRouteName(Route $route): string
*
* @return RouteCollection[]
*
* @throws FileLoaderLoadException If no loader is found
* @throws LoaderLoadException If no loader is found
*/
private function load($resource, string $type = null): array
{
Expand All @@ -362,11 +362,11 @@ private function load($resource, string $type = null): array
}

if (null === $resolver = $this->loader->getResolver()) {
throw new FileLoaderLoadException($resource, null, null, null, $type);
throw new LoaderLoadException($resource, null, null, null, $type);
}

if (false === $loader = $resolver->resolve($resource, $type)) {
throw new FileLoaderLoadException($resource, null, null, null, $type);
throw new LoaderLoadException($resource, null, null, null, $type);
}

$collections = $loader->load($resource, $type);
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Routing/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"php": "^7.1.3"
},
"require-dev": {
"symfony/config": "~3.4|~4.0",
"symfony/config": "~4.2",
"symfony/http-foundation": "~3.4|~4.0",
"symfony/yaml": "~3.4|~4.0",
"symfony/expression-language": "~3.4|~4.0",
Expand All @@ -28,7 +28,7 @@
"psr/log": "~1.0"
},
"conflict": {
"symfony/config": "<3.4",
"symfony/config": "<4.2",
"symfony/dependency-injection": "<3.4",
"symfony/yaml": "<3.4"
},
Expand Down