[Config] Rename FileLoaderLoadException to LoaderLoadException
This commit is contained in:
parent
b6f17f4606
commit
24471a2780
|
@ -10,6 +10,7 @@ Config
|
||||||
------
|
------
|
||||||
|
|
||||||
* Deprecated constructing a `TreeBuilder` without passing root node information.
|
* Deprecated constructing a `TreeBuilder` without passing root node information.
|
||||||
|
* Deprecated `FileLoaderLoadException`, use `LoaderLoadException` instead.
|
||||||
|
|
||||||
Console
|
Console
|
||||||
-------
|
-------
|
||||||
|
|
|
@ -12,6 +12,7 @@ Config
|
||||||
* Dropped support for constructing a `TreeBuilder` without passing root node information.
|
* Dropped support for constructing a `TreeBuilder` without passing root node information.
|
||||||
* Added the `getChildNodeDefinitions()` method to `ParentNodeDefinitionInterface`.
|
* Added the `getChildNodeDefinitions()` method to `ParentNodeDefinitionInterface`.
|
||||||
* The `Processor` class has been made final
|
* The `Processor` class has been made final
|
||||||
|
* Removed `FileLoaderLoadException`, use `LoaderLoadException` instead.
|
||||||
|
|
||||||
Console
|
Console
|
||||||
-------
|
-------
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
namespace Symfony\Bundle\FrameworkBundle\Routing;
|
namespace Symfony\Bundle\FrameworkBundle\Routing;
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser;
|
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\DelegatingLoader as BaseDelegatingLoader;
|
||||||
use Symfony\Component\Config\Loader\LoaderResolverInterface;
|
use Symfony\Component\Config\Loader\LoaderResolverInterface;
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ class DelegatingLoader extends BaseDelegatingLoader
|
||||||
// - this handles the case and prevents the second fatal error
|
// - this handles the case and prevents the second fatal error
|
||||||
// by triggering an exception beforehand.
|
// by triggering an exception beforehand.
|
||||||
|
|
||||||
throw new FileLoaderLoadException($resource, null, null, null, $type);
|
throw new LoaderLoadException($resource, null, null, null, $type);
|
||||||
}
|
}
|
||||||
$this->loading = true;
|
$this->loading = true;
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ CHANGELOG
|
||||||
-----
|
-----
|
||||||
|
|
||||||
* deprecated constructing a `TreeBuilder` without passing root node information
|
* deprecated constructing a `TreeBuilder` without passing root node information
|
||||||
|
* renamed `FileLoaderLoadException` to `LoaderLoadException`
|
||||||
|
|
||||||
4.1.0
|
4.1.0
|
||||||
-----
|
-----
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace Symfony\Component\Config\Exception;
|
||||||
*
|
*
|
||||||
* @author Fabien Potencier <fabien@symfony.com>
|
* @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)
|
public function __construct(array $resources, int $code = null, \Exception $previous = null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,6 +15,8 @@ namespace Symfony\Component\Config\Exception;
|
||||||
* Exception class for when a resource cannot be loaded or imported.
|
* Exception class for when a resource cannot be loaded or imported.
|
||||||
*
|
*
|
||||||
* @author Ryan Weaver <ryan@thatsquality.com>
|
* @author Ryan Weaver <ryan@thatsquality.com>
|
||||||
|
*
|
||||||
|
* @deprecated since Symfony 4.2, use LoaderLoadException instead.
|
||||||
*/
|
*/
|
||||||
class FileLoaderLoadException extends \Exception
|
class FileLoaderLoadException extends \Exception
|
||||||
{
|
{
|
||||||
|
|
|
@ -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
|
||||||
|
{
|
||||||
|
}
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
namespace Symfony\Component\Config\Loader;
|
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.
|
* DelegatingLoader delegates loading to other loaders using a loader resolver.
|
||||||
|
@ -34,7 +34,7 @@ class DelegatingLoader extends Loader
|
||||||
public function load($resource, $type = null)
|
public function load($resource, $type = null)
|
||||||
{
|
{
|
||||||
if (false === $loader = $this->resolver->resolve($resource, $type)) {
|
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);
|
return $loader->load($resource, $type);
|
||||||
|
|
|
@ -12,8 +12,8 @@
|
||||||
namespace Symfony\Component\Config\Loader;
|
namespace Symfony\Component\Config\Loader;
|
||||||
|
|
||||||
use Symfony\Component\Config\Exception\FileLoaderImportCircularReferenceException;
|
use Symfony\Component\Config\Exception\FileLoaderImportCircularReferenceException;
|
||||||
use Symfony\Component\Config\Exception\FileLoaderLoadException;
|
|
||||||
use Symfony\Component\Config\Exception\FileLocatorFileNotFoundException;
|
use Symfony\Component\Config\Exception\FileLocatorFileNotFoundException;
|
||||||
|
use Symfony\Component\Config\Exception\LoaderLoadException;
|
||||||
use Symfony\Component\Config\FileLocatorInterface;
|
use Symfony\Component\Config\FileLocatorInterface;
|
||||||
use Symfony\Component\Config\Resource\FileExistenceResource;
|
use Symfony\Component\Config\Resource\FileExistenceResource;
|
||||||
use Symfony\Component\Config\Resource\GlobResource;
|
use Symfony\Component\Config\Resource\GlobResource;
|
||||||
|
@ -66,7 +66,7 @@ abstract class FileLoader extends Loader
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*
|
*
|
||||||
* @throws FileLoaderLoadException
|
* @throws LoaderLoadException
|
||||||
* @throws FileLoaderImportCircularReferenceException
|
* @throws FileLoaderImportCircularReferenceException
|
||||||
* @throws FileLocatorFileNotFoundException
|
* @throws FileLocatorFileNotFoundException
|
||||||
*/
|
*/
|
||||||
|
@ -161,11 +161,11 @@ abstract class FileLoader extends Loader
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
if (!$ignoreErrors) {
|
if (!$ignoreErrors) {
|
||||||
// prevent embedded imports from nesting multiple exceptions
|
// prevent embedded imports from nesting multiple exceptions
|
||||||
if ($e instanceof FileLoaderLoadException) {
|
if ($e instanceof LoaderLoadException) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new FileLoaderLoadException($resource, $sourceResource, null, $e, $type);
|
throw new LoaderLoadException($resource, $sourceResource, null, $e, $type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
namespace Symfony\Component\Config\Loader;
|
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.
|
* Loader is the abstract class used by all built-in loaders.
|
||||||
|
@ -59,7 +59,7 @@ abstract class Loader implements LoaderInterface
|
||||||
*
|
*
|
||||||
* @return $this|LoaderInterface
|
* @return $this|LoaderInterface
|
||||||
*
|
*
|
||||||
* @throws FileLoaderLoadException If no loader is found
|
* @throws LoaderLoadException If no loader is found
|
||||||
*/
|
*/
|
||||||
public function resolve($resource, $type = null)
|
public function resolve($resource, $type = null)
|
||||||
{
|
{
|
||||||
|
@ -70,7 +70,7 @@ abstract class Loader implements LoaderInterface
|
||||||
$loader = null === $this->resolver ? false : $this->resolver->resolve($resource, $type);
|
$loader = null === $this->resolver ? false : $this->resolver->resolve($resource, $type);
|
||||||
|
|
||||||
if (false === $loader) {
|
if (false === $loader) {
|
||||||
throw new FileLoaderLoadException($resource, null, null, null, $type);
|
throw new LoaderLoadException($resource, null, null, null, $type);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $loader;
|
return $loader;
|
||||||
|
|
|
@ -12,37 +12,37 @@
|
||||||
namespace Symfony\Component\Config\Tests\Exception;
|
namespace Symfony\Component\Config\Tests\Exception;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
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()
|
public function testMessageCannotLoadResource()
|
||||||
{
|
{
|
||||||
$exception = new FileLoaderLoadException('resource', null);
|
$exception = new LoaderLoadException('resource', null);
|
||||||
$this->assertEquals('Cannot load resource "resource".', $exception->getMessage());
|
$this->assertEquals('Cannot load resource "resource".', $exception->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testMessageCannotLoadResourceWithType()
|
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());
|
$this->assertEquals('Cannot load resource "resource". Make sure there is a loader supporting the "foobar" type.', $exception->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testMessageCannotLoadResourceWithAnnotationType()
|
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());
|
$this->assertEquals('Cannot load resource "resource". Make sure annotations are installed and enabled.', $exception->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testMessageCannotImportResourceFromSource()
|
public function testMessageCannotImportResourceFromSource()
|
||||||
{
|
{
|
||||||
$exception = new FileLoaderLoadException('resource', 'sourceResource');
|
$exception = new LoaderLoadException('resource', 'sourceResource');
|
||||||
$this->assertEquals('Cannot import resource "resource" from "sourceResource".', $exception->getMessage());
|
$this->assertEquals('Cannot import resource "resource" from "sourceResource".', $exception->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testMessageCannotImportBundleResource()
|
public function testMessageCannotImportBundleResource()
|
||||||
{
|
{
|
||||||
$exception = new FileLoaderLoadException('@resource', 'sourceResource');
|
$exception = new LoaderLoadException('@resource', 'sourceResource');
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
'Cannot import resource "@resource" from "sourceResource". '.
|
'Cannot import resource "@resource" from "sourceResource". '.
|
||||||
'Make sure the "resource" bundle is correctly registered and loaded in the application kernel class. '.
|
'Make sure the "resource" bundle is correctly registered and loaded in the application kernel class. '.
|
||||||
|
@ -53,7 +53,7 @@ class FileLoaderLoadExceptionTest extends TestCase
|
||||||
|
|
||||||
public function testMessageHasPreviousErrorWithDotAndUnableToLoad()
|
public function testMessageHasPreviousErrorWithDotAndUnableToLoad()
|
||||||
{
|
{
|
||||||
$exception = new FileLoaderLoadException(
|
$exception = new LoaderLoadException(
|
||||||
'resource',
|
'resource',
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
|
@ -67,7 +67,7 @@ class FileLoaderLoadExceptionTest extends TestCase
|
||||||
|
|
||||||
public function testMessageHasPreviousErrorWithoutDotAndUnableToLoad()
|
public function testMessageHasPreviousErrorWithoutDotAndUnableToLoad()
|
||||||
{
|
{
|
||||||
$exception = new FileLoaderLoadException(
|
$exception = new LoaderLoadException(
|
||||||
'resource',
|
'resource',
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
|
@ -81,7 +81,7 @@ class FileLoaderLoadExceptionTest extends TestCase
|
||||||
|
|
||||||
public function testMessageHasPreviousErrorAndUnableToLoadBundle()
|
public function testMessageHasPreviousErrorAndUnableToLoadBundle()
|
||||||
{
|
{
|
||||||
$exception = new FileLoaderLoadException(
|
$exception = new LoaderLoadException(
|
||||||
'@resource',
|
'@resource',
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
|
@ -57,7 +57,7 @@ class DelegatingLoaderTest extends TestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException \Symfony\Component\Config\Exception\FileLoaderLoadException
|
* @expectedException \Symfony\Component\Config\Exception\LoaderLoadException
|
||||||
*/
|
*/
|
||||||
public function testLoadThrowsAnExceptionIfTheResourceCannotBeLoaded()
|
public function testLoadThrowsAnExceptionIfTheResourceCannotBeLoaded()
|
||||||
{
|
{
|
||||||
|
|
|
@ -44,7 +44,7 @@ class LoaderTest extends TestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException \Symfony\Component\Config\Exception\FileLoaderLoadException
|
* @expectedException \Symfony\Component\Config\Exception\LoaderLoadException
|
||||||
*/
|
*/
|
||||||
public function testResolveWhenResolverCannotFindLoader()
|
public function testResolveWhenResolverCannotFindLoader()
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
namespace Symfony\Component\Routing;
|
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\Loader\LoaderInterface;
|
||||||
use Symfony\Component\Config\Resource\ResourceInterface;
|
use Symfony\Component\Config\Resource\ResourceInterface;
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ class RouteCollectionBuilder
|
||||||
*
|
*
|
||||||
* @return self
|
* @return self
|
||||||
*
|
*
|
||||||
* @throws FileLoaderLoadException
|
* @throws LoaderLoadException
|
||||||
*/
|
*/
|
||||||
public function import($resource, $prefix = '/', $type = null)
|
public function import($resource, $prefix = '/', $type = null)
|
||||||
{
|
{
|
||||||
|
@ -347,7 +347,7 @@ class RouteCollectionBuilder
|
||||||
*
|
*
|
||||||
* @return RouteCollection[]
|
* @return RouteCollection[]
|
||||||
*
|
*
|
||||||
* @throws FileLoaderLoadException If no loader is found
|
* @throws LoaderLoadException If no loader is found
|
||||||
*/
|
*/
|
||||||
private function load($resource, string $type = null): array
|
private function load($resource, string $type = null): array
|
||||||
{
|
{
|
||||||
|
@ -362,11 +362,11 @@ class RouteCollectionBuilder
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null === $resolver = $this->loader->getResolver()) {
|
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)) {
|
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);
|
$collections = $loader->load($resource, $type);
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
"php": "^7.1.3"
|
"php": "^7.1.3"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"symfony/config": "~3.4|~4.0",
|
"symfony/config": "~4.2",
|
||||||
"symfony/http-foundation": "~3.4|~4.0",
|
"symfony/http-foundation": "~3.4|~4.0",
|
||||||
"symfony/yaml": "~3.4|~4.0",
|
"symfony/yaml": "~3.4|~4.0",
|
||||||
"symfony/expression-language": "~3.4|~4.0",
|
"symfony/expression-language": "~3.4|~4.0",
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
"psr/log": "~1.0"
|
"psr/log": "~1.0"
|
||||||
},
|
},
|
||||||
"conflict": {
|
"conflict": {
|
||||||
"symfony/config": "<3.4",
|
"symfony/config": "<4.2",
|
||||||
"symfony/dependency-injection": "<3.4",
|
"symfony/dependency-injection": "<3.4",
|
||||||
"symfony/yaml": "<3.4"
|
"symfony/yaml": "<3.4"
|
||||||
},
|
},
|
||||||
|
|
Reference in New Issue