Skip to content

Commit d8aebeb

Browse files
committed
[Config] finish adding parameter types
1 parent c58488f commit d8aebeb

11 files changed

+20
-20
lines changed

Loader/AnnotationClassLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function setRouteAnnotationClass($class)
9494
*
9595
* @throws \InvalidArgumentException When route can't be parsed
9696
*/
97-
public function load($class, $type = null)
97+
public function load($class, string $type = null)
9898
{
9999
if (!class_exists($class)) {
100100
throw new \InvalidArgumentException(sprintf('Class "%s" does not exist.', $class));

Loader/AnnotationDirectoryLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class AnnotationDirectoryLoader extends AnnotationFileLoader
3232
*
3333
* @throws \InvalidArgumentException When the directory does not exist or its routes cannot be parsed
3434
*/
35-
public function load($path, $type = null)
35+
public function load($path, string $type = null)
3636
{
3737
if (!is_dir($dir = $this->locator->locate($path))) {
3838
return parent::supports($path, $type) ? parent::load($path, $type) : new RouteCollection();
@@ -74,7 +74,7 @@ function (\SplFileInfo $current) {
7474
/**
7575
* {@inheritdoc}
7676
*/
77-
public function supports($resource, $type = null)
77+
public function supports($resource, string $type = null)
7878
{
7979
if ('annotation' === $type) {
8080
return true;

Loader/AnnotationFileLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function __construct(FileLocatorInterface $locator, AnnotationClassLoader
5050
*
5151
* @throws \InvalidArgumentException When the file does not exist or its routes cannot be parsed
5252
*/
53-
public function load($file, $type = null)
53+
public function load($file, string $type = null)
5454
{
5555
$path = $this->locator->locate($file);
5656

@@ -73,7 +73,7 @@ public function load($file, $type = null)
7373
/**
7474
* {@inheritdoc}
7575
*/
76-
public function supports($resource, $type = null)
76+
public function supports($resource, string $type = null)
7777
{
7878
return \is_string($resource) && 'php' === pathinfo($resource, PATHINFO_EXTENSION) && (!$type || 'annotation' === $type);
7979
}

Loader/ClosureLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ class ClosureLoader extends Loader
3131
*
3232
* @return RouteCollection A RouteCollection instance
3333
*/
34-
public function load($closure, $type = null)
34+
public function load($closure, string $type = null)
3535
{
3636
return $closure();
3737
}
3838

3939
/**
4040
* {@inheritdoc}
4141
*/
42-
public function supports($resource, $type = null)
42+
public function supports($resource, string $type = null)
4343
{
4444
return $resource instanceof \Closure && (!$type || 'closure' === $type);
4545
}

Loader/DirectoryLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class DirectoryLoader extends FileLoader
2020
/**
2121
* {@inheritdoc}
2222
*/
23-
public function load($file, $type = null)
23+
public function load($file, string $type = null)
2424
{
2525
$path = $this->locator->locate($file);
2626

@@ -49,7 +49,7 @@ public function load($file, $type = null)
4949
/**
5050
* {@inheritdoc}
5151
*/
52-
public function supports($resource, $type = null)
52+
public function supports($resource, string $type = null)
5353
{
5454
// only when type is forced to directory, not to conflict with AnnotationLoader
5555

Loader/GlobFileLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class GlobFileLoader extends FileLoader
2424
/**
2525
* {@inheritdoc}
2626
*/
27-
public function load($resource, $type = null)
27+
public function load($resource, string $type = null)
2828
{
2929
$collection = new RouteCollection();
3030

@@ -40,7 +40,7 @@ public function load($resource, $type = null)
4040
/**
4141
* {@inheritdoc}
4242
*/
43-
public function supports($resource, $type = null)
43+
public function supports($resource, string $type = null)
4444
{
4545
return 'glob' === $type;
4646
}

Loader/ObjectRouteLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ abstract protected function getServiceObject($id);
4242
*
4343
* @return RouteCollection
4444
*/
45-
public function load($resource, $type = null)
45+
public function load($resource, string $type = null)
4646
{
4747
if (!preg_match('/^[^\:]+(?:::?(?:[^\:]+))?$/', $resource)) {
4848
throw new \InvalidArgumentException(sprintf('Invalid resource "%s" passed to the "service" route loader: use the format "service::method" or "service" if your service has an "__invoke" method.', $resource));
@@ -79,7 +79,7 @@ public function load($resource, $type = null)
7979
/**
8080
* {@inheritdoc}
8181
*/
82-
public function supports($resource, $type = null)
82+
public function supports($resource, string $type = null)
8383
{
8484
return 'service' === $type;
8585
}

Loader/PhpFileLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class PhpFileLoader extends FileLoader
3333
*
3434
* @return RouteCollection A RouteCollection instance
3535
*/
36-
public function load($file, $type = null)
36+
public function load($file, string $type = null)
3737
{
3838
$path = $this->locator->locate($file);
3939
$this->setCurrentDir(\dirname($path));
@@ -61,7 +61,7 @@ public function load($file, $type = null)
6161
/**
6262
* {@inheritdoc}
6363
*/
64-
public function supports($resource, $type = null)
64+
public function supports($resource, string $type = null)
6565
{
6666
return \is_string($resource) && 'php' === pathinfo($resource, PATHINFO_EXTENSION) && (!$type || 'php' === $type);
6767
}

Loader/XmlFileLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class XmlFileLoader extends FileLoader
3939
* @throws \InvalidArgumentException when the file cannot be loaded or when the XML cannot be
4040
* parsed because it does not validate against the scheme
4141
*/
42-
public function load($file, $type = null)
42+
public function load($file, string $type = null)
4343
{
4444
$path = $this->locator->locate($file);
4545

@@ -91,7 +91,7 @@ protected function parseNode(RouteCollection $collection, \DOMElement $node, $pa
9191
/**
9292
* {@inheritdoc}
9393
*/
94-
public function supports($resource, $type = null)
94+
public function supports($resource, string $type = null)
9595
{
9696
return \is_string($resource) && 'xml' === pathinfo($resource, PATHINFO_EXTENSION) && (!$type || 'xml' === $type);
9797
}

Loader/YamlFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class YamlFileLoader extends FileLoader
4242
*
4343
* @throws \InvalidArgumentException When a route can't be parsed because YAML is invalid
4444
*/
45-
public function load($file, $type = null)
45+
public function load($file, string $type = null)
4646
{
4747
$path = $this->locator->locate($file);
4848

0 commit comments

Comments
 (0)