diff --git a/src/Symfony/Bundle/FrameworkBundle/Routing/AnnotatedRouteControllerLoader.php b/src/Symfony/Bundle/FrameworkBundle/Routing/AnnotatedRouteControllerLoader.php index ec03f849793df..498dc24d1ce75 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Routing/AnnotatedRouteControllerLoader.php +++ b/src/Symfony/Bundle/FrameworkBundle/Routing/AnnotatedRouteControllerLoader.php @@ -27,7 +27,7 @@ class AnnotatedRouteControllerLoader extends AnnotationClassLoader * * @return void */ - protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, object $annot) + protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, object $annot): void { if ('__invoke' === $method->getName()) { $route->setDefault('_controller', $class->getName()); diff --git a/src/Symfony/Component/Routing/Annotation/Route.php b/src/Symfony/Component/Routing/Annotation/Route.php index bb8423101dee8..26b5853a119ac 100644 --- a/src/Symfony/Component/Routing/Annotation/Route.php +++ b/src/Symfony/Component/Routing/Annotation/Route.php @@ -76,26 +76,17 @@ public function __construct( } } - /** - * @return void - */ - public function setPath(string $path) + public function setPath(string $path): void { $this->path = $path; } - /** - * @return string|null - */ - public function getPath() + public function getPath(): ?string { return $this->path; } - /** - * @return void - */ - public function setLocalizedPaths(array $localizedPaths) + public function setLocalizedPaths(array $localizedPaths): void { $this->localizedPaths = $localizedPaths; } @@ -105,130 +96,82 @@ public function getLocalizedPaths(): array return $this->localizedPaths; } - /** - * @return void - */ - public function setHost(string $pattern) + public function setHost(string $pattern): void { $this->host = $pattern; } - /** - * @return string|null - */ - public function getHost() + public function getHost(): ?string { return $this->host; } - /** - * @return void - */ - public function setName(string $name) + public function setName(string $name): void { $this->name = $name; } - /** - * @return string|null - */ - public function getName() + public function getName(): ?string { return $this->name; } - /** - * @return void - */ - public function setRequirements(array $requirements) + public function setRequirements(array $requirements): void { $this->requirements = $requirements; } - /** - * @return array - */ - public function getRequirements() + public function getRequirements(): array { return $this->requirements; } - /** - * @return void - */ - public function setOptions(array $options) + public function setOptions(array $options): void { $this->options = $options; } - /** - * @return array - */ - public function getOptions() + public function getOptions(): array { return $this->options; } - /** - * @return void - */ - public function setDefaults(array $defaults) + public function setDefaults(array $defaults): void { $this->defaults = $defaults; } - /** - * @return array - */ - public function getDefaults() + public function getDefaults(): array { return $this->defaults; } - /** - * @return void - */ - public function setSchemes(array|string $schemes) + public function setSchemes(array|string $schemes): void { $this->schemes = (array) $schemes; } - /** - * @return array - */ - public function getSchemes() + public function getSchemes(): array { return $this->schemes; } - /** - * @return void - */ - public function setMethods(array|string $methods) + public function setMethods(array|string $methods): void { $this->methods = (array) $methods; } - /** - * @return array - */ - public function getMethods() + public function getMethods(): array { return $this->methods; } - /** - * @return void - */ - public function setCondition(?string $condition) + public function setCondition(?string $condition): void { $this->condition = $condition; } - /** - * @return string|null - */ - public function getCondition() + public function getCondition(): ?string { return $this->condition; } diff --git a/src/Symfony/Component/Routing/DependencyInjection/RoutingResolverPass.php b/src/Symfony/Component/Routing/DependencyInjection/RoutingResolverPass.php index edbecc1f0e176..16769d5545729 100644 --- a/src/Symfony/Component/Routing/DependencyInjection/RoutingResolverPass.php +++ b/src/Symfony/Component/Routing/DependencyInjection/RoutingResolverPass.php @@ -25,10 +25,7 @@ class RoutingResolverPass implements CompilerPassInterface { use PriorityTaggedServiceTrait; - /** - * @return void - */ - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { if (false === $container->hasDefinition('routing.resolver')) { return; diff --git a/src/Symfony/Component/Routing/Generator/UrlGenerator.php b/src/Symfony/Component/Routing/Generator/UrlGenerator.php index e3fb17e81c543..a2e1407340fc8 100644 --- a/src/Symfony/Component/Routing/Generator/UrlGenerator.php +++ b/src/Symfony/Component/Routing/Generator/UrlGenerator.php @@ -42,17 +42,8 @@ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInt '%2A' => '*', ]; - protected $routes; - protected $context; + protected ?bool $strictRequirements = true; - /** - * @var bool|null - */ - protected $strictRequirements = true; - - protected $logger; - - private ?string $defaultLocale; /** * This array defines the characters (besides alphanumeric ones) that will not be percent-encoded in the path segment of the generated URL. @@ -62,7 +53,7 @@ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInt * "?" and "#" (would be interpreted wrongly as query and fragment identifier), * "'" and """ (are used as delimiters in HTML). */ - protected $decodedChars = [ + protected array $decodedChars = [ // the slash can be used to designate a hierarchical structure and we want allow using it with this meaning // some webservers don't allow the slash in encoded form in the path for security reasons anyway // see http://stackoverflow.com/questions/4069002/http-400-if-2f-part-of-get-url-in-jboss @@ -83,12 +74,12 @@ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInt '%7C' => '|', ]; - public function __construct(RouteCollection $routes, RequestContext $context, LoggerInterface $logger = null, string $defaultLocale = null) - { - $this->routes = $routes; - $this->context = $context; - $this->logger = $logger; - $this->defaultLocale = $defaultLocale; + public function __construct( + protected RouteCollection $routes, + protected RequestContext $context, + protected ?LoggerInterface $logger = null, + private ?string $defaultLocale = null + ) { } /** @@ -104,10 +95,7 @@ public function getContext(): RequestContext return $this->context; } - /** - * @return void - */ - public function setStrictRequirements(?bool $enabled) + public function setStrictRequirements(?bool $enabled): void { $this->strictRequirements = $enabled; } diff --git a/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php b/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php index ca12eb8399c82..c9c7670de6dae 100644 --- a/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php +++ b/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php @@ -71,31 +71,20 @@ */ abstract class AnnotationClassLoader implements LoaderInterface { - protected $reader; - protected $env; + protected string $routeAnnotationClass = RouteAnnotation::class; - /** - * @var string - */ - protected $routeAnnotationClass = RouteAnnotation::class; - - /** - * @var int - */ - protected $defaultRouteIndex = 0; + protected int $defaultRouteIndex = 0; - public function __construct(Reader $reader = null, string $env = null) - { - $this->reader = $reader; - $this->env = $env; + public function __construct( + protected ?Reader $reader = null, + protected ?string $env = null + ) { } /** * Sets the annotation class to read route properties from. - * - * @return void */ - public function setRouteAnnotationClass(string $class) + public function setRouteAnnotationClass(string $class): void { $this->routeAnnotationClass = $class; } @@ -160,10 +149,8 @@ public function load(mixed $class, string $type = null): RouteCollection /** * @param RouteAnnotation $annot or an object that exposes a similar interface - * - * @return void */ - protected function addRoute(RouteCollection $collection, object $annot, array $globals, \ReflectionClass $class, \ReflectionMethod $method) + protected function addRoute(RouteCollection $collection, object $annot, array $globals, \ReflectionClass $class, \ReflectionMethod $method): void { if ($annot->getEnv() && $annot->getEnv() !== $this->env) { return; @@ -263,10 +250,8 @@ public function getResolver(): LoaderResolverInterface /** * Gets the default route name for a class method. - * - * @return string */ - protected function getDefaultRouteName(\ReflectionClass $class, \ReflectionMethod $method) + protected function getDefaultRouteName(\ReflectionClass $class, \ReflectionMethod $method): string { $name = str_replace('\\', '_', $class->name).'_'.$method->name; $name = \function_exists('mb_strtolower') && preg_match('//u', $name) ? mb_strtolower($name, 'UTF-8') : strtolower($name); @@ -278,10 +263,7 @@ protected function getDefaultRouteName(\ReflectionClass $class, \ReflectionMetho return $name; } - /** - * @return array - */ - protected function getGlobals(\ReflectionClass $class) + protected function getGlobals(\ReflectionClass $class): array { $globals = $this->resetGlobals(); @@ -363,18 +345,12 @@ private function resetGlobals(): array ]; } - /** - * @return Route - */ - protected function createRoute(string $path, array $defaults, array $requirements, array $options, ?string $host, array $schemes, array $methods, ?string $condition) + protected function createRoute(string $path, array $defaults, array $requirements, array $options, ?string $host, array $schemes, array $methods, ?string $condition): Route { return new Route($path, $defaults, $requirements, $options, $host, $schemes, $methods, $condition); } - /** - * @return void - */ - abstract protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, object $annot); + abstract protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, object $annot): void; /** * @param \ReflectionClass|\ReflectionMethod $reflection diff --git a/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php b/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php index 5699824d8bc5f..2b4fa0de58649 100644 --- a/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php +++ b/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php @@ -24,17 +24,15 @@ */ class AnnotationFileLoader extends FileLoader { - protected $loader; - - public function __construct(FileLocatorInterface $locator, AnnotationClassLoader $loader) - { + public function __construct( + FileLocatorInterface $locator, + protected AnnotationClassLoader $loader + ) { if (!\function_exists('token_get_all')) { throw new \LogicException('The Tokenizer extension is required for the routing annotation loaders.'); } parent::__construct($locator); - - $this->loader = $loader; } /** diff --git a/src/Symfony/Component/Routing/Loader/ContainerLoader.php b/src/Symfony/Component/Routing/Loader/ContainerLoader.php index 716ec499a9408..50a7fd8c99fc2 100644 --- a/src/Symfony/Component/Routing/Loader/ContainerLoader.php +++ b/src/Symfony/Component/Routing/Loader/ContainerLoader.php @@ -20,9 +20,7 @@ */ class ContainerLoader extends ObjectLoader { - private ContainerInterface $container; - - public function __construct(ContainerInterface $container, string $env = null) + public function __construct(private ContainerInterface $container, string $env = null) { $this->container = $container; parent::__construct($env); diff --git a/src/Symfony/Component/Routing/Loader/XmlFileLoader.php b/src/Symfony/Component/Routing/Loader/XmlFileLoader.php index 24ec21bb5c7a7..540c020f6df6c 100644 --- a/src/Symfony/Component/Routing/Loader/XmlFileLoader.php +++ b/src/Symfony/Component/Routing/Loader/XmlFileLoader.php @@ -62,11 +62,9 @@ public function load(mixed $file, string $type = null): RouteCollection /** * Parses a node from a loaded XML file. * - * @return void - * * @throws \InvalidArgumentException When the XML is invalid */ - protected function parseNode(RouteCollection $collection, \DOMElement $node, string $path, string $file) + protected function parseNode(RouteCollection $collection, \DOMElement $node, string $path, string $file): void { if (self::NAMESPACE_URI !== $node->namespaceURI) { return; @@ -102,11 +100,9 @@ public function supports(mixed $resource, string $type = null): bool /** * Parses a route and adds it to the RouteCollection. * - * @return void - * * @throws \InvalidArgumentException When the XML is invalid */ - protected function parseRoute(RouteCollection $collection, \DOMElement $node, string $path) + protected function parseRoute(RouteCollection $collection, \DOMElement $node, string $path): void { if ('' === $id = $node->getAttribute('id')) { throw new \InvalidArgumentException(sprintf('The element in file "%s" must have an "id" attribute.', $path)); @@ -151,11 +147,9 @@ protected function parseRoute(RouteCollection $collection, \DOMElement $node, st /** * Parses an import and adds the routes in the resource to the RouteCollection. * - * @return void - * * @throws \InvalidArgumentException When the XML is invalid */ - protected function parseImport(RouteCollection $collection, \DOMElement $node, string $path, string $file) + protected function parseImport(RouteCollection $collection, \DOMElement $node, string $path, string $file): void { /** @var \DOMElement $resourceElement */ if (!($resource = $node->getAttribute('resource') ?: null) && $resourceElement = $node->getElementsByTagName('resource')[0] ?? null) { diff --git a/src/Symfony/Component/Routing/Loader/YamlFileLoader.php b/src/Symfony/Component/Routing/Loader/YamlFileLoader.php index bde72c0eb0cab..50e991cb1918d 100644 --- a/src/Symfony/Component/Routing/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/Routing/Loader/YamlFileLoader.php @@ -112,10 +112,8 @@ public function supports(mixed $resource, string $type = null): bool /** * Parses a route and adds it to the RouteCollection. - * - * @return void */ - protected function parseRoute(RouteCollection $collection, string $name, array $config, string $path) + protected function parseRoute(RouteCollection $collection, string $name, array $config, string $path): void { if (isset($config['alias'])) { $alias = $collection->addAlias($name, $config['alias']); @@ -172,10 +170,8 @@ protected function parseRoute(RouteCollection $collection, string $name, array $ /** * Parses an import and adds the routes in the resource to the RouteCollection. - * - * @return void */ - protected function parseImport(RouteCollection $collection, array $config, string $path, string $file) + protected function parseImport(RouteCollection $collection, array $config, string $path, string $file): void { $type = $config['type'] ?? null; $prefix = $config['prefix'] ?? ''; @@ -242,12 +238,10 @@ protected function parseImport(RouteCollection $collection, array $config, strin } /** - * @return void - * * @throws \InvalidArgumentException If one of the provided config keys is not supported, * something is missing or the combination is nonsense */ - protected function validate(mixed $config, string $name, string $path) + protected function validate(mixed $config, string $name, string $path): void { if (!\is_array($config)) { throw new \InvalidArgumentException(sprintf('The definition of "%s" in "%s" must be a YAML array.', $name, $path)); diff --git a/src/Symfony/Component/Routing/Matcher/ExpressionLanguageProvider.php b/src/Symfony/Component/Routing/Matcher/ExpressionLanguageProvider.php index 3aeebe699def5..955956be172ec 100644 --- a/src/Symfony/Component/Routing/Matcher/ExpressionLanguageProvider.php +++ b/src/Symfony/Component/Routing/Matcher/ExpressionLanguageProvider.php @@ -22,11 +22,8 @@ */ class ExpressionLanguageProvider implements ExpressionFunctionProviderInterface { - private ServiceProviderInterface $functions; - - public function __construct(ServiceProviderInterface $functions) + public function __construct(private ServiceProviderInterface $functions) { - $this->functions = $functions; } public function getFunctions(): array diff --git a/src/Symfony/Component/Routing/Matcher/TraceableUrlMatcher.php b/src/Symfony/Component/Routing/Matcher/TraceableUrlMatcher.php index 417f156415c67..956d0270ef331 100644 --- a/src/Symfony/Component/Routing/Matcher/TraceableUrlMatcher.php +++ b/src/Symfony/Component/Routing/Matcher/TraceableUrlMatcher.php @@ -27,12 +27,12 @@ class TraceableUrlMatcher extends UrlMatcher public const ROUTE_ALMOST_MATCHES = 1; public const ROUTE_MATCHES = 2; - protected $traces; - /** - * @return array + * @var array */ - public function getTraces(string $pathinfo) + protected array $traces; + + public function getTraces(string $pathinfo): array { $this->traces = []; @@ -44,10 +44,7 @@ public function getTraces(string $pathinfo) return $this->traces; } - /** - * @return array - */ - public function getTracesForRequest(Request $request) + public function getTracesForRequest(Request $request): array { $this->request = $request; $traces = $this->getTraces($request->getPathInfo()); diff --git a/src/Symfony/Component/Routing/Matcher/UrlMatcher.php b/src/Symfony/Component/Routing/Matcher/UrlMatcher.php index d1cee213778f3..cd73ff5e03af2 100644 --- a/src/Symfony/Component/Routing/Matcher/UrlMatcher.php +++ b/src/Symfony/Component/Routing/Matcher/UrlMatcher.php @@ -32,13 +32,10 @@ class UrlMatcher implements UrlMatcherInterface, RequestMatcherInterface public const REQUIREMENT_MISMATCH = 1; public const ROUTE_MATCH = 2; - /** @var RequestContext */ - protected $context; - /** * Collects HTTP methods that would be allowed for the request. */ - protected $allow = []; + protected array $allow = []; /** * Collects URI schemes that would be allowed for the request. @@ -47,7 +44,6 @@ class UrlMatcher implements UrlMatcherInterface, RequestMatcherInterface */ protected array $allowSchemes = []; - protected $routes; protected $request; protected $expressionLanguage; @@ -56,16 +52,13 @@ class UrlMatcher implements UrlMatcherInterface, RequestMatcherInterface */ protected $expressionLanguageProviders = []; - public function __construct(RouteCollection $routes, RequestContext $context) - { - $this->routes = $routes; - $this->context = $context; + public function __construct( + protected RouteCollection $routes, + protected RequestContext $context + ) { } - /** - * @return void - */ - public function setContext(RequestContext $context) + public function setContext(RequestContext $context): void { $this->context = $context; } @@ -101,10 +94,7 @@ public function matchRequest(Request $request): array return $ret; } - /** - * @return void - */ - public function addExpressionLanguageProvider(ExpressionFunctionProviderInterface $provider) + public function addExpressionLanguageProvider(ExpressionFunctionProviderInterface $provider): void { $this->expressionLanguageProviders[] = $provider; } @@ -255,10 +245,7 @@ protected function mergeDefaults(array $params, array $defaults): array return $defaults; } - /** - * @return ExpressionLanguage - */ - protected function getExpressionLanguage() + protected function getExpressionLanguage(): ExpressionLanguage { if (null === $this->expressionLanguage) { if (!class_exists(ExpressionLanguage::class)) { pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy