Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 83a9ca6

Browse files
feature #28027 [Config] Rename FileLoaderLoadException to LoaderLoadException (ProgMiner)
This PR was merged into the 4.2-dev branch. Discussion ---------- [Config] Rename FileLoaderLoadException to LoaderLoadException | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | #27895 | License | MIT | Doc PR | - Renamed `FileLoaderLoadException` to `LoaderLoadException`. Commits ------- 24471a2 [Config] Rename FileLoaderLoadException to LoaderLoadException
2 parents 550b8b8 + 24471a2 commit 83a9ca6

15 files changed

+57
-31
lines changed

UPGRADE-4.2.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Config
1010
------
1111

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

1415
Console
1516
-------

UPGRADE-5.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Config
1212
* Dropped support for constructing a `TreeBuilder` without passing root node information.
1313
* Added the `getChildNodeDefinitions()` method to `ParentNodeDefinitionInterface`.
1414
* The `Processor` class has been made final
15+
* Removed `FileLoaderLoadException`, use `LoaderLoadException` instead.
1516

1617
Console
1718
-------

src/Symfony/Bundle/FrameworkBundle/Routing/DelegatingLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
namespace Symfony\Bundle\FrameworkBundle\Routing;
1313

1414
use Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser;
15-
use Symfony\Component\Config\Exception\FileLoaderLoadException;
15+
use Symfony\Component\Config\Exception\LoaderLoadException;
1616
use Symfony\Component\Config\Loader\DelegatingLoader as BaseDelegatingLoader;
1717
use Symfony\Component\Config\Loader\LoaderResolverInterface;
1818

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

67-
throw new FileLoaderLoadException($resource, null, null, null, $type);
67+
throw new LoaderLoadException($resource, null, null, null, $type);
6868
}
6969
$this->loading = true;
7070

src/Symfony/Component/Config/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ CHANGELOG
55
-----
66

77
* deprecated constructing a `TreeBuilder` without passing root node information
8+
* renamed `FileLoaderLoadException` to `LoaderLoadException`
89

910
4.1.0
1011
-----

src/Symfony/Component/Config/Exception/FileLoaderImportCircularReferenceException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* @author Fabien Potencier <[email protected]>
1818
*/
19-
class FileLoaderImportCircularReferenceException extends FileLoaderLoadException
19+
class FileLoaderImportCircularReferenceException extends LoaderLoadException
2020
{
2121
public function __construct(array $resources, int $code = null, \Exception $previous = null)
2222
{

src/Symfony/Component/Config/Exception/FileLoaderLoadException.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
* Exception class for when a resource cannot be loaded or imported.
1616
*
1717
* @author Ryan Weaver <[email protected]>
18+
*
19+
* @deprecated since Symfony 4.2, use LoaderLoadException instead.
1820
*/
1921
class FileLoaderLoadException extends \Exception
2022
{
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Config\Exception;
13+
14+
/**
15+
* Exception class for when a resource cannot be loaded or imported.
16+
*
17+
* @author Ryan Weaver <[email protected]>
18+
*/
19+
class LoaderLoadException extends FileLoaderLoadException
20+
{
21+
}

src/Symfony/Component/Config/Loader/DelegatingLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Symfony\Component\Config\Loader;
1313

14-
use Symfony\Component\Config\Exception\FileLoaderLoadException;
14+
use Symfony\Component\Config\Exception\LoaderLoadException;
1515

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

4040
return $loader->load($resource, $type);

src/Symfony/Component/Config/Loader/FileLoader.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
namespace Symfony\Component\Config\Loader;
1313

1414
use Symfony\Component\Config\Exception\FileLoaderImportCircularReferenceException;
15-
use Symfony\Component\Config\Exception\FileLoaderLoadException;
1615
use Symfony\Component\Config\Exception\FileLocatorFileNotFoundException;
16+
use Symfony\Component\Config\Exception\LoaderLoadException;
1717
use Symfony\Component\Config\FileLocatorInterface;
1818
use Symfony\Component\Config\Resource\FileExistenceResource;
1919
use Symfony\Component\Config\Resource\GlobResource;
@@ -66,7 +66,7 @@ public function getLocator()
6666
*
6767
* @return mixed
6868
*
69-
* @throws FileLoaderLoadException
69+
* @throws LoaderLoadException
7070
* @throws FileLoaderImportCircularReferenceException
7171
* @throws FileLocatorFileNotFoundException
7272
*/
@@ -161,11 +161,11 @@ private function doImport($resource, $type = null, bool $ignoreErrors = false, $
161161
} catch (\Exception $e) {
162162
if (!$ignoreErrors) {
163163
// prevent embedded imports from nesting multiple exceptions
164-
if ($e instanceof FileLoaderLoadException) {
164+
if ($e instanceof LoaderLoadException) {
165165
throw $e;
166166
}
167167

168-
throw new FileLoaderLoadException($resource, $sourceResource, null, $e, $type);
168+
throw new LoaderLoadException($resource, $sourceResource, null, $e, $type);
169169
}
170170
}
171171
}

src/Symfony/Component/Config/Loader/Loader.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Symfony\Component\Config\Loader;
1313

14-
use Symfony\Component\Config\Exception\FileLoaderLoadException;
14+
use Symfony\Component\Config\Exception\LoaderLoadException;
1515

1616
/**
1717
* Loader is the abstract class used by all built-in loaders.
@@ -59,7 +59,7 @@ public function import($resource, $type = null)
5959
*
6060
* @return $this|LoaderInterface
6161
*
62-
* @throws FileLoaderLoadException If no loader is found
62+
* @throws LoaderLoadException If no loader is found
6363
*/
6464
public function resolve($resource, $type = null)
6565
{
@@ -70,7 +70,7 @@ public function resolve($resource, $type = null)
7070
$loader = null === $this->resolver ? false : $this->resolver->resolve($resource, $type);
7171

7272
if (false === $loader) {
73-
throw new FileLoaderLoadException($resource, null, null, null, $type);
73+
throw new LoaderLoadException($resource, null, null, null, $type);
7474
}
7575

7676
return $loader;

src/Symfony/Component/Config/Tests/Exception/FileLoaderLoadExceptionTest.php renamed to src/Symfony/Component/Config/Tests/Exception/LoaderLoadExceptionTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,37 +12,37 @@
1212
namespace Symfony\Component\Config\Tests\Exception;
1313

1414
use PHPUnit\Framework\TestCase;
15-
use Symfony\Component\Config\Exception\FileLoaderLoadException;
15+
use Symfony\Component\Config\Exception\LoaderLoadException;
1616

17-
class FileLoaderLoadExceptionTest extends TestCase
17+
class LoaderLoadExceptionTest extends TestCase
1818
{
1919
public function testMessageCannotLoadResource()
2020
{
21-
$exception = new FileLoaderLoadException('resource', null);
21+
$exception = new LoaderLoadException('resource', null);
2222
$this->assertEquals('Cannot load resource "resource".', $exception->getMessage());
2323
}
2424

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

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

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

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

5454
public function testMessageHasPreviousErrorWithDotAndUnableToLoad()
5555
{
56-
$exception = new FileLoaderLoadException(
56+
$exception = new LoaderLoadException(
5757
'resource',
5858
null,
5959
null,
@@ -67,7 +67,7 @@ public function testMessageHasPreviousErrorWithDotAndUnableToLoad()
6767

6868
public function testMessageHasPreviousErrorWithoutDotAndUnableToLoad()
6969
{
70-
$exception = new FileLoaderLoadException(
70+
$exception = new LoaderLoadException(
7171
'resource',
7272
null,
7373
null,
@@ -81,7 +81,7 @@ public function testMessageHasPreviousErrorWithoutDotAndUnableToLoad()
8181

8282
public function testMessageHasPreviousErrorAndUnableToLoadBundle()
8383
{
84-
$exception = new FileLoaderLoadException(
84+
$exception = new LoaderLoadException(
8585
'@resource',
8686
null,
8787
null,

src/Symfony/Component/Config/Tests/Loader/DelegatingLoaderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function testLoad()
5757
}
5858

5959
/**
60-
* @expectedException \Symfony\Component\Config\Exception\FileLoaderLoadException
60+
* @expectedException \Symfony\Component\Config\Exception\LoaderLoadException
6161
*/
6262
public function testLoadThrowsAnExceptionIfTheResourceCannotBeLoaded()
6363
{

src/Symfony/Component/Config/Tests/Loader/LoaderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function testResolve()
4444
}
4545

4646
/**
47-
* @expectedException \Symfony\Component\Config\Exception\FileLoaderLoadException
47+
* @expectedException \Symfony\Component\Config\Exception\LoaderLoadException
4848
*/
4949
public function testResolveWhenResolverCannotFindLoader()
5050
{

src/Symfony/Component/Routing/RouteCollectionBuilder.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Symfony\Component\Routing;
1313

14-
use Symfony\Component\Config\Exception\FileLoaderLoadException;
14+
use Symfony\Component\Config\Exception\LoaderLoadException;
1515
use Symfony\Component\Config\Loader\LoaderInterface;
1616
use Symfony\Component\Config\Resource\ResourceInterface;
1717

@@ -54,7 +54,7 @@ public function __construct(LoaderInterface $loader = null)
5454
*
5555
* @return self
5656
*
57-
* @throws FileLoaderLoadException
57+
* @throws LoaderLoadException
5858
*/
5959
public function import($resource, $prefix = '/', $type = null)
6060
{
@@ -347,7 +347,7 @@ private function generateRouteName(Route $route): string
347347
*
348348
* @return RouteCollection[]
349349
*
350-
* @throws FileLoaderLoadException If no loader is found
350+
* @throws LoaderLoadException If no loader is found
351351
*/
352352
private function load($resource, string $type = null): array
353353
{
@@ -362,11 +362,11 @@ private function load($resource, string $type = null): array
362362
}
363363

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

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

372372
$collections = $loader->load($resource, $type);

src/Symfony/Component/Routing/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"php": "^7.1.3"
2020
},
2121
"require-dev": {
22-
"symfony/config": "~3.4|~4.0",
22+
"symfony/config": "~4.2",
2323
"symfony/http-foundation": "~3.4|~4.0",
2424
"symfony/yaml": "~3.4|~4.0",
2525
"symfony/expression-language": "~3.4|~4.0",
@@ -28,7 +28,7 @@
2828
"psr/log": "~1.0"
2929
},
3030
"conflict": {
31-
"symfony/config": "<3.4",
31+
"symfony/config": "<4.2",
3232
"symfony/dependency-injection": "<3.4",
3333
"symfony/yaml": "<3.4"
3434
},

0 commit comments

Comments
 (0)