package and depencies
This commit is contained in:
@@ -40,14 +40,9 @@ class AnnotationFileLoader extends FileLoader
|
||||
/**
|
||||
* Loads from annotations from a file.
|
||||
*
|
||||
* @param string $file A PHP file path
|
||||
* @param string|null $type The resource type
|
||||
*
|
||||
* @return RouteCollection|null
|
||||
*
|
||||
* @throws \InvalidArgumentException When the file does not exist or its routes cannot be parsed
|
||||
*/
|
||||
public function load($file, string $type = null)
|
||||
public function load(mixed $file, string $type = null): ?RouteCollection
|
||||
{
|
||||
$path = $this->locator->locate($file);
|
||||
|
||||
@@ -67,20 +62,15 @@ class AnnotationFileLoader extends FileLoader
|
||||
return $collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supports($resource, string $type = null)
|
||||
public function supports(mixed $resource, string $type = null): bool
|
||||
{
|
||||
return \is_string($resource) && 'php' === pathinfo($resource, \PATHINFO_EXTENSION) && (!$type || 'annotation' === $type);
|
||||
return \is_string($resource) && 'php' === pathinfo($resource, \PATHINFO_EXTENSION) && (!$type || \in_array($type, ['annotation', 'attribute'], true));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the full class name for the first class in the file.
|
||||
*
|
||||
* @return string|false
|
||||
*/
|
||||
protected function findClass(string $file)
|
||||
protected function findClass(string $file): string|false
|
||||
{
|
||||
$class = false;
|
||||
$namespace = false;
|
||||
|
Reference in New Issue
Block a user