diff --git a/src/Symfony/Bridge/Doctrine/Test/TestRepositoryFactory.php b/src/Symfony/Bridge/Doctrine/Test/TestRepositoryFactory.php index e7df3702eb..f6ac1eedda 100644 --- a/src/Symfony/Bridge/Doctrine/Test/TestRepositoryFactory.php +++ b/src/Symfony/Bridge/Doctrine/Test/TestRepositoryFactory.php @@ -29,7 +29,7 @@ final class TestRepositoryFactory implements RepositoryFactory /** * {@inheritdoc} */ - public function getRepository(EntityManagerInterface $entityManager, $entityName) + public function getRepository(EntityManagerInterface $entityManager, $entityName): ObjectRepository { $repositoryHash = $this->getRepositoryHash($entityManager, $entityName); @@ -47,10 +47,7 @@ final class TestRepositoryFactory implements RepositoryFactory $this->repositoryList[$repositoryHash] = $repository; } - /** - * @return ObjectRepository - */ - private function createRepository(EntityManagerInterface $entityManager, $entityName) + private function createRepository(EntityManagerInterface $entityManager, $entityName): ObjectRepository { /* @var $metadata ClassMetadata */ $metadata = $entityManager->getClassMetadata($entityName); @@ -59,7 +56,7 @@ final class TestRepositoryFactory implements RepositoryFactory return new $repositoryClassName($entityManager, $metadata); } - private function getRepositoryHash(EntityManagerInterface $entityManager, $entityName) + private function getRepositoryHash(EntityManagerInterface $entityManager, $entityName): string { return $entityManager->getClassMetadata($entityName)->getName().spl_object_hash($entityManager); } diff --git a/src/Symfony/Bridge/Monolog/Handler/ChromePhpHandler.php b/src/Symfony/Bridge/Monolog/Handler/ChromePhpHandler.php index 3a9f478363..f7a95ebe15 100644 --- a/src/Symfony/Bridge/Monolog/Handler/ChromePhpHandler.php +++ b/src/Symfony/Bridge/Monolog/Handler/ChromePhpHandler.php @@ -73,7 +73,7 @@ class ChromePhpHandler extends BaseChromePhpHandler /** * Override default behavior since we check it in onKernelResponse. */ - protected function headersAccepted() + protected function headersAccepted(): bool { return true; } diff --git a/src/Symfony/Bridge/Monolog/Handler/FirePHPHandler.php b/src/Symfony/Bridge/Monolog/Handler/FirePHPHandler.php index be50c3f8ca..48252c4f03 100644 --- a/src/Symfony/Bridge/Monolog/Handler/FirePHPHandler.php +++ b/src/Symfony/Bridge/Monolog/Handler/FirePHPHandler.php @@ -75,7 +75,7 @@ class FirePHPHandler extends BaseFirePHPHandler /** * Override default behavior since we check the user agent in onKernelResponse. */ - protected function headersAccepted() + protected function headersAccepted(): bool { return true; } diff --git a/src/Symfony/Bridge/Monolog/Processor/RouteProcessor.php b/src/Symfony/Bridge/Monolog/Processor/RouteProcessor.php index 7453f3716c..23b95d9b85 100644 --- a/src/Symfony/Bridge/Monolog/Processor/RouteProcessor.php +++ b/src/Symfony/Bridge/Monolog/Processor/RouteProcessor.php @@ -35,7 +35,7 @@ class RouteProcessor implements EventSubscriberInterface, ResetInterface $this->reset(); } - public function __invoke(array $records) + public function __invoke(array $records): array { if ($this->routeData && !isset($records['extra']['requests'])) { $records['extra']['requests'] = array_values($this->routeData); @@ -78,7 +78,7 @@ class RouteProcessor implements EventSubscriberInterface, ResetInterface unset($this->routeData[$requestId]); } - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ KernelEvents::REQUEST => ['addRouteData', 1], diff --git a/src/Symfony/Bridge/Monolog/Processor/WebProcessor.php b/src/Symfony/Bridge/Monolog/Processor/WebProcessor.php index dfb2c2f2d4..3916379dbc 100644 --- a/src/Symfony/Bridge/Monolog/Processor/WebProcessor.php +++ b/src/Symfony/Bridge/Monolog/Processor/WebProcessor.php @@ -39,7 +39,7 @@ class WebProcessor extends BaseWebProcessor implements EventSubscriberInterface } } - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ KernelEvents::REQUEST => ['onKernelRequest', 4096], diff --git a/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php b/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php index 70ca302aff..edb8bd6ae5 100644 --- a/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php +++ b/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php @@ -40,7 +40,7 @@ class ProxyDumper implements DumperInterface /** * {@inheritdoc} */ - public function isProxyCandidate(Definition $definition) + public function isProxyCandidate(Definition $definition): bool { return ($definition->isLazy() || $definition->hasTag('proxy')) && $this->proxyGenerator->getProxifiedClass($definition); } @@ -48,7 +48,7 @@ class ProxyDumper implements DumperInterface /** * {@inheritdoc} */ - public function getProxyFactoryCode(Definition $definition, $id, $factoryCode = null) + public function getProxyFactoryCode(Definition $definition, $id, $factoryCode = null): string { $instantiation = 'return'; @@ -82,7 +82,7 @@ EOF; /** * {@inheritdoc} */ - public function getProxyCode(Definition $definition) + public function getProxyCode(Definition $definition): string { $code = $this->classGenerator->generate($this->generateProxyClass($definition)); diff --git a/src/Symfony/Bridge/Twig/Extension/RoutingExtension.php b/src/Symfony/Bridge/Twig/Extension/RoutingExtension.php index 67fbe8d391..cab0809129 100644 --- a/src/Symfony/Bridge/Twig/Extension/RoutingExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/RoutingExtension.php @@ -93,7 +93,7 @@ class RoutingExtension extends AbstractExtension * * @final */ - public function isUrlGenerationSafe(Node $argsNode) + public function isUrlGenerationSafe(Node $argsNode): array { // support named arguments $paramsNode = $argsNode->hasNode('parameters') ? $argsNode->getNode('parameters') : ( diff --git a/src/Symfony/Bridge/Twig/Extension/TranslationExtension.php b/src/Symfony/Bridge/Twig/Extension/TranslationExtension.php index 7bf3bdb24e..2d90bb6556 100644 --- a/src/Symfony/Bridge/Twig/Extension/TranslationExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/TranslationExtension.php @@ -58,7 +58,7 @@ class TranslationExtension extends AbstractExtension /** * {@inheritdoc} */ - public function getFilters() + public function getFilters(): array { return [ new TwigFilter('trans', [$this, 'trans']), @@ -70,7 +70,7 @@ class TranslationExtension extends AbstractExtension * * @return AbstractTokenParser[] */ - public function getTokenParsers() + public function getTokenParsers(): array { return [ // {% trans %}Symfony is great!{% endtrans %} @@ -84,17 +84,17 @@ class TranslationExtension extends AbstractExtension /** * {@inheritdoc} */ - public function getNodeVisitors() + public function getNodeVisitors(): array { return [$this->getTranslationNodeVisitor(), new TranslationDefaultDomainNodeVisitor()]; } - public function getTranslationNodeVisitor() + public function getTranslationNodeVisitor(): TranslationNodeVisitor { return $this->translationNodeVisitor ?: $this->translationNodeVisitor = new TranslationNodeVisitor(); } - public function trans($message, array $arguments = [], $domain = null, $locale = null, $count = null) + public function trans($message, array $arguments = [], $domain = null, $locale = null, $count = null): string { if (null !== $count) { $arguments['%count%'] = $count; @@ -106,7 +106,7 @@ class TranslationExtension extends AbstractExtension /** * {@inheritdoc} */ - public function getName() + public function getName(): string { return 'translator'; } diff --git a/src/Symfony/Bridge/Twig/Mime/WrappedTemplatedEmail.php b/src/Symfony/Bridge/Twig/Mime/WrappedTemplatedEmail.php index 7c0b585a4e..143d6be5b1 100644 --- a/src/Symfony/Bridge/Twig/Mime/WrappedTemplatedEmail.php +++ b/src/Symfony/Bridge/Twig/Mime/WrappedTemplatedEmail.php @@ -65,7 +65,7 @@ final class WrappedTemplatedEmail /** * @return $this */ - public function setSubject(string $subject) + public function setSubject(string $subject): object { $this->message->subject($subject); @@ -80,7 +80,7 @@ final class WrappedTemplatedEmail /** * @return $this */ - public function setReturnPath(string $address) + public function setReturnPath(string $address): object { $this->message->returnPath($address); @@ -95,7 +95,7 @@ final class WrappedTemplatedEmail /** * @return $this */ - public function addFrom(string $address, string $name = null) + public function addFrom(string $address, string $name = null): object { $this->message->addFrom($name ? new NamedAddress($address, $name) : new Address($address)); @@ -113,7 +113,7 @@ final class WrappedTemplatedEmail /** * @return $this */ - public function addReplyTo(string $address) + public function addReplyTo(string $address): object { $this->message->addReplyTo($address); @@ -131,7 +131,7 @@ final class WrappedTemplatedEmail /** * @return $this */ - public function addTo(string $address, string $name = null) + public function addTo(string $address, string $name = null): object { $this->message->addTo($name ? new NamedAddress($address, $name) : new Address($address)); @@ -149,7 +149,7 @@ final class WrappedTemplatedEmail /** * @return $this */ - public function addCc(string $address, string $name = null) + public function addCc(string $address, string $name = null): object { $this->message->addCc($name ? new NamedAddress($address, $name) : new Address($address)); @@ -167,7 +167,7 @@ final class WrappedTemplatedEmail /** * @return $this */ - public function addBcc(string $address, string $name = null) + public function addBcc(string $address, string $name = null): object { $this->message->addBcc($name ? new NamedAddress($address, $name) : new Address($address)); @@ -185,7 +185,7 @@ final class WrappedTemplatedEmail /** * @return $this */ - public function setPriority(int $priority) + public function setPriority(int $priority): object { $this->message->setPriority($priority); diff --git a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/RouterCacheWarmer.php b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/RouterCacheWarmer.php index 6450eb33d7..6db604fa85 100644 --- a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/RouterCacheWarmer.php +++ b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/RouterCacheWarmer.php @@ -57,7 +57,7 @@ class RouterCacheWarmer implements CacheWarmerInterface, ServiceSubscriberInterf * * @return bool always true */ - public function isOptional() + public function isOptional(): bool { return true; } @@ -65,7 +65,7 @@ class RouterCacheWarmer implements CacheWarmerInterface, ServiceSubscriberInterf /** * {@inheritdoc} */ - public static function getSubscribedServices() + public static function getSubscribedServices(): array { return [ 'router' => RouterInterface::class, diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php index 5feacb6492..19130b237c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php @@ -258,7 +258,7 @@ EOT return self::METHOD_COPY; } - private function getPublicDirectory(ContainerInterface $container) + private function getPublicDirectory(ContainerInterface $container): string { $defaultPublicDir = 'public'; diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php index bfd88b09d5..f17b037505 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php @@ -208,11 +208,9 @@ EOF /** * Loads the ContainerBuilder from the cache. * - * @return ContainerBuilder - * * @throws \LogicException */ - protected function getContainerBuilder() + protected function getContainerBuilder(): ContainerBuilder { if ($this->containerBuilder) { return $this->containerBuilder; diff --git a/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerResolver.php b/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerResolver.php index a3d04de760..859d1c200e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerResolver.php +++ b/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerResolver.php @@ -24,12 +24,12 @@ class ControllerResolver extends ContainerControllerResolver /** * {@inheritdoc} */ - protected function instantiateController($class) + protected function instantiateController($class): object { return $this->configureController(parent::instantiateController($class), $class); } - private function configureController($controller, string $class) + private function configureController($controller, string $class): object { if ($controller instanceof ContainerAwareInterface) { $controller->setContainer($this->container); diff --git a/src/Symfony/Bundle/SecurityBundle/Command/UserPasswordEncoderCommand.php b/src/Symfony/Bundle/SecurityBundle/Command/UserPasswordEncoderCommand.php index 84ad3e4c8b..248e2f013a 100644 --- a/src/Symfony/Bundle/SecurityBundle/Command/UserPasswordEncoderCommand.php +++ b/src/Symfony/Bundle/SecurityBundle/Command/UserPasswordEncoderCommand.php @@ -180,7 +180,7 @@ EOF })->setHidden(true)->setMaxAttempts(20); } - private function generateSalt() + private function generateSalt(): string { return base64_encode(random_bytes(30)); } diff --git a/src/Symfony/Bundle/SecurityBundle/Debug/WrappedListener.php b/src/Symfony/Bundle/SecurityBundle/Debug/WrappedListener.php index 5c19e6aa78..3b21e0d94a 100644 --- a/src/Symfony/Bundle/SecurityBundle/Debug/WrappedListener.php +++ b/src/Symfony/Bundle/SecurityBundle/Debug/WrappedListener.php @@ -54,7 +54,7 @@ final class WrappedListener return $this->listener->{$method}(...$arguments); } - public function getWrappedListener() + public function getWrappedListener(): callable { return $this->listener; } diff --git a/src/Symfony/Bundle/WebProfilerBundle/EventListener/WebDebugToolbarListener.php b/src/Symfony/Bundle/WebProfilerBundle/EventListener/WebDebugToolbarListener.php index 85c79f6b6f..075891c81d 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/EventListener/WebDebugToolbarListener.php +++ b/src/Symfony/Bundle/WebProfilerBundle/EventListener/WebDebugToolbarListener.php @@ -55,7 +55,7 @@ class WebDebugToolbarListener implements EventSubscriberInterface $this->cspHandler = $cspHandler; } - public function isEnabled() + public function isEnabled(): bool { return self::DISABLED !== $this->mode; } @@ -136,7 +136,7 @@ class WebDebugToolbarListener implements EventSubscriberInterface } } - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ KernelEvents::RESPONSE => ['onKernelResponse', -128], diff --git a/src/Symfony/Component/BrowserKit/HttpBrowser.php b/src/Symfony/Component/BrowserKit/HttpBrowser.php index 7492e58907..d36cf23712 100644 --- a/src/Symfony/Component/BrowserKit/HttpBrowser.php +++ b/src/Symfony/Component/BrowserKit/HttpBrowser.php @@ -41,7 +41,7 @@ class HttpBrowser extends AbstractBrowser parent::__construct([], $history, $cookieJar); } - protected function doRequest($request) + protected function doRequest($request): Response { $headers = $this->getHeaders($request); [$body, $extraHeaders] = $this->getBodyAndExtraHeaders($request); diff --git a/src/Symfony/Component/BrowserKit/Response.php b/src/Symfony/Component/BrowserKit/Response.php index bc1da98537..376bd78df4 100644 --- a/src/Symfony/Component/BrowserKit/Response.php +++ b/src/Symfony/Component/BrowserKit/Response.php @@ -40,7 +40,7 @@ final class Response * * @return string The response with headers and content */ - public function __toString() + public function __toString(): string { $headers = ''; foreach ($this->headers as $name => $value) { @@ -61,7 +61,7 @@ final class Response * * @return string The response content */ - public function getContent() + public function getContent(): string { return $this->content; } @@ -76,7 +76,7 @@ final class Response * * @return array The response headers */ - public function getHeaders() + public function getHeaders(): array { return $this->headers; } diff --git a/src/Symfony/Component/BrowserKit/Tests/HttpBrowserTest.php b/src/Symfony/Component/BrowserKit/Tests/HttpBrowserTest.php index ef6fac4f29..64594d503f 100644 --- a/src/Symfony/Component/BrowserKit/Tests/HttpBrowserTest.php +++ b/src/Symfony/Component/BrowserKit/Tests/HttpBrowserTest.php @@ -59,7 +59,7 @@ class TestHttpClient extends HttpBrowser return $response; } - protected function doRequest($request) + protected function doRequest($request): Response { $response = parent::doRequest($request); diff --git a/src/Symfony/Component/Cache/CacheItem.php b/src/Symfony/Component/Cache/CacheItem.php index cd599d23d2..68b69799f0 100644 --- a/src/Symfony/Component/Cache/CacheItem.php +++ b/src/Symfony/Component/Cache/CacheItem.php @@ -37,7 +37,7 @@ final class CacheItem implements ItemInterface /** * {@inheritdoc} */ - public function getKey() + public function getKey(): string { return $this->key; } @@ -53,7 +53,7 @@ final class CacheItem implements ItemInterface /** * {@inheritdoc} */ - public function isHit() + public function isHit(): bool { return $this->isHit; } @@ -145,11 +145,9 @@ final class CacheItem implements ItemInterface * * @param string $key The key to validate * - * @return string - * * @throws InvalidArgumentException When $key is not valid */ - public static function validateKey($key) + public static function validateKey($key): string { if (!\is_string($key)) { throw new InvalidArgumentException(sprintf('Cache key must be string, "%s" given', \is_object($key) ? \get_class($key) : \gettype($key))); diff --git a/src/Symfony/Component/Config/Definition/Processor.php b/src/Symfony/Component/Config/Definition/Processor.php index a8c43620b9..8a1281cdf0 100644 --- a/src/Symfony/Component/Config/Definition/Processor.php +++ b/src/Symfony/Component/Config/Definition/Processor.php @@ -28,7 +28,7 @@ class Processor * * @return array The processed configuration */ - public function process(NodeInterface $configTree, array $configs) + public function process(NodeInterface $configTree, array $configs): array { $currentConfig = []; foreach ($configs as $config) { @@ -47,7 +47,7 @@ class Processor * * @return array The processed configuration */ - public function processConfiguration(ConfigurationInterface $configuration, array $configs) + public function processConfiguration(ConfigurationInterface $configuration, array $configs): array { return $this->process($configuration->getConfigTreeBuilder()->buildTree(), $configs); } @@ -75,7 +75,7 @@ class Processor * * @return array */ - public static function normalizeConfig(array $config, string $key, string $plural = null) + public static function normalizeConfig(array $config, string $key, string $plural = null): array { if (null === $plural) { $plural = $key.'s'; diff --git a/src/Symfony/Component/Config/Resource/ClassExistenceResource.php b/src/Symfony/Component/Config/Resource/ClassExistenceResource.php index b033dd1fac..a1a0e5464a 100644 --- a/src/Symfony/Component/Config/Resource/ClassExistenceResource.php +++ b/src/Symfony/Component/Config/Resource/ClassExistenceResource.php @@ -43,7 +43,7 @@ class ClassExistenceResource implements SelfCheckingResourceInterface /** * {@inheritdoc} */ - public function __toString() + public function __toString(): string { return $this->resource; } @@ -51,7 +51,7 @@ class ClassExistenceResource implements SelfCheckingResourceInterface /** * @return string The file path to the resource */ - public function getResource() + public function getResource(): string { return $this->resource; } @@ -61,7 +61,7 @@ class ClassExistenceResource implements SelfCheckingResourceInterface * * @throws \ReflectionException when a parent class/interface/trait is not found */ - public function isFresh(int $timestamp) + public function isFresh(int $timestamp): bool { $loaded = class_exists($this->resource, false) || interface_exists($this->resource, false) || trait_exists($this->resource, false); diff --git a/src/Symfony/Component/Config/Resource/ComposerResource.php b/src/Symfony/Component/Config/Resource/ComposerResource.php index 7e7642e35f..a727217b29 100644 --- a/src/Symfony/Component/Config/Resource/ComposerResource.php +++ b/src/Symfony/Component/Config/Resource/ComposerResource.php @@ -30,7 +30,7 @@ class ComposerResource implements SelfCheckingResourceInterface $this->vendors = self::$runtimeVendors; } - public function getVendors() + public function getVendors(): array { return array_keys($this->vendors); } @@ -38,7 +38,7 @@ class ComposerResource implements SelfCheckingResourceInterface /** * {@inheritdoc} */ - public function __toString() + public function __toString(): string { return __CLASS__; } @@ -46,7 +46,7 @@ class ComposerResource implements SelfCheckingResourceInterface /** * {@inheritdoc} */ - public function isFresh(int $timestamp) + public function isFresh(int $timestamp): bool { self::refresh(); diff --git a/src/Symfony/Component/Config/Resource/DirectoryResource.php b/src/Symfony/Component/Config/Resource/DirectoryResource.php index bd3240e9b2..1a28881f3f 100644 --- a/src/Symfony/Component/Config/Resource/DirectoryResource.php +++ b/src/Symfony/Component/Config/Resource/DirectoryResource.php @@ -42,7 +42,7 @@ class DirectoryResource implements SelfCheckingResourceInterface /** * {@inheritdoc} */ - public function __toString() + public function __toString(): string { return md5(serialize([$this->resource, $this->pattern])); } @@ -50,17 +50,15 @@ class DirectoryResource implements SelfCheckingResourceInterface /** * @return string The file path to the resource */ - public function getResource() + public function getResource(): string { return $this->resource; } /** * Returns the pattern to restrict monitored files. - * - * @return string|null */ - public function getPattern() + public function getPattern(): ?string { return $this->pattern; } @@ -68,7 +66,7 @@ class DirectoryResource implements SelfCheckingResourceInterface /** * {@inheritdoc} */ - public function isFresh(int $timestamp) + public function isFresh(int $timestamp): bool { if (!is_dir($this->resource)) { return false; diff --git a/src/Symfony/Component/Config/Resource/FileExistenceResource.php b/src/Symfony/Component/Config/Resource/FileExistenceResource.php index 886fb403f1..ca2d2c3f79 100644 --- a/src/Symfony/Component/Config/Resource/FileExistenceResource.php +++ b/src/Symfony/Component/Config/Resource/FileExistenceResource.php @@ -39,7 +39,7 @@ class FileExistenceResource implements SelfCheckingResourceInterface /** * {@inheritdoc} */ - public function __toString() + public function __toString(): string { return $this->resource; } @@ -47,7 +47,7 @@ class FileExistenceResource implements SelfCheckingResourceInterface /** * @return string The file path to the resource */ - public function getResource() + public function getResource(): string { return $this->resource; } @@ -55,7 +55,7 @@ class FileExistenceResource implements SelfCheckingResourceInterface /** * {@inheritdoc} */ - public function isFresh(int $timestamp) + public function isFresh(int $timestamp): bool { return file_exists($this->resource) === $this->exists; } diff --git a/src/Symfony/Component/Config/Resource/FileResource.php b/src/Symfony/Component/Config/Resource/FileResource.php index 6d00b2baf6..4274d07bac 100644 --- a/src/Symfony/Component/Config/Resource/FileResource.php +++ b/src/Symfony/Component/Config/Resource/FileResource.php @@ -44,7 +44,7 @@ class FileResource implements SelfCheckingResourceInterface /** * {@inheritdoc} */ - public function __toString() + public function __toString(): string { return $this->resource; } @@ -52,7 +52,7 @@ class FileResource implements SelfCheckingResourceInterface /** * @return string The canonicalized, absolute path to the resource */ - public function getResource() + public function getResource(): string { return $this->resource; } @@ -60,7 +60,7 @@ class FileResource implements SelfCheckingResourceInterface /** * {@inheritdoc} */ - public function isFresh(int $timestamp) + public function isFresh(int $timestamp): bool { return false !== ($filemtime = @filemtime($this->resource)) && $filemtime <= $timestamp; } diff --git a/src/Symfony/Component/Config/Resource/GlobResource.php b/src/Symfony/Component/Config/Resource/GlobResource.php index c9e0b34734..bd29c4c274 100644 --- a/src/Symfony/Component/Config/Resource/GlobResource.php +++ b/src/Symfony/Component/Config/Resource/GlobResource.php @@ -52,7 +52,7 @@ class GlobResource implements \IteratorAggregate, SelfCheckingResourceInterface } } - public function getPrefix() + public function getPrefix(): string { return $this->prefix; } @@ -60,7 +60,7 @@ class GlobResource implements \IteratorAggregate, SelfCheckingResourceInterface /** * {@inheritdoc} */ - public function __toString() + public function __toString(): string { return 'glob.'.$this->prefix.$this->pattern.(int) $this->recursive; } @@ -68,7 +68,7 @@ class GlobResource implements \IteratorAggregate, SelfCheckingResourceInterface /** * {@inheritdoc} */ - public function isFresh(int $timestamp) + public function isFresh(int $timestamp): bool { $hash = $this->computeHash(); @@ -91,7 +91,7 @@ class GlobResource implements \IteratorAggregate, SelfCheckingResourceInterface return ['prefix', 'pattern', 'recursive', 'hash', 'forExclusion', 'excludedPrefixes']; } - public function getIterator() + public function getIterator(): \Traversable { if (!file_exists($this->prefix) || (!$this->recursive && '' === $this->pattern)) { return; @@ -171,7 +171,7 @@ class GlobResource implements \IteratorAggregate, SelfCheckingResourceInterface } } - private function computeHash() + private function computeHash(): string { $hash = hash_init('md5'); diff --git a/src/Symfony/Component/Config/Resource/ReflectionClassResource.php b/src/Symfony/Component/Config/Resource/ReflectionClassResource.php index 14bbf7c226..a03379f0de 100644 --- a/src/Symfony/Component/Config/Resource/ReflectionClassResource.php +++ b/src/Symfony/Component/Config/Resource/ReflectionClassResource.php @@ -38,7 +38,7 @@ class ReflectionClassResource implements SelfCheckingResourceInterface /** * {@inheritdoc} */ - public function isFresh(int $timestamp) + public function isFresh(int $timestamp): bool { if (null === $this->hash) { $this->hash = $this->computeHash(); @@ -58,7 +58,7 @@ class ReflectionClassResource implements SelfCheckingResourceInterface return true; } - public function __toString() + public function __toString(): string { return 'reflection.'.$this->className; } diff --git a/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php b/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php index cd55345d77..ff765d7b2e 100644 --- a/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php +++ b/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php @@ -109,7 +109,7 @@ EOPHP; } } - public function provideHashedSignature() + public function provideHashedSignature(): iterable { yield [0, 0, "// line change\n\n"]; yield [1, 0, '/** class docblock */']; diff --git a/src/Symfony/Component/Console/Helper/ProcessHelper.php b/src/Symfony/Component/Console/Helper/ProcessHelper.php index 55a3354bcf..fbd7d4baf4 100644 --- a/src/Symfony/Component/Console/Helper/ProcessHelper.php +++ b/src/Symfony/Component/Console/Helper/ProcessHelper.php @@ -37,7 +37,7 @@ class ProcessHelper extends Helper * * @return Process The process that ran */ - public function run(OutputInterface $output, $cmd, $error = null, callable $callback = null, $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE) + public function run(OutputInterface $output, $cmd, $error = null, callable $callback = null, $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE): Process { if ($output instanceof ConsoleOutputInterface) { $output = $output->getErrorOutput(); @@ -103,7 +103,7 @@ class ProcessHelper extends Helper * * @see run() */ - public function mustRun(OutputInterface $output, $cmd, $error = null, callable $callback = null) + public function mustRun(OutputInterface $output, $cmd, $error = null, callable $callback = null): Process { $process = $this->run($output, $cmd, $error, $callback); @@ -120,10 +120,8 @@ class ProcessHelper extends Helper * @param OutputInterface $output An OutputInterface interface * @param Process $process The Process * @param callable|null $callback A PHP callable - * - * @return callable */ - public function wrapCallback(OutputInterface $output, Process $process, callable $callback = null) + public function wrapCallback(OutputInterface $output, Process $process, callable $callback = null): callable { if ($output instanceof ConsoleOutputInterface) { $output = $output->getErrorOutput(); @@ -148,7 +146,7 @@ class ProcessHelper extends Helper /** * {@inheritdoc} */ - public function getName() + public function getName(): string { return 'process'; } diff --git a/src/Symfony/Component/Debug/ErrorHandler.php b/src/Symfony/Component/Debug/ErrorHandler.php index 2f250cba36..2d0f7a6e52 100644 --- a/src/Symfony/Component/Debug/ErrorHandler.php +++ b/src/Symfony/Component/Debug/ErrorHandler.php @@ -112,7 +112,7 @@ class ErrorHandler * * @return self The registered error handler */ - public static function register(self $handler = null, $replace = true) + public static function register(self $handler = null, $replace = true): self { if (null === self::$reservedMemory) { self::$reservedMemory = str_repeat('x', 10240); @@ -210,7 +210,7 @@ class ErrorHandler * * @throws \InvalidArgumentException */ - public function setLoggers(array $loggers) + public function setLoggers(array $loggers): array { $prevLogged = $this->loggedErrors; $prev = $this->loggers; @@ -261,7 +261,7 @@ class ErrorHandler * * @return callable|null The previous exception handler */ - public function setExceptionHandler(callable $handler = null) + public function setExceptionHandler(callable $handler = null): ?callable { $prev = $this->exceptionHandler; $this->exceptionHandler = $handler; @@ -277,7 +277,7 @@ class ErrorHandler * * @return int The previous value */ - public function throwAt($levels, $replace = false) + public function throwAt($levels, $replace = false): int { $prev = $this->thrownErrors; $this->thrownErrors = ($levels | E_RECOVERABLE_ERROR | E_USER_ERROR) & ~E_USER_DEPRECATED & ~E_DEPRECATED; @@ -297,7 +297,7 @@ class ErrorHandler * * @return int The previous value */ - public function scopeAt($levels, $replace = false) + public function scopeAt($levels, $replace = false): int { $prev = $this->scopedErrors; $this->scopedErrors = (int) $levels; @@ -316,7 +316,7 @@ class ErrorHandler * * @return int The previous value */ - public function traceAt($levels, $replace = false) + public function traceAt($levels, $replace = false): int { $prev = $this->tracedErrors; $this->tracedErrors = (int) $levels; @@ -335,7 +335,7 @@ class ErrorHandler * * @return int The previous value */ - public function screamAt($levels, $replace = false) + public function screamAt($levels, $replace = false): int { $prev = $this->screamedErrors; $this->screamedErrors = (int) $levels; @@ -374,7 +374,7 @@ class ErrorHandler * @param string $file * @param int $line * - * @return bool Returns false when no handling happens so that the PHP engine can handle the error itself + * @return bool|void Returns false when no handling happens so that the PHP engine can handle the error itself * * @throws \ErrorException When $this->thrownErrors requests so * @@ -670,7 +670,7 @@ class ErrorHandler * * @return FatalErrorHandlerInterface[] An array of FatalErrorHandlerInterface */ - protected function getFatalErrorHandlers() + protected function getFatalErrorHandlers(): array { return [ new UndefinedFunctionFatalErrorHandler(), @@ -682,7 +682,7 @@ class ErrorHandler /** * Cleans the trace by removing function arguments and the frames added by the error handler and DebugClassLoader. */ - private function cleanTrace($backtrace, $type, $file, $line, $throw) + private function cleanTrace($backtrace, $type, $file, $line, $throw): array { $lightTrace = $backtrace; diff --git a/src/Symfony/Component/Debug/ExceptionHandler.php b/src/Symfony/Component/Debug/ExceptionHandler.php index 7ae85eebb7..341e13ac8c 100644 --- a/src/Symfony/Component/Debug/ExceptionHandler.php +++ b/src/Symfony/Component/Debug/ExceptionHandler.php @@ -84,7 +84,7 @@ class ExceptionHandler * * @return callable|null The previous exception handler if any */ - public function setHandler(callable $handler = null) + public function setHandler(callable $handler = null): ?callable { $old = $this->handler; $this->handler = $handler; @@ -99,7 +99,7 @@ class ExceptionHandler * * @return string The previous file link format */ - public function setFileLinkFormat($fileLinkFormat) + public function setFileLinkFormat($fileLinkFormat): string { $old = $this->fileLinkFormat; $this->fileLinkFormat = $fileLinkFormat; @@ -196,7 +196,7 @@ class ExceptionHandler * * @return string The HTML content as a string */ - public function getHtml($exception) + public function getHtml($exception): string { if (!$exception instanceof FlattenException) { $exception = FlattenException::create($exception); @@ -210,7 +210,7 @@ class ExceptionHandler * * @return string The content as a string */ - public function getContent(FlattenException $exception) + public function getContent(FlattenException $exception): string { switch ($exception->getStatusCode()) { case 404: @@ -295,7 +295,7 @@ EOF; * * @return string The stylesheet as a string */ - public function getStylesheet(FlattenException $exception) + public function getStylesheet(FlattenException $exception): string { if (!$this->debug) { return <<<'EOF' @@ -355,7 +355,7 @@ EOF; EOF; } - private function decorate($content, $css) + private function decorate($content, $css): string { return << @@ -372,14 +372,14 @@ EOF; EOF; } - private function formatClass($class) + private function formatClass($class): string { $parts = explode('\\', $class); return sprintf('%s', $class, array_pop($parts)); } - private function formatPath($path, $line) + private function formatPath($path, $line): string { $file = $this->escapeHtml(preg_match('#[^/\\\\]*+$#', $path, $file) ? $file[0] : $path); $fmt = $this->fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format'); @@ -415,10 +415,8 @@ EOF; * Formats an array as a string. * * @param array $args The argument array - * - * @return string */ - private function formatArgs(array $args) + private function formatArgs(array $args): string { $result = []; foreach ($args as $key => $item) { @@ -445,17 +443,17 @@ EOF; /** * HTML-encodes a string. */ - private function escapeHtml($str) + private function escapeHtml($str): string { return htmlspecialchars($str, ENT_COMPAT | ENT_SUBSTITUTE, $this->charset); } - private function getSymfonyGhostAsSvg() + private function getSymfonyGhostAsSvg(): string { return ''.$this->addElementToGhost().''; } - private function addElementToGhost() + private function addElementToGhost(): string { if (!isset(self::GHOST_ADDONS[\date('m-d')])) { return ''; diff --git a/src/Symfony/Component/DependencyInjection/Argument/BoundArgument.php b/src/Symfony/Component/DependencyInjection/Argument/BoundArgument.php index 4a0054e20b..60059267be 100644 --- a/src/Symfony/Component/DependencyInjection/Argument/BoundArgument.php +++ b/src/Symfony/Component/DependencyInjection/Argument/BoundArgument.php @@ -43,7 +43,7 @@ final class BoundArgument implements ArgumentInterface /** * {@inheritdoc} */ - public function getValues() + public function getValues(): array { return [$this->value, $this->identifier, $this->used, $this->type, $this->file]; } diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ServiceLocatorTagPass.php b/src/Symfony/Component/DependencyInjection/Compiler/ServiceLocatorTagPass.php index a41f6905cf..424018b7ee 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ServiceLocatorTagPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ServiceLocatorTagPass.php @@ -90,10 +90,8 @@ final class ServiceLocatorTagPass extends AbstractRecursivePass * @param ContainerBuilder $container * @param Reference[] $refMap * @param string|null $callerId - * - * @return Reference */ - public static function register(ContainerBuilder $container, array $refMap, $callerId = null) + public static function register(ContainerBuilder $container, array $refMap, $callerId = null): Reference { foreach ($refMap as $id => $ref) { if (!$ref instanceof Reference) { diff --git a/src/Symfony/Component/DependencyInjection/Config/ContainerParametersResource.php b/src/Symfony/Component/DependencyInjection/Config/ContainerParametersResource.php index 605ab04151..8ffb8dcac9 100644 --- a/src/Symfony/Component/DependencyInjection/Config/ContainerParametersResource.php +++ b/src/Symfony/Component/DependencyInjection/Config/ContainerParametersResource.php @@ -35,7 +35,7 @@ class ContainerParametersResource implements ResourceInterface /** * {@inheritdoc} */ - public function __toString() + public function __toString(): string { return 'container_parameters_'.md5(serialize($this->parameters)); } @@ -43,7 +43,7 @@ class ContainerParametersResource implements ResourceInterface /** * @return array Tracked parameters */ - public function getParameters() + public function getParameters(): array { return $this->parameters; } diff --git a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php index e2638dc749..8b13b4d7ad 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php +++ b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php @@ -384,8 +384,6 @@ class ContainerBuilder extends Container implements TaggedContainerInterface * @param bool|string $trackContents Whether to track contents of the given resource. If a string is passed, * it will be used as pattern for tracking contents of the requested directory * - * @return bool - * * @final */ public function fileExists(string $path, $trackContents = true): bool diff --git a/src/Symfony/Component/DependencyInjection/LazyProxy/PhpDumper/NullDumper.php b/src/Symfony/Component/DependencyInjection/LazyProxy/PhpDumper/NullDumper.php index 57c644ca79..ebc6a5dc2b 100644 --- a/src/Symfony/Component/DependencyInjection/LazyProxy/PhpDumper/NullDumper.php +++ b/src/Symfony/Component/DependencyInjection/LazyProxy/PhpDumper/NullDumper.php @@ -25,7 +25,7 @@ class NullDumper implements DumperInterface /** * {@inheritdoc} */ - public function isProxyCandidate(Definition $definition) + public function isProxyCandidate(Definition $definition): bool { return false; } @@ -33,7 +33,7 @@ class NullDumper implements DumperInterface /** * {@inheritdoc} */ - public function getProxyFactoryCode(Definition $definition, $id, $factoryCode = null) + public function getProxyFactoryCode(Definition $definition, $id, $factoryCode = null): string { return ''; } @@ -41,7 +41,7 @@ class NullDumper implements DumperInterface /** * {@inheritdoc} */ - public function getProxyCode(Definition $definition) + public function getProxyCode(Definition $definition): string { return ''; } diff --git a/src/Symfony/Component/DependencyInjection/Loader/Configurator/DefaultsConfigurator.php b/src/Symfony/Component/DependencyInjection/Loader/Configurator/DefaultsConfigurator.php index b527fd51da..cac009f769 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/Configurator/DefaultsConfigurator.php +++ b/src/Symfony/Component/DependencyInjection/Loader/Configurator/DefaultsConfigurator.php @@ -42,7 +42,7 @@ class DefaultsConfigurator extends AbstractServiceConfigurator * * @throws InvalidArgumentException when an invalid tag name or attribute is provided */ - final public function tag(string $name, array $attributes = []) + final public function tag(string $name, array $attributes = []): object { if ('' === $name) { throw new InvalidArgumentException('The tag name in "_defaults" must be a non-empty string.'); @@ -61,10 +61,8 @@ class DefaultsConfigurator extends AbstractServiceConfigurator /** * Defines an instanceof-conditional to be applied to following service definitions. - * - * @return InstanceofConfigurator */ - final public function instanceof(string $fqcn) + final public function instanceof(string $fqcn): InstanceofConfigurator { return $this->parent->instanceof($fqcn); } diff --git a/src/Symfony/Component/DependencyInjection/Loader/Configurator/ParametersConfigurator.php b/src/Symfony/Component/DependencyInjection/Loader/Configurator/ParametersConfigurator.php index bacc60f051..800ca28435 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/Configurator/ParametersConfigurator.php +++ b/src/Symfony/Component/DependencyInjection/Loader/Configurator/ParametersConfigurator.php @@ -32,7 +32,7 @@ class ParametersConfigurator extends AbstractConfigurator * * @return $this */ - final public function set(string $name, $value) + final public function set(string $name, $value): object { $this->container->setParameter($name, static::processValue($value, true)); @@ -44,7 +44,7 @@ class ParametersConfigurator extends AbstractConfigurator * * @return $this */ - final public function __invoke(string $name, $value) + final public function __invoke(string $name, $value): object { return $this->set($name, $value); } diff --git a/src/Symfony/Component/DependencyInjection/Loader/Configurator/PrototypeConfigurator.php b/src/Symfony/Component/DependencyInjection/Loader/Configurator/PrototypeConfigurator.php index 119f2f252e..98b1a1e726 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/Configurator/PrototypeConfigurator.php +++ b/src/Symfony/Component/DependencyInjection/Loader/Configurator/PrototypeConfigurator.php @@ -75,7 +75,7 @@ class PrototypeConfigurator extends AbstractServiceConfigurator * * @return $this */ - final public function exclude($excludes) + final public function exclude($excludes): object { $this->excludes = (array) $excludes; diff --git a/src/Symfony/Component/DependencyInjection/Loader/Configurator/ReferenceConfigurator.php b/src/Symfony/Component/DependencyInjection/Loader/Configurator/ReferenceConfigurator.php index 590b60a54a..e0e83c4da8 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/Configurator/ReferenceConfigurator.php +++ b/src/Symfony/Component/DependencyInjection/Loader/Configurator/ReferenceConfigurator.php @@ -32,7 +32,7 @@ class ReferenceConfigurator extends AbstractConfigurator /** * @return $this */ - final public function ignoreOnInvalid() + final public function ignoreOnInvalid(): object { $this->invalidBehavior = ContainerInterface::IGNORE_ON_INVALID_REFERENCE; @@ -42,7 +42,7 @@ class ReferenceConfigurator extends AbstractConfigurator /** * @return $this */ - final public function nullOnInvalid() + final public function nullOnInvalid(): object { $this->invalidBehavior = ContainerInterface::NULL_ON_INVALID_REFERENCE; @@ -52,14 +52,14 @@ class ReferenceConfigurator extends AbstractConfigurator /** * @return $this */ - final public function ignoreOnUninitialized() + final public function ignoreOnUninitialized(): object { $this->invalidBehavior = ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE; return $this; } - public function __toString() + public function __toString(): string { return $this->id; } diff --git a/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/AbstractTrait.php b/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/AbstractTrait.php index 57ddb480fa..871cade35b 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/AbstractTrait.php +++ b/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/AbstractTrait.php @@ -19,7 +19,7 @@ trait AbstractTrait * * @return $this */ - final public function abstract(bool $abstract = true) + final public function abstract(bool $abstract = true): object { $this->definition->setAbstract($abstract); diff --git a/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/ArgumentTrait.php b/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/ArgumentTrait.php index 7ec8c51d47..25e9aaba2a 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/ArgumentTrait.php +++ b/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/ArgumentTrait.php @@ -20,7 +20,7 @@ trait ArgumentTrait * * @return $this */ - final public function args(array $arguments) + final public function args(array $arguments): object { $this->definition->setArguments(static::processValue($arguments, true)); @@ -35,7 +35,7 @@ trait ArgumentTrait * * @return $this */ - final public function arg($key, $value) + final public function arg($key, $value): object { $this->definition->setArgument($key, static::processValue($value, true)); diff --git a/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/AutoconfigureTrait.php b/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/AutoconfigureTrait.php index a923b3fe59..62c2c7c581 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/AutoconfigureTrait.php +++ b/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/AutoconfigureTrait.php @@ -23,7 +23,7 @@ trait AutoconfigureTrait * * @throws InvalidArgumentException when a parent is already set */ - final public function autoconfigure(bool $autoconfigured = true) + final public function autoconfigure(bool $autoconfigured = true): object { if ($autoconfigured && $this->definition instanceof ChildDefinition) { throw new InvalidArgumentException(sprintf('The service "%s" cannot have a "parent" and also have "autoconfigure". Try disabling autoconfiguration for the service.', $this->id)); diff --git a/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/AutowireTrait.php b/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/AutowireTrait.php index 4c90af849a..5c372273ce 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/AutowireTrait.php +++ b/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/AutowireTrait.php @@ -18,7 +18,7 @@ trait AutowireTrait * * @return $this */ - final public function autowire(bool $autowired = true) + final public function autowire(bool $autowired = true): object { $this->definition->setAutowired($autowired); diff --git a/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/BindTrait.php b/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/BindTrait.php index 621158fdee..a7f76d248c 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/BindTrait.php +++ b/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/BindTrait.php @@ -31,7 +31,7 @@ trait BindTrait * * @return $this */ - final public function bind($nameOrFqcn, $valueOrRef) + final public function bind($nameOrFqcn, $valueOrRef): object { $valueOrRef = static::processValue($valueOrRef, true); if (!preg_match('/^(?:(?:array|bool|float|int|string)[ \t]*+)?\$/', $nameOrFqcn) && !$valueOrRef instanceof Reference) { diff --git a/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/CallTrait.php b/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/CallTrait.php index 8e6b17a19d..3f800cdc2b 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/CallTrait.php +++ b/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/CallTrait.php @@ -25,7 +25,7 @@ trait CallTrait * * @throws InvalidArgumentException on empty $method param */ - final public function call($method, array $arguments = []) + final public function call($method, array $arguments = []): object { $this->definition->addMethodCall($method, static::processValue($arguments, true)); diff --git a/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/ClassTrait.php b/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/ClassTrait.php index ef44afe6c1..18679e68ea 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/ClassTrait.php +++ b/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/ClassTrait.php @@ -18,7 +18,7 @@ trait ClassTrait * * @return $this */ - final public function class($class) + final public function class($class): object { $this->definition->setClass($class); diff --git a/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/ConfiguratorTrait.php b/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/ConfiguratorTrait.php index a38283b0e7..1dff67cf8d 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/ConfiguratorTrait.php +++ b/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/ConfiguratorTrait.php @@ -20,7 +20,7 @@ trait ConfiguratorTrait * * @return $this */ - final public function configurator($configurator) + final public function configurator($configurator): object { $this->definition->setConfigurator(static::processValue($configurator, true)); diff --git a/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/DecorateTrait.php b/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/DecorateTrait.php index 173ad15f06..2fe364a4c6 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/DecorateTrait.php +++ b/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/DecorateTrait.php @@ -26,7 +26,7 @@ trait DecorateTrait * * @throws InvalidArgumentException in case the decorated service id and the new decorated service id are equals */ - final public function decorate($id, $renamedId = null, $priority = 0) + final public function decorate($id, $renamedId = null, $priority = 0): object { $this->definition->setDecoratedService($id, $renamedId, $priority); diff --git a/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/DeprecateTrait.php b/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/DeprecateTrait.php index b14a6557ee..b4598a48d6 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/DeprecateTrait.php +++ b/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/DeprecateTrait.php @@ -24,7 +24,7 @@ trait DeprecateTrait * * @throws InvalidArgumentException when the message template is invalid */ - final public function deprecate($template = null) + final public function deprecate($template = null): object { $this->definition->setDeprecated(true, $template); diff --git a/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/FactoryTrait.php b/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/FactoryTrait.php index b83bee0f6d..feddb20833 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/FactoryTrait.php +++ b/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/FactoryTrait.php @@ -22,7 +22,7 @@ trait FactoryTrait * * @return $this */ - final public function factory($factory) + final public function factory($factory): object { if (\is_string($factory) && 1 === substr_count($factory, ':')) { $factoryParts = explode(':', $factory); diff --git a/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/FileTrait.php b/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/FileTrait.php index 895f5304c3..f55d7582ae 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/FileTrait.php +++ b/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/FileTrait.php @@ -20,7 +20,7 @@ trait FileTrait * * @return $this */ - final public function file($file) + final public function file($file): object { $this->definition->setFile($file); diff --git a/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/LazyTrait.php b/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/LazyTrait.php index d387dfb4b0..2f5163771a 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/LazyTrait.php +++ b/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/LazyTrait.php @@ -20,7 +20,7 @@ trait LazyTrait * * @return $this */ - final public function lazy($lazy = true) + final public function lazy($lazy = true): object { $this->definition->setLazy((bool) $lazy); if (\is_string($lazy)) { diff --git a/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/ParentTrait.php b/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/ParentTrait.php index 4eba03d7ee..00f2dfafd8 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/ParentTrait.php +++ b/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/ParentTrait.php @@ -23,7 +23,7 @@ trait ParentTrait * * @throws InvalidArgumentException when parent cannot be set */ - final public function parent(string $parent) + final public function parent(string $parent): object { if (!$this->allowParent) { throw new InvalidArgumentException(sprintf('A parent cannot be defined when either "_instanceof" or "_defaults" are also defined for service prototype "%s".', $this->id)); diff --git a/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/PropertyTrait.php b/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/PropertyTrait.php index 50c2ee8636..a587509f12 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/PropertyTrait.php +++ b/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/PropertyTrait.php @@ -18,7 +18,7 @@ trait PropertyTrait * * @return $this */ - final public function property(string $name, $value) + final public function property(string $name, $value): object { $this->definition->setProperty($name, static::processValue($value, true)); diff --git a/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/PublicTrait.php b/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/PublicTrait.php index 9886523c95..c3528b7807 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/PublicTrait.php +++ b/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/PublicTrait.php @@ -16,7 +16,7 @@ trait PublicTrait /** * @return $this */ - final public function public() + final public function public(): object { $this->definition->setPublic(true); @@ -26,7 +26,7 @@ trait PublicTrait /** * @return $this */ - final public function private() + final public function private(): object { $this->definition->setPublic(false); diff --git a/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/ShareTrait.php b/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/ShareTrait.php index 1c2f97b597..4e844bb757 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/ShareTrait.php +++ b/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/ShareTrait.php @@ -20,7 +20,7 @@ trait ShareTrait * * @return $this */ - final public function share($shared = true) + final public function share($shared = true): object { $this->definition->setShared($shared); diff --git a/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/SyntheticTrait.php b/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/SyntheticTrait.php index bf124f0a40..1ba4301fdf 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/SyntheticTrait.php +++ b/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/SyntheticTrait.php @@ -19,7 +19,7 @@ trait SyntheticTrait * * @return $this */ - final public function synthetic(bool $synthetic = true) + final public function synthetic(bool $synthetic = true): object { $this->definition->setSynthetic($synthetic); diff --git a/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/TagTrait.php b/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/TagTrait.php index d17339f88b..46493fcd07 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/TagTrait.php +++ b/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/TagTrait.php @@ -23,7 +23,7 @@ trait TagTrait * * @return $this */ - final public function tag($name, array $attributes = []) + final public function tag($name, array $attributes = []): object { if (!\is_string($name) || '' === $name) { throw new InvalidArgumentException(sprintf('The tag name for service "%s" must be a non-empty string.', $this->id)); diff --git a/src/Symfony/Component/DependencyInjection/ReverseContainer.php b/src/Symfony/Component/DependencyInjection/ReverseContainer.php index 076e624c2e..15e198c143 100644 --- a/src/Symfony/Component/DependencyInjection/ReverseContainer.php +++ b/src/Symfony/Component/DependencyInjection/ReverseContainer.php @@ -61,11 +61,9 @@ final class ReverseContainer } /** - * @return object - * * @throws ServiceNotFoundException When the service is not reversible */ - public function getService(string $id) + public function getService(string $id): object { if ($this->serviceContainer->has($id)) { return $this->serviceContainer->get($id); diff --git a/src/Symfony/Component/Dotenv/Dotenv.php b/src/Symfony/Component/Dotenv/Dotenv.php index 07ddcb111a..51652c7050 100644 --- a/src/Symfony/Component/Dotenv/Dotenv.php +++ b/src/Symfony/Component/Dotenv/Dotenv.php @@ -211,7 +211,7 @@ final class Dotenv } } - private function lexVarname() + private function lexVarname(): string { // var name + optional export if (!preg_match('/(export[ \t]++)?('.self::VARNAME_REGEX.')/A', $this->data, $matches, 0, $this->cursor)) { @@ -239,7 +239,7 @@ final class Dotenv return $matches[2]; } - private function lexValue() + private function lexValue(): string { if (preg_match('/[ \t]*+(?:#.*)?$/Am', $this->data, $matches, 0, $this->cursor)) { $this->moveCursor($matches[0]); @@ -334,7 +334,7 @@ final class Dotenv return $v; } - private function lexNestedExpression() + private function lexNestedExpression(): string { ++$this->cursor; $value = ''; @@ -467,7 +467,7 @@ final class Dotenv $this->lineno += substr_count($text, "\n"); } - private function createFormatException($message) + private function createFormatException($message): FormatException { return new FormatException($message, new FormatExceptionContext($this->data, $this->path, $this->lineno, $this->cursor)); } diff --git a/src/Symfony/Component/Dotenv/Exception/FormatException.php b/src/Symfony/Component/Dotenv/Exception/FormatException.php index f845d7bde1..adccc8c8d1 100644 --- a/src/Symfony/Component/Dotenv/Exception/FormatException.php +++ b/src/Symfony/Component/Dotenv/Exception/FormatException.php @@ -27,7 +27,7 @@ final class FormatException extends \LogicException implements ExceptionInterfac parent::__construct(sprintf("%s in \"%s\" at line %d.\n%s", $message, $context->getPath(), $context->getLineno(), $context->getDetails()), $code, $previous); } - public function getContext() + public function getContext(): FormatExceptionContext { return $this->context; } diff --git a/src/Symfony/Component/Dotenv/Exception/FormatExceptionContext.php b/src/Symfony/Component/Dotenv/Exception/FormatExceptionContext.php index c1d32d4a7e..96d902fc8f 100644 --- a/src/Symfony/Component/Dotenv/Exception/FormatExceptionContext.php +++ b/src/Symfony/Component/Dotenv/Exception/FormatExceptionContext.php @@ -29,17 +29,17 @@ final class FormatExceptionContext $this->cursor = $cursor; } - public function getPath() + public function getPath(): string { return $this->path; } - public function getLineno() + public function getLineno(): int { return $this->lineno; } - public function getDetails() + public function getDetails(): string { $before = str_replace("\n", '\n', substr($this->data, max(0, $this->cursor - 20), min(20, $this->cursor))); $after = str_replace("\n", '\n', substr($this->data, $this->cursor, 20)); diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeImmutableToDateTimeTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeImmutableToDateTimeTransformer.php index b0737393e4..9ecf7fc949 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeImmutableToDateTimeTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeImmutableToDateTimeTransformer.php @@ -26,11 +26,9 @@ final class DateTimeImmutableToDateTimeTransformer implements DataTransformerInt * * @param \DateTimeImmutable|null $value A DateTimeImmutable object * - * @return \DateTime|null A \DateTime object - * * @throws TransformationFailedException If the given value is not a \DateTimeImmutable */ - public function transform($value) + public function transform($value): ?\DateTime { if (null === $value) { return null; @@ -48,11 +46,9 @@ final class DateTimeImmutableToDateTimeTransformer implements DataTransformerInt * * @param \DateTime|null $value A DateTime object * - * @return \DateTimeImmutable|null A DateTimeImmutable object - * * @throws TransformationFailedException If the given value is not a \DateTime */ - public function reverseTransform($value) + public function reverseTransform($value): ?\DateTimeImmutable { if (null === $value) { return null; diff --git a/src/Symfony/Component/Form/Extension/DataCollector/FormDataCollector.php b/src/Symfony/Component/Form/Extension/DataCollector/FormDataCollector.php index 2e6c4fbef9..815c7a094e 100644 --- a/src/Symfony/Component/Form/Extension/DataCollector/FormDataCollector.php +++ b/src/Symfony/Component/Form/Extension/DataCollector/FormDataCollector.php @@ -218,7 +218,7 @@ class FormDataCollector extends DataCollector implements FormDataCollectorInterf /** * {@inheritdoc} */ - public function getName() + public function getName(): string { return 'form'; } @@ -226,7 +226,7 @@ class FormDataCollector extends DataCollector implements FormDataCollectorInterf /** * {@inheritdoc} */ - public function getData() + public function getData(): array { return $this->data; } @@ -250,7 +250,7 @@ class FormDataCollector extends DataCollector implements FormDataCollectorInterf /** * {@inheritdoc} */ - protected function getCasters() + protected function getCasters(): array { return parent::getCasters() + [ \Exception::class => function (\Exception $e, array $a, Stub $s) { diff --git a/src/Symfony/Component/HttpClient/NativeHttpClient.php b/src/Symfony/Component/HttpClient/NativeHttpClient.php index 55313b1ccc..c9ccb9037d 100644 --- a/src/Symfony/Component/HttpClient/NativeHttpClient.php +++ b/src/Symfony/Component/HttpClient/NativeHttpClient.php @@ -402,7 +402,7 @@ final class NativeHttpClient implements HttpClientInterface, LoggerAwareInterfac }; } - private static function configureHeadersAndProxy($context, string $host, array $requestHeaders, ?array $proxy, array $noProxy) + private static function configureHeadersAndProxy($context, string $host, array $requestHeaders, ?array $proxy, array $noProxy): bool { if (null === $proxy) { return stream_context_set_option($context, 'http', 'header', $requestHeaders); diff --git a/src/Symfony/Component/HttpFoundation/Response.php b/src/Symfony/Component/HttpFoundation/Response.php index fafc2364bc..4ce97e0908 100644 --- a/src/Symfony/Component/HttpFoundation/Response.php +++ b/src/Symfony/Component/HttpFoundation/Response.php @@ -418,7 +418,7 @@ class Response * * @final */ - public function setProtocolVersion(string $version) + public function setProtocolVersion(string $version): object { $this->version = $version; @@ -447,7 +447,7 @@ class Response * * @final */ - public function setStatusCode(int $code, $text = null) + public function setStatusCode(int $code, $text = null): object { $this->statusCode = $code; if ($this->isInvalid()) { @@ -488,7 +488,7 @@ class Response * * @final */ - public function setCharset(string $charset) + public function setCharset(string $charset): object { $this->charset = $charset; @@ -569,7 +569,7 @@ class Response * * @final */ - public function setPrivate() + public function setPrivate(): object { $this->headers->removeCacheControlDirective('public'); $this->headers->addCacheControlDirective('private'); @@ -586,7 +586,7 @@ class Response * * @final */ - public function setPublic() + public function setPublic(): object { $this->headers->addCacheControlDirective('public'); $this->headers->removeCacheControlDirective('private'); @@ -601,7 +601,7 @@ class Response * * @final */ - public function setImmutable(bool $immutable = true) + public function setImmutable(bool $immutable = true): object { if ($immutable) { $this->headers->addCacheControlDirective('immutable'); @@ -656,7 +656,7 @@ class Response * * @final */ - public function setDate(\DateTimeInterface $date) + public function setDate(\DateTimeInterface $date): object { if ($date instanceof \DateTime) { $date = \DateTimeImmutable::createFromMutable($date); @@ -721,7 +721,7 @@ class Response * * @final */ - public function setExpires(\DateTimeInterface $date = null) + public function setExpires(\DateTimeInterface $date = null): object { if (null === $date) { $this->headers->remove('Expires'); @@ -774,7 +774,7 @@ class Response * * @final */ - public function setMaxAge(int $value) + public function setMaxAge(int $value): object { $this->headers->addCacheControlDirective('max-age', $value); @@ -790,7 +790,7 @@ class Response * * @final */ - public function setSharedMaxAge(int $value) + public function setSharedMaxAge(int $value): object { $this->setPublic(); $this->headers->addCacheControlDirective('s-maxage', $value); @@ -824,7 +824,7 @@ class Response * * @final */ - public function setTtl(int $seconds) + public function setTtl(int $seconds): object { $this->setSharedMaxAge($this->getAge() + $seconds); @@ -840,7 +840,7 @@ class Response * * @final */ - public function setClientTtl(int $seconds) + public function setClientTtl(int $seconds): object { $this->setMaxAge($this->getAge() + $seconds); @@ -868,7 +868,7 @@ class Response * * @final */ - public function setLastModified(\DateTimeInterface $date = null) + public function setLastModified(\DateTimeInterface $date = null): object { if (null === $date) { $this->headers->remove('Last-Modified'); @@ -906,7 +906,7 @@ class Response * * @final */ - public function setEtag(string $etag = null, bool $weak = false) + public function setEtag(string $etag = null, bool $weak = false): object { if (null === $etag) { $this->headers->remove('Etag'); @@ -932,7 +932,7 @@ class Response * * @final */ - public function setCache(array $options) + public function setCache(array $options): object { if ($diff = array_diff(array_keys($options), ['etag', 'last_modified', 'max_age', 's_maxage', 'private', 'public', 'immutable'])) { throw new \InvalidArgumentException(sprintf('Response does not support the following options: "%s".', implode('", "', $diff))); @@ -989,7 +989,7 @@ class Response * * @final */ - public function setNotModified() + public function setNotModified(): object { $this->setStatusCode(304); $this->setContent(null); @@ -1041,7 +1041,7 @@ class Response * * @final */ - public function setVary($headers, bool $replace = true) + public function setVary($headers, bool $replace = true): object { $this->headers->set('Vary', $headers, $replace); diff --git a/src/Symfony/Component/HttpFoundation/Session/SessionBagProxy.php b/src/Symfony/Component/HttpFoundation/Session/SessionBagProxy.php index 3504bdfe7b..28b7a05ccc 100644 --- a/src/Symfony/Component/HttpFoundation/Session/SessionBagProxy.php +++ b/src/Symfony/Component/HttpFoundation/Session/SessionBagProxy.php @@ -29,20 +29,14 @@ final class SessionBagProxy implements SessionBagInterface $this->usageIndex = &$usageIndex; } - /** - * @return SessionBagInterface - */ - public function getBag() + public function getBag(): SessionBagInterface { ++$this->usageIndex; return $this->bag; } - /** - * @return bool - */ - public function isEmpty() + public function isEmpty(): bool { if (!isset($this->data[$this->bag->getStorageKey()])) { return true; @@ -55,7 +49,7 @@ final class SessionBagProxy implements SessionBagInterface /** * {@inheritdoc} */ - public function getName() + public function getName(): string { return $this->bag->getName(); } @@ -74,7 +68,7 @@ final class SessionBagProxy implements SessionBagInterface /** * {@inheritdoc} */ - public function getStorageKey() + public function getStorageKey(): string { return $this->bag->getStorageKey(); } diff --git a/src/Symfony/Component/HttpKernel/Bundle/Bundle.php b/src/Symfony/Component/HttpKernel/Bundle/Bundle.php index 26dea9b205..68699697d6 100644 --- a/src/Symfony/Component/HttpKernel/Bundle/Bundle.php +++ b/src/Symfony/Component/HttpKernel/Bundle/Bundle.php @@ -119,10 +119,8 @@ abstract class Bundle implements BundleInterface /** * Returns the bundle name (the class short name). - * - * @return string The Bundle name */ - final public function getName() + final public function getName(): string { if (null === $this->name) { $this->parseClassName(); diff --git a/src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerAggregate.php b/src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerAggregate.php index dd527708be..4a473021cf 100644 --- a/src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerAggregate.php +++ b/src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerAggregate.php @@ -114,7 +114,7 @@ class CacheWarmerAggregate implements CacheWarmerInterface * * @return bool always false */ - public function isOptional() + public function isOptional(): bool { return false; } diff --git a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver.php b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver.php index 86ceab2f26..08bc941127 100644 --- a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver.php +++ b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver.php @@ -43,7 +43,7 @@ final class ArgumentResolver implements ArgumentResolverInterface /** * {@inheritdoc} */ - public function getArguments(Request $request, $controller) + public function getArguments(Request $request, $controller): array { $arguments = []; diff --git a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/DefaultValueResolver.php b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/DefaultValueResolver.php index e58fd3ab2b..32a0e071d6 100644 --- a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/DefaultValueResolver.php +++ b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/DefaultValueResolver.php @@ -25,7 +25,7 @@ final class DefaultValueResolver implements ArgumentValueResolverInterface /** * {@inheritdoc} */ - public function supports(Request $request, ArgumentMetadata $argument) + public function supports(Request $request, ArgumentMetadata $argument): bool { return $argument->hasDefaultValue() || (null !== $argument->getType() && $argument->isNullable() && !$argument->isVariadic()); } @@ -33,7 +33,7 @@ final class DefaultValueResolver implements ArgumentValueResolverInterface /** * {@inheritdoc} */ - public function resolve(Request $request, ArgumentMetadata $argument) + public function resolve(Request $request, ArgumentMetadata $argument): iterable { yield $argument->hasDefaultValue() ? $argument->getDefaultValue() : null; } diff --git a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/NotTaggedControllerValueResolver.php b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/NotTaggedControllerValueResolver.php index 19e324dc24..b34e11b846 100644 --- a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/NotTaggedControllerValueResolver.php +++ b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/NotTaggedControllerValueResolver.php @@ -34,7 +34,7 @@ final class NotTaggedControllerValueResolver implements ArgumentValueResolverInt /** * {@inheritdoc} */ - public function supports(Request $request, ArgumentMetadata $argument) + public function supports(Request $request, ArgumentMetadata $argument): bool { $controller = $request->attributes->get('_controller'); diff --git a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/RequestAttributeValueResolver.php b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/RequestAttributeValueResolver.php index 05be372d84..c62d327b65 100644 --- a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/RequestAttributeValueResolver.php +++ b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/RequestAttributeValueResolver.php @@ -25,7 +25,7 @@ final class RequestAttributeValueResolver implements ArgumentValueResolverInterf /** * {@inheritdoc} */ - public function supports(Request $request, ArgumentMetadata $argument) + public function supports(Request $request, ArgumentMetadata $argument): bool { return !$argument->isVariadic() && $request->attributes->has($argument->getName()); } @@ -33,7 +33,7 @@ final class RequestAttributeValueResolver implements ArgumentValueResolverInterf /** * {@inheritdoc} */ - public function resolve(Request $request, ArgumentMetadata $argument) + public function resolve(Request $request, ArgumentMetadata $argument): iterable { yield $request->attributes->get($argument->getName()); } diff --git a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/RequestValueResolver.php b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/RequestValueResolver.php index 2a5060a612..75cbd97edb 100644 --- a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/RequestValueResolver.php +++ b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/RequestValueResolver.php @@ -25,7 +25,7 @@ final class RequestValueResolver implements ArgumentValueResolverInterface /** * {@inheritdoc} */ - public function supports(Request $request, ArgumentMetadata $argument) + public function supports(Request $request, ArgumentMetadata $argument): bool { return Request::class === $argument->getType() || is_subclass_of($argument->getType(), Request::class); } @@ -33,7 +33,7 @@ final class RequestValueResolver implements ArgumentValueResolverInterface /** * {@inheritdoc} */ - public function resolve(Request $request, ArgumentMetadata $argument) + public function resolve(Request $request, ArgumentMetadata $argument): iterable { yield $request; } diff --git a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/ServiceValueResolver.php b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/ServiceValueResolver.php index e7df546b66..4ffb8c99eb 100644 --- a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/ServiceValueResolver.php +++ b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/ServiceValueResolver.php @@ -34,7 +34,7 @@ final class ServiceValueResolver implements ArgumentValueResolverInterface /** * {@inheritdoc} */ - public function supports(Request $request, ArgumentMetadata $argument) + public function supports(Request $request, ArgumentMetadata $argument): bool { $controller = $request->attributes->get('_controller'); @@ -58,7 +58,7 @@ final class ServiceValueResolver implements ArgumentValueResolverInterface /** * {@inheritdoc} */ - public function resolve(Request $request, ArgumentMetadata $argument) + public function resolve(Request $request, ArgumentMetadata $argument): iterable { if (\is_array($controller = $request->attributes->get('_controller'))) { $controller = $controller[0].'::'.$controller[1]; diff --git a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/SessionValueResolver.php b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/SessionValueResolver.php index 276d65461c..a1e6b43159 100644 --- a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/SessionValueResolver.php +++ b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/SessionValueResolver.php @@ -26,7 +26,7 @@ final class SessionValueResolver implements ArgumentValueResolverInterface /** * {@inheritdoc} */ - public function supports(Request $request, ArgumentMetadata $argument) + public function supports(Request $request, ArgumentMetadata $argument): bool { if (!$request->hasSession()) { return false; @@ -43,7 +43,7 @@ final class SessionValueResolver implements ArgumentValueResolverInterface /** * {@inheritdoc} */ - public function resolve(Request $request, ArgumentMetadata $argument) + public function resolve(Request $request, ArgumentMetadata $argument): iterable { yield $request->getSession(); } diff --git a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/VariadicValueResolver.php b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/VariadicValueResolver.php index 7ee2d7af5c..1673a490cf 100644 --- a/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/VariadicValueResolver.php +++ b/src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/VariadicValueResolver.php @@ -25,7 +25,7 @@ final class VariadicValueResolver implements ArgumentValueResolverInterface /** * {@inheritdoc} */ - public function supports(Request $request, ArgumentMetadata $argument) + public function supports(Request $request, ArgumentMetadata $argument): bool { return $argument->isVariadic() && $request->attributes->has($argument->getName()); } @@ -33,7 +33,7 @@ final class VariadicValueResolver implements ArgumentValueResolverInterface /** * {@inheritdoc} */ - public function resolve(Request $request, ArgumentMetadata $argument) + public function resolve(Request $request, ArgumentMetadata $argument): iterable { $values = $request->attributes->get($argument->getName()); diff --git a/src/Symfony/Component/HttpKernel/ControllerMetadata/ArgumentMetadataFactory.php b/src/Symfony/Component/HttpKernel/ControllerMetadata/ArgumentMetadataFactory.php index 8ee9b0b938..1d6c5ccf53 100644 --- a/src/Symfony/Component/HttpKernel/ControllerMetadata/ArgumentMetadataFactory.php +++ b/src/Symfony/Component/HttpKernel/ControllerMetadata/ArgumentMetadataFactory.php @@ -21,7 +21,7 @@ final class ArgumentMetadataFactory implements ArgumentMetadataFactoryInterface /** * {@inheritdoc} */ - public function createArgumentMetadata($controller) + public function createArgumentMetadata($controller): array { $arguments = []; @@ -45,7 +45,7 @@ final class ArgumentMetadataFactory implements ArgumentMetadataFactoryInterface * * @param \ReflectionParameter $parameter * - * @return string|null + * @return string|null|void */ private function getType(\ReflectionParameter $parameter, \ReflectionFunctionAbstract $function) { diff --git a/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php index b154e50ae2..a6b38099aa 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php @@ -148,7 +148,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface /** * @internal */ - public function __sleep() + public function __sleep(): array { if (!$this->dataCount) { $this->data = []; @@ -180,12 +180,12 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface self::__construct($this->stopwatch, $fileLinkFormat, $charset); } - public function getDumpsCount() + public function getDumpsCount(): int { return $this->dataCount; } - public function getDumps($format, $maxDepthLimit = -1, $maxItemsPerDepth = -1) + public function getDumps($format, $maxDepthLimit = -1, $maxItemsPerDepth = -1): array { $data = fopen('php://memory', 'r+b'); @@ -212,7 +212,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface return $dumps; } - public function getName() + public function getName(): string { return 'dump'; } diff --git a/src/Symfony/Component/HttpKernel/Debug/FileLinkFormatter.php b/src/Symfony/Component/HttpKernel/Debug/FileLinkFormatter.php index 4b848692c0..e6d31516d7 100644 --- a/src/Symfony/Component/HttpKernel/Debug/FileLinkFormatter.php +++ b/src/Symfony/Component/HttpKernel/Debug/FileLinkFormatter.php @@ -76,7 +76,7 @@ class FileLinkFormatter /** * @internal */ - public static function generateUrlFormat(UrlGeneratorInterface $router, $routeName, $queryString) + public static function generateUrlFormat(UrlGeneratorInterface $router, $routeName, $queryString): ?string { try { return $router->generate($routeName).$queryString; diff --git a/src/Symfony/Component/HttpKernel/EventListener/AddRequestFormatsListener.php b/src/Symfony/Component/HttpKernel/EventListener/AddRequestFormatsListener.php index f3b868bdb4..9e896adb31 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/AddRequestFormatsListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/AddRequestFormatsListener.php @@ -45,7 +45,7 @@ class AddRequestFormatsListener implements EventSubscriberInterface /** * {@inheritdoc} */ - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [KernelEvents::REQUEST => ['onKernelRequest', 100]]; } diff --git a/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php b/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php index b091d63a67..dc454958f7 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php @@ -167,7 +167,7 @@ class DebugHandlersListener implements EventSubscriberInterface (new ExceptionListener($controller, $this->logger, $debug))->onKernelException($event); } - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { $events = [KernelEvents::REQUEST => ['configure', 2048]]; diff --git a/src/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php b/src/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php index 55ab67a025..3ea2838ac7 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php @@ -94,7 +94,7 @@ class ExceptionListener implements EventSubscriberInterface } } - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ KernelEvents::EXCEPTION => [ @@ -126,10 +126,8 @@ class ExceptionListener implements EventSubscriberInterface * * @param \Exception $exception The thrown exception * @param Request $request The original request - * - * @return Request The cloned request */ - protected function duplicateRequest(\Exception $exception, Request $request) + protected function duplicateRequest(\Exception $exception, Request $request): Request { $attributes = [ '_controller' => $this->controller, diff --git a/src/Symfony/Component/HttpKernel/EventListener/FragmentListener.php b/src/Symfony/Component/HttpKernel/EventListener/FragmentListener.php index c6247161c7..17a3b94fb7 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/FragmentListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/FragmentListener.php @@ -92,7 +92,7 @@ class FragmentListener implements EventSubscriberInterface throw new AccessDeniedHttpException(); } - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ KernelEvents::REQUEST => [['onKernelRequest', 48]], diff --git a/src/Symfony/Component/HttpKernel/EventListener/LocaleListener.php b/src/Symfony/Component/HttpKernel/EventListener/LocaleListener.php index 5519bf285a..3bad8f7b02 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/LocaleListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/LocaleListener.php @@ -79,7 +79,7 @@ class LocaleListener implements EventSubscriberInterface } } - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ KernelEvents::REQUEST => [ diff --git a/src/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php b/src/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php index c5846f4ea3..4ad8f1741e 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php @@ -119,7 +119,7 @@ class ProfilerListener implements EventSubscriberInterface $this->parents = new \SplObjectStorage(); } - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ KernelEvents::RESPONSE => ['onKernelResponse', -100], diff --git a/src/Symfony/Component/HttpKernel/EventListener/ResponseListener.php b/src/Symfony/Component/HttpKernel/EventListener/ResponseListener.php index e31fb4b2c5..d8292aec43 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/ResponseListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/ResponseListener.php @@ -49,7 +49,7 @@ class ResponseListener implements EventSubscriberInterface $response->prepare($event->getRequest()); } - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ KernelEvents::RESPONSE => 'onKernelResponse', diff --git a/src/Symfony/Component/HttpKernel/EventListener/RouterListener.php b/src/Symfony/Component/HttpKernel/EventListener/RouterListener.php index 563f71fac6..597ca3a53e 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/RouterListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/RouterListener.php @@ -157,7 +157,7 @@ class RouterListener implements EventSubscriberInterface } } - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ KernelEvents::REQUEST => [['onKernelRequest', 32]], @@ -166,7 +166,7 @@ class RouterListener implements EventSubscriberInterface ]; } - private function createWelcomeResponse() + private function createWelcomeResponse(): Response { $version = Kernel::VERSION; $baseDir = realpath($this->projectDir).\DIRECTORY_SEPARATOR; diff --git a/src/Symfony/Component/HttpKernel/EventListener/StreamedResponseListener.php b/src/Symfony/Component/HttpKernel/EventListener/StreamedResponseListener.php index 18ed56a57a..730ee5453f 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/StreamedResponseListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/StreamedResponseListener.php @@ -42,7 +42,7 @@ class StreamedResponseListener implements EventSubscriberInterface } } - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ KernelEvents::RESPONSE => ['onKernelResponse', -1024], diff --git a/src/Symfony/Component/HttpKernel/EventListener/SurrogateListener.php b/src/Symfony/Component/HttpKernel/EventListener/SurrogateListener.php index 551754c59c..2ef4af7aa3 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/SurrogateListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/SurrogateListener.php @@ -58,7 +58,7 @@ class SurrogateListener implements EventSubscriberInterface $surrogate->addSurrogateControl($event->getResponse()); } - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ KernelEvents::RESPONSE => 'onKernelResponse', diff --git a/src/Symfony/Component/HttpKernel/EventListener/ValidateRequestListener.php b/src/Symfony/Component/HttpKernel/EventListener/ValidateRequestListener.php index 6158c01efb..1f0c79822d 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/ValidateRequestListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/ValidateRequestListener.php @@ -44,7 +44,7 @@ class ValidateRequestListener implements EventSubscriberInterface /** * {@inheritdoc} */ - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ KernelEvents::REQUEST => [ diff --git a/src/Symfony/Component/Intl/Countries.php b/src/Symfony/Component/Intl/Countries.php index 81e17a5d59..5f2642aa08 100644 --- a/src/Symfony/Component/Intl/Countries.php +++ b/src/Symfony/Component/Intl/Countries.php @@ -60,7 +60,7 @@ final class Countries extends ResourceBundle /** * @return string[] */ - public static function getNames($displayLocale = null) + public static function getNames($displayLocale = null): array { return self::asort(self::readEntry(['Names'], $displayLocale), $displayLocale); } diff --git a/src/Symfony/Component/Intl/Intl.php b/src/Symfony/Component/Intl/Intl.php index e4c73273b3..52aba34949 100644 --- a/src/Symfony/Component/Intl/Intl.php +++ b/src/Symfony/Component/Intl/Intl.php @@ -69,7 +69,7 @@ final class Intl * * @return bool Returns true if the intl extension is installed, false otherwise */ - public static function isExtensionLoaded() + public static function isExtensionLoaded(): bool { return class_exists('\ResourceBundle'); } @@ -79,7 +79,7 @@ final class Intl * * @return string|null The ICU version or NULL if it could not be determined */ - public static function getIcuVersion() + public static function getIcuVersion(): ?string { if (false === self::$icuVersion) { if (!self::isExtensionLoaded()) { @@ -109,7 +109,7 @@ final class Intl * * @return string The version of the installed ICU data */ - public static function getIcuDataVersion() + public static function getIcuDataVersion(): string { if (false === self::$icuDataVersion) { self::$icuDataVersion = trim(file_get_contents(self::getDataDirectory().'/version.txt')); @@ -123,7 +123,7 @@ final class Intl * * @return string The ICU version of the stub classes */ - public static function getIcuStubVersion() + public static function getIcuStubVersion(): string { return '64.2'; } @@ -133,7 +133,7 @@ final class Intl * * @return string The absolute path to the data directory */ - public static function getDataDirectory() + public static function getDataDirectory(): string { return __DIR__.'/Resources/data'; } diff --git a/src/Symfony/Component/Intl/Locales.php b/src/Symfony/Component/Intl/Locales.php index 1f434ee267..aee16beb16 100644 --- a/src/Symfony/Component/Intl/Locales.php +++ b/src/Symfony/Component/Intl/Locales.php @@ -67,7 +67,7 @@ final class Locales extends ResourceBundle /** * @return string[] */ - public static function getNames($displayLocale = null) + public static function getNames($displayLocale = null): array { return self::asort(self::readEntry(['Names'], $displayLocale), $displayLocale); } diff --git a/src/Symfony/Component/Intl/Scripts.php b/src/Symfony/Component/Intl/Scripts.php index bf26969c06..943ef8b469 100644 --- a/src/Symfony/Component/Intl/Scripts.php +++ b/src/Symfony/Component/Intl/Scripts.php @@ -51,7 +51,7 @@ final class Scripts extends ResourceBundle /** * @return string[] */ - public static function getNames($displayLocale = null) + public static function getNames($displayLocale = null): array { return self::asort(self::readEntry(['Names'], $displayLocale), $displayLocale); } diff --git a/src/Symfony/Component/Intl/Util/GitRepository.php b/src/Symfony/Component/Intl/Util/GitRepository.php index d6574601b4..2c22ca7ba2 100644 --- a/src/Symfony/Component/Intl/Util/GitRepository.php +++ b/src/Symfony/Component/Intl/Util/GitRepository.php @@ -44,7 +44,7 @@ final class GitRepository return new self(realpath($targetDir)); } - public function getPath() + public function getPath(): string { return $this->path; } @@ -64,7 +64,7 @@ final class GitRepository return $this->getLastLine($this->execInPath('git log -1 --format="%an"')); } - public function getLastAuthoredDate() + public function getLastAuthoredDate(): \DateTime { return new \DateTime($this->getLastLine($this->execInPath('git log -1 --format="%ai"'))); } diff --git a/src/Symfony/Component/Ldap/Adapter/ExtLdap/ConnectionOptions.php b/src/Symfony/Component/Ldap/Adapter/ExtLdap/ConnectionOptions.php index 304ba7801b..7a4225fb42 100644 --- a/src/Symfony/Component/Ldap/Adapter/ExtLdap/ConnectionOptions.php +++ b/src/Symfony/Component/Ldap/Adapter/ExtLdap/ConnectionOptions.php @@ -45,7 +45,7 @@ final class ConnectionOptions const X_SASL_AUTHCID = 0x6102; const X_SASL_AUTHZID = 0x6103; - public static function getOptionName($name) + public static function getOptionName($name): string { return sprintf('%s::%s', self::class, strtoupper($name)); } @@ -56,11 +56,9 @@ final class ConnectionOptions * * @param string $name * - * @return int - * * @throws LdapException */ - public static function getOption($name) + public static function getOption($name): int { // Convert $constantName = self::getOptionName($name); @@ -72,7 +70,7 @@ final class ConnectionOptions return \constant($constantName); } - public static function isOption($name) + public static function isOption($name): bool { return \defined(self::getOptionName($name)); } diff --git a/src/Symfony/Component/Ldap/Ldap.php b/src/Symfony/Component/Ldap/Ldap.php index 615dbcfda3..16ba165c84 100644 --- a/src/Symfony/Component/Ldap/Ldap.php +++ b/src/Symfony/Component/Ldap/Ldap.php @@ -12,6 +12,8 @@ namespace Symfony\Component\Ldap; use Symfony\Component\Ldap\Adapter\AdapterInterface; +use Symfony\Component\Ldap\Adapter\EntryManagerInterface; +use Symfony\Component\Ldap\Adapter\QueryInterface; use Symfony\Component\Ldap\Exception\DriverNotFoundException; /** @@ -41,7 +43,7 @@ final class Ldap implements LdapInterface /** * {@inheritdoc} */ - public function query($dn, $query, array $options = []) + public function query($dn, $query, array $options = []): ?QueryInterface { return $this->adapter->createQuery($dn, $query, $options); } @@ -49,7 +51,7 @@ final class Ldap implements LdapInterface /** * {@inheritdoc} */ - public function getEntryManager() + public function getEntryManager(): ?EntryManagerInterface { return $this->adapter->getEntryManager(); } @@ -57,7 +59,7 @@ final class Ldap implements LdapInterface /** * {@inheritdoc} */ - public function escape($subject, $ignore = '', $flags = 0) + public function escape($subject, $ignore = '', $flags = 0): ?string { return $this->adapter->escape($subject, $ignore, $flags); } diff --git a/src/Symfony/Component/Lock/Key.php b/src/Symfony/Component/Lock/Key.php index e20fbd9c80..c53892ab6b 100644 --- a/src/Symfony/Component/Lock/Key.php +++ b/src/Symfony/Component/Lock/Key.php @@ -27,7 +27,7 @@ final class Key $this->resource = $resource; } - public function __toString() + public function __toString(): string { return $this->resource; } @@ -74,15 +74,12 @@ final class Key * * @return float|null Remaining lifetime in seconds. Null when the key won't expire. */ - public function getRemainingLifetime() + public function getRemainingLifetime(): ?float { return null === $this->expiringTime ? null : $this->expiringTime - microtime(true); } - /** - * @return bool - */ - public function isExpired() + public function isExpired(): bool { return null !== $this->expiringTime && $this->expiringTime <= microtime(true); } diff --git a/src/Symfony/Component/Lock/Lock.php b/src/Symfony/Component/Lock/Lock.php index 97117a8204..af9f2af458 100644 --- a/src/Symfony/Component/Lock/Lock.php +++ b/src/Symfony/Component/Lock/Lock.php @@ -66,7 +66,7 @@ final class Lock implements LockInterface, LoggerAwareInterface /** * {@inheritdoc} */ - public function acquire($blocking = false) + public function acquire($blocking = false): ?bool { try { if ($blocking) { @@ -169,7 +169,7 @@ final class Lock implements LockInterface, LoggerAwareInterface /** * {@inheritdoc} */ - public function isExpired() + public function isExpired(): bool { return $this->key->isExpired(); } diff --git a/src/Symfony/Component/Messenger/Envelope.php b/src/Symfony/Component/Messenger/Envelope.php index be012fba94..162e8b8033 100644 --- a/src/Symfony/Component/Messenger/Envelope.php +++ b/src/Symfony/Component/Messenger/Envelope.php @@ -116,7 +116,7 @@ final class Envelope /** * @return object The original message contained in the envelope */ - public function getMessage() + public function getMessage(): object { return $this->message; } diff --git a/src/Symfony/Component/Messenger/Handler/HandlerDescriptor.php b/src/Symfony/Component/Messenger/Handler/HandlerDescriptor.php index e02d95ed0f..3841e2220a 100644 --- a/src/Symfony/Component/Messenger/Handler/HandlerDescriptor.php +++ b/src/Symfony/Component/Messenger/Handler/HandlerDescriptor.php @@ -51,7 +51,7 @@ final class HandlerDescriptor return $this->options[$option] ?? null; } - private function callableName(callable $handler) + private function callableName(callable $handler): string { if (\is_array($handler)) { if (\is_object($handler[0])) { diff --git a/src/Symfony/Component/Messenger/Transport/AmqpExt/Connection.php b/src/Symfony/Component/Messenger/Transport/AmqpExt/Connection.php index 51ef98dd31..44b2c26192 100644 --- a/src/Symfony/Component/Messenger/Transport/AmqpExt/Connection.php +++ b/src/Symfony/Component/Messenger/Transport/AmqpExt/Connection.php @@ -270,7 +270,7 @@ class Connection * which is the original exchange, resulting on it being put back into * the original queue. */ - private function createDelayQueue(int $delay, ?string $routingKey) + private function createDelayQueue(int $delay, ?string $routingKey): \AMQPQueue { $queue = $this->amqpFactory->createQueue($this->channel()); $queue->setName(str_replace( diff --git a/src/Symfony/Component/Messenger/Transport/Doctrine/Connection.php b/src/Symfony/Component/Messenger/Transport/Doctrine/Connection.php index bd528b5b43..1dcb8dce72 100644 --- a/src/Symfony/Component/Messenger/Transport/Doctrine/Connection.php +++ b/src/Symfony/Component/Messenger/Transport/Doctrine/Connection.php @@ -65,7 +65,7 @@ class Connection return $this->configuration; } - public static function buildConfiguration($dsn, array $options = []) + public static function buildConfiguration($dsn, array $options = []): array { if (false === $components = parse_url($dsn)) { throw new InvalidArgumentException(sprintf('The given Doctrine Messenger DSN "%s" is invalid.', $dsn)); @@ -328,7 +328,7 @@ class Connection return $schema; } - public static function formatDateTime(\DateTimeInterface $dateTime) + public static function formatDateTime(\DateTimeInterface $dateTime): string { return $dateTime->format('Y-m-d\TH:i:s'); } diff --git a/src/Symfony/Component/Mime/Header/DateHeader.php b/src/Symfony/Component/Mime/Header/DateHeader.php index 1e1a979569..b6964406d3 100644 --- a/src/Symfony/Component/Mime/Header/DateHeader.php +++ b/src/Symfony/Component/Mime/Header/DateHeader.php @@ -37,10 +37,7 @@ final class DateHeader extends AbstractHeader $this->setDateTime($body); } - /** - * @return \DateTimeImmutable - */ - public function getBody() + public function getBody(): \DateTimeImmutable { return $this->getDateTime(); } diff --git a/src/Symfony/Component/Mime/Header/Headers.php b/src/Symfony/Component/Mime/Header/Headers.php index c0e45e0d0a..94c5ac818e 100644 --- a/src/Symfony/Component/Mime/Header/Headers.php +++ b/src/Symfony/Component/Mime/Header/Headers.php @@ -66,7 +66,7 @@ final class Headers * * @return $this */ - public function addMailboxListHeader(string $name, array $addresses) + public function addMailboxListHeader(string $name, array $addresses): object { return $this->add(new MailboxListHeader($name, Address::createArray($addresses))); } @@ -76,7 +76,7 @@ final class Headers * * @return $this */ - public function addMailboxHeader(string $name, $address) + public function addMailboxHeader(string $name, $address): object { return $this->add(new MailboxHeader($name, Address::create($address))); } @@ -86,7 +86,7 @@ final class Headers * * @return $this */ - public function addIdHeader(string $name, $ids) + public function addIdHeader(string $name, $ids): object { return $this->add(new IdentificationHeader($name, $ids)); } @@ -96,7 +96,7 @@ final class Headers * * @return $this */ - public function addPathHeader(string $name, $path) + public function addPathHeader(string $name, $path): object { return $this->add(new PathHeader($name, $path instanceof Address ? $path : new Address($path))); } @@ -104,7 +104,7 @@ final class Headers /** * @return $this */ - public function addDateHeader(string $name, \DateTimeInterface $dateTime) + public function addDateHeader(string $name, \DateTimeInterface $dateTime): object { return $this->add(new DateHeader($name, $dateTime)); } @@ -112,7 +112,7 @@ final class Headers /** * @return $this */ - public function addTextHeader(string $name, string $value) + public function addTextHeader(string $name, string $value): object { return $this->add(new UnstructuredHeader($name, $value)); } @@ -120,7 +120,7 @@ final class Headers /** * @return $this */ - public function addParameterizedHeader(string $name, string $value, array $params = []) + public function addParameterizedHeader(string $name, string $value, array $params = []): object { return $this->add(new ParameterizedHeader($name, $value, $params)); } @@ -133,7 +133,7 @@ final class Headers /** * @return $this */ - public function add(HeaderInterface $header) + public function add(HeaderInterface $header): object { static $map = [ 'date' => DateHeader::class, diff --git a/src/Symfony/Component/Mime/Header/IdentificationHeader.php b/src/Symfony/Component/Mime/Header/IdentificationHeader.php index 0695b688da..eedc34ac8e 100644 --- a/src/Symfony/Component/Mime/Header/IdentificationHeader.php +++ b/src/Symfony/Component/Mime/Header/IdentificationHeader.php @@ -46,10 +46,7 @@ final class IdentificationHeader extends AbstractHeader $this->setId($body); } - /** - * @return array - */ - public function getBody() + public function getBody(): array { return $this->getIds(); } diff --git a/src/Symfony/Component/Mime/Header/MailboxHeader.php b/src/Symfony/Component/Mime/Header/MailboxHeader.php index c4f48f3e48..96a3b162f6 100644 --- a/src/Symfony/Component/Mime/Header/MailboxHeader.php +++ b/src/Symfony/Component/Mime/Header/MailboxHeader.php @@ -45,10 +45,8 @@ final class MailboxHeader extends AbstractHeader /** * @throws RfcComplianceException - * - * @return Address */ - public function getBody() + public function getBody(): Address { return $this->getAddress(); } diff --git a/src/Symfony/Component/Mime/Header/MailboxListHeader.php b/src/Symfony/Component/Mime/Header/MailboxListHeader.php index 51af2da87c..8d82cdee54 100644 --- a/src/Symfony/Component/Mime/Header/MailboxListHeader.php +++ b/src/Symfony/Component/Mime/Header/MailboxListHeader.php @@ -51,7 +51,7 @@ final class MailboxListHeader extends AbstractHeader * * @return (NamedAddress|Address)[] */ - public function getBody() + public function getBody(): array { return $this->getAddresses(); } diff --git a/src/Symfony/Component/Mime/Header/PathHeader.php b/src/Symfony/Component/Mime/Header/PathHeader.php index 6d16500a18..0ac61aa8eb 100644 --- a/src/Symfony/Component/Mime/Header/PathHeader.php +++ b/src/Symfony/Component/Mime/Header/PathHeader.php @@ -42,10 +42,7 @@ final class PathHeader extends AbstractHeader $this->setAddress($body); } - /** - * @return Address - */ - public function getBody() + public function getBody(): Address { return $this->getAddress(); } diff --git a/src/Symfony/Component/Mime/RawMessage.php b/src/Symfony/Component/Mime/RawMessage.php index 16b090c954..f03d828342 100644 --- a/src/Symfony/Component/Mime/RawMessage.php +++ b/src/Symfony/Component/Mime/RawMessage.php @@ -56,7 +56,7 @@ class RawMessage implements \Serializable /** * @internal */ - final public function serialize() + final public function serialize(): string { return serialize($this->__serialize()); } diff --git a/src/Symfony/Component/Process/Process.php b/src/Symfony/Component/Process/Process.php index 3926983a38..9a41864564 100644 --- a/src/Symfony/Component/Process/Process.php +++ b/src/Symfony/Component/Process/Process.php @@ -246,7 +246,7 @@ class Process implements \IteratorAggregate * * @final */ - public function mustRun(callable $callback = null, array $env = []) + public function mustRun(callable $callback = null, array $env = []): object { if (0 !== $this->run($callback, $env)) { throw new ProcessFailedException($this); @@ -367,7 +367,7 @@ class Process implements \IteratorAggregate * * @final */ - public function restart(callable $callback = null, array $env = []) + public function restart(callable $callback = null, array $env = []): object { if ($this->isRunning()) { throw new RuntimeException('Process is already running'); diff --git a/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php b/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php index c56dbdc2cb..3b0c01a2d9 100644 --- a/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php +++ b/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php @@ -156,7 +156,7 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp /** * {@inheritdoc} */ - public function isReadable($class, $property, array $context = []) + public function isReadable($class, $property, array $context = []): bool { if ($this->isAllowedProperty($class, $property)) { return true; @@ -170,7 +170,7 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp /** * {@inheritdoc} */ - public function isWritable($class, $property, array $context = []) + public function isWritable($class, $property, array $context = []): bool { if ($this->isAllowedProperty($class, $property)) { return true; @@ -292,7 +292,7 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp return null; } - private function extractFromDefaultValue(string $class, string $property) + private function extractFromDefaultValue(string $class, string $property): ?array { try { $reflectionClass = new \ReflectionClass($class); diff --git a/src/Symfony/Component/Routing/CompiledRoute.php b/src/Symfony/Component/Routing/CompiledRoute.php index d46a4de632..9ffd1b5391 100644 --- a/src/Symfony/Component/Routing/CompiledRoute.php +++ b/src/Symfony/Component/Routing/CompiledRoute.php @@ -66,7 +66,7 @@ class CompiledRoute implements \Serializable /** * @internal */ - final public function serialize() + final public function serialize(): string { return serialize($this->__serialize()); } diff --git a/src/Symfony/Component/Routing/Loader/Configurator/CollectionConfigurator.php b/src/Symfony/Component/Routing/Loader/Configurator/CollectionConfigurator.php index e1de75e01d..a4663b5ab3 100644 --- a/src/Symfony/Component/Routing/Loader/Configurator/CollectionConfigurator.php +++ b/src/Symfony/Component/Routing/Loader/Configurator/CollectionConfigurator.php @@ -47,10 +47,8 @@ class CollectionConfigurator /** * Creates a sub-collection. - * - * @return self */ - final public function collection($name = '') + final public function collection($name = ''): self { return new self($this->collection, $this->name.$name, $this, $this->prefixes); } @@ -62,7 +60,7 @@ class CollectionConfigurator * * @return $this */ - final public function prefix($prefix) + final public function prefix($prefix): object { if (\is_array($prefix)) { if (null === $this->parentPrefixes) { diff --git a/src/Symfony/Component/Routing/Loader/Configurator/ImportConfigurator.php b/src/Symfony/Component/Routing/Loader/Configurator/ImportConfigurator.php index 92e7efde46..b351c5364e 100644 --- a/src/Symfony/Component/Routing/Loader/Configurator/ImportConfigurator.php +++ b/src/Symfony/Component/Routing/Loader/Configurator/ImportConfigurator.php @@ -41,7 +41,7 @@ class ImportConfigurator * * @return $this */ - final public function prefix($prefix, bool $trailingSlashOnRoot = true) + final public function prefix($prefix, bool $trailingSlashOnRoot = true): object { if (!\is_array($prefix)) { $this->route->addPrefix($prefix); @@ -84,7 +84,7 @@ class ImportConfigurator * * @return $this */ - final public function namePrefix(string $namePrefix) + final public function namePrefix(string $namePrefix): object { $this->route->addNamePrefix($namePrefix); diff --git a/src/Symfony/Component/Routing/Loader/Configurator/RoutingConfigurator.php b/src/Symfony/Component/Routing/Loader/Configurator/RoutingConfigurator.php index a315cfb4ad..f9c347e81a 100644 --- a/src/Symfony/Component/Routing/Loader/Configurator/RoutingConfigurator.php +++ b/src/Symfony/Component/Routing/Loader/Configurator/RoutingConfigurator.php @@ -33,10 +33,7 @@ class RoutingConfigurator $this->file = $file; } - /** - * @return ImportConfigurator - */ - final public function import($resource, $type = null, $ignoreErrors = false) + final public function import($resource, $type = null, $ignoreErrors = false): ImportConfigurator { $this->loader->setCurrentDir(\dirname($this->path)); $imported = $this->loader->import($resource, $type, $ignoreErrors, $this->file); @@ -52,10 +49,7 @@ class RoutingConfigurator return new ImportConfigurator($this->collection, $mergedCollection); } - /** - * @return CollectionConfigurator - */ - final public function collection($name = '') + final public function collection($name = ''): CollectionConfigurator { return new CollectionConfigurator($this->collection, $name); } diff --git a/src/Symfony/Component/Routing/Loader/Configurator/Traits/RouteTrait.php b/src/Symfony/Component/Routing/Loader/Configurator/Traits/RouteTrait.php index 92c4d2ffdc..aebfa9388f 100644 --- a/src/Symfony/Component/Routing/Loader/Configurator/Traits/RouteTrait.php +++ b/src/Symfony/Component/Routing/Loader/Configurator/Traits/RouteTrait.php @@ -26,7 +26,7 @@ trait RouteTrait * * @return $this */ - final public function defaults(array $defaults) + final public function defaults(array $defaults): object { $this->route->addDefaults($defaults); @@ -38,7 +38,7 @@ trait RouteTrait * * @return $this */ - final public function requirements(array $requirements) + final public function requirements(array $requirements): object { $this->route->addRequirements($requirements); @@ -50,7 +50,7 @@ trait RouteTrait * * @return $this */ - final public function options(array $options) + final public function options(array $options): object { $this->route->addOptions($options); @@ -62,7 +62,7 @@ trait RouteTrait * * @return $this */ - final public function utf8(bool $utf8 = true) + final public function utf8(bool $utf8 = true): object { $this->route->addOptions(['utf8' => $utf8]); @@ -74,7 +74,7 @@ trait RouteTrait * * @return $this */ - final public function condition(string $condition) + final public function condition(string $condition): object { $this->route->setCondition($condition); @@ -86,7 +86,7 @@ trait RouteTrait * * @return $this */ - final public function host(string $pattern) + final public function host(string $pattern): object { $this->route->setHost($pattern); @@ -101,7 +101,7 @@ trait RouteTrait * * @return $this */ - final public function schemes(array $schemes) + final public function schemes(array $schemes): object { $this->route->setSchemes($schemes); @@ -116,7 +116,7 @@ trait RouteTrait * * @return $this */ - final public function methods(array $methods) + final public function methods(array $methods): object { $this->route->setMethods($methods); @@ -130,7 +130,7 @@ trait RouteTrait * * @return $this */ - final public function controller($controller) + final public function controller($controller): object { $this->route->addDefaults(['_controller' => $controller]); @@ -142,7 +142,7 @@ trait RouteTrait * * @return $this */ - final public function locale(string $locale) + final public function locale(string $locale): object { $this->route->addDefaults(['_locale' => $locale]); @@ -154,7 +154,7 @@ trait RouteTrait * * @return $this */ - final public function format(string $format) + final public function format(string $format): object { $this->route->addDefaults(['_format' => $format]); diff --git a/src/Symfony/Component/Routing/Route.php b/src/Symfony/Component/Routing/Route.php index 8fc95410d0..a4e7787228 100644 --- a/src/Symfony/Component/Routing/Route.php +++ b/src/Symfony/Component/Routing/Route.php @@ -80,7 +80,7 @@ class Route implements \Serializable /** * @internal */ - final public function serialize() + final public function serialize(): string { return serialize($this->__serialize()); } diff --git a/src/Symfony/Component/Security/Core/Authentication/RememberMe/PersistentToken.php b/src/Symfony/Component/Security/Core/Authentication/RememberMe/PersistentToken.php index 7c12706e3c..1f0e485c50 100644 --- a/src/Symfony/Component/Security/Core/Authentication/RememberMe/PersistentToken.php +++ b/src/Symfony/Component/Security/Core/Authentication/RememberMe/PersistentToken.php @@ -49,7 +49,7 @@ final class PersistentToken implements PersistentTokenInterface /** * {@inheritdoc} */ - public function getClass() + public function getClass(): string { return $this->class; } @@ -57,7 +57,7 @@ final class PersistentToken implements PersistentTokenInterface /** * {@inheritdoc} */ - public function getUsername() + public function getUsername(): string { return $this->username; } @@ -65,7 +65,7 @@ final class PersistentToken implements PersistentTokenInterface /** * {@inheritdoc} */ - public function getSeries() + public function getSeries(): string { return $this->series; } @@ -73,7 +73,7 @@ final class PersistentToken implements PersistentTokenInterface /** * {@inheritdoc} */ - public function getTokenValue() + public function getTokenValue(): string { return $this->tokenValue; } @@ -81,7 +81,7 @@ final class PersistentToken implements PersistentTokenInterface /** * {@inheritdoc} */ - public function getLastUsed() + public function getLastUsed(): \DateTime { return $this->lastUsed; } diff --git a/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php b/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php index 5e92fa4900..1e9dbe82df 100644 --- a/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php +++ b/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php @@ -244,7 +244,7 @@ abstract class AbstractToken implements TokenInterface /** * @internal */ - final public function serialize() + final public function serialize(): string { return serialize($this->__serialize()); } diff --git a/src/Symfony/Component/Security/Core/Authorization/AuthorizationChecker.php b/src/Symfony/Component/Security/Core/Authorization/AuthorizationChecker.php index db30095743..3200e991df 100644 --- a/src/Symfony/Component/Security/Core/Authorization/AuthorizationChecker.php +++ b/src/Symfony/Component/Security/Core/Authorization/AuthorizationChecker.php @@ -43,7 +43,7 @@ class AuthorizationChecker implements AuthorizationCheckerInterface * * @throws AuthenticationCredentialsNotFoundException when the token storage has no authentication token */ - final public function isGranted($attributes, $subject = null) + final public function isGranted($attributes, $subject = null): bool { if (null === ($token = $this->tokenStorage->getToken())) { throw new AuthenticationCredentialsNotFoundException('The token storage contains no authentication token. One possible reason may be that there is no firewall configured for this URL.'); diff --git a/src/Symfony/Component/Security/Core/Encoder/MigratingPasswordEncoder.php b/src/Symfony/Component/Security/Core/Encoder/MigratingPasswordEncoder.php index 77e6726808..2c8a6f72ce 100644 --- a/src/Symfony/Component/Security/Core/Encoder/MigratingPasswordEncoder.php +++ b/src/Symfony/Component/Security/Core/Encoder/MigratingPasswordEncoder.php @@ -34,7 +34,7 @@ final class MigratingPasswordEncoder extends BasePasswordEncoder implements Self /** * {@inheritdoc} */ - public function encodePassword($raw, $salt) + public function encodePassword($raw, $salt): string { return $this->bestEncoder->encodePassword($raw, $salt); } @@ -42,7 +42,7 @@ final class MigratingPasswordEncoder extends BasePasswordEncoder implements Self /** * {@inheritdoc} */ - public function isPasswordValid($encoded, $raw, $salt) + public function isPasswordValid($encoded, $raw, $salt): bool { if ($this->bestEncoder->isPasswordValid($encoded, $raw, $salt)) { return true; diff --git a/src/Symfony/Component/Security/Core/Encoder/NativePasswordEncoder.php b/src/Symfony/Component/Security/Core/Encoder/NativePasswordEncoder.php index a05eb288e5..b20bf4f876 100644 --- a/src/Symfony/Component/Security/Core/Encoder/NativePasswordEncoder.php +++ b/src/Symfony/Component/Security/Core/Encoder/NativePasswordEncoder.php @@ -78,7 +78,7 @@ final class NativePasswordEncoder implements PasswordEncoderInterface, SelfSalti /** * {@inheritdoc} */ - public function isPasswordValid($encoded, $raw, $salt) + public function isPasswordValid($encoded, $raw, $salt): bool { if (72 < \strlen($raw) && 0 === strpos($encoded, '$2')) { // BCrypt encodes only the first 72 chars diff --git a/src/Symfony/Component/Security/Core/Encoder/SodiumPasswordEncoder.php b/src/Symfony/Component/Security/Core/Encoder/SodiumPasswordEncoder.php index 82cb1e17dd..4630aa3b03 100644 --- a/src/Symfony/Component/Security/Core/Encoder/SodiumPasswordEncoder.php +++ b/src/Symfony/Component/Security/Core/Encoder/SodiumPasswordEncoder.php @@ -58,7 +58,7 @@ final class SodiumPasswordEncoder implements PasswordEncoderInterface, SelfSalti /** * {@inheritdoc} */ - public function encodePassword($raw, $salt) + public function encodePassword($raw, $salt): string { if (\strlen($raw) > self::MAX_PASSWORD_LENGTH) { throw new BadCredentialsException('Invalid password.'); @@ -78,7 +78,7 @@ final class SodiumPasswordEncoder implements PasswordEncoderInterface, SelfSalti /** * {@inheritdoc} */ - public function isPasswordValid($encoded, $raw, $salt) + public function isPasswordValid($encoded, $raw, $salt): bool { if (\strlen($raw) > self::MAX_PASSWORD_LENGTH) { return false; diff --git a/src/Symfony/Component/Security/Core/Security.php b/src/Symfony/Component/Security/Core/Security.php index 4ba8cefef9..90805de9ee 100644 --- a/src/Symfony/Component/Security/Core/Security.php +++ b/src/Symfony/Component/Security/Core/Security.php @@ -34,10 +34,7 @@ class Security $this->container = $container; } - /** - * @return UserInterface|null - */ - public function getUser() + public function getUser(): ?UserInterface { if (!$token = $this->getToken()) { return null; @@ -60,19 +57,14 @@ class Security * * @param mixed $attributes * @param mixed $subject - * - * @return bool */ - public function isGranted($attributes, $subject = null) + public function isGranted($attributes, $subject = null): bool { return $this->container->get('security.authorization_checker') ->isGranted($attributes, $subject); } - /** - * @return TokenInterface|null - */ - public function getToken() + public function getToken(): ?TokenInterface { return $this->container->get('security.token_storage')->getToken(); } diff --git a/src/Symfony/Component/Security/Core/User/User.php b/src/Symfony/Component/Security/Core/User/User.php index dca5c4fe2b..ef0ae2f303 100644 --- a/src/Symfony/Component/Security/Core/User/User.php +++ b/src/Symfony/Component/Security/Core/User/User.php @@ -43,7 +43,7 @@ final class User implements UserInterface, EquatableInterface $this->roles = $roles; } - public function __toString() + public function __toString(): string { return $this->getUsername(); } @@ -51,7 +51,7 @@ final class User implements UserInterface, EquatableInterface /** * {@inheritdoc} */ - public function getRoles() + public function getRoles(): array { return $this->roles; } @@ -59,7 +59,7 @@ final class User implements UserInterface, EquatableInterface /** * {@inheritdoc} */ - public function getPassword() + public function getPassword(): ?string { return $this->password; } @@ -74,7 +74,7 @@ final class User implements UserInterface, EquatableInterface /** * {@inheritdoc} */ - public function getUsername() + public function getUsername(): string { return $this->username; } @@ -82,7 +82,7 @@ final class User implements UserInterface, EquatableInterface /** * {@inheritdoc} */ - public function isAccountNonExpired() + public function isAccountNonExpired(): bool { return $this->accountNonExpired; } @@ -90,7 +90,7 @@ final class User implements UserInterface, EquatableInterface /** * {@inheritdoc} */ - public function isAccountNonLocked() + public function isAccountNonLocked(): bool { return $this->accountNonLocked; } @@ -98,7 +98,7 @@ final class User implements UserInterface, EquatableInterface /** * {@inheritdoc} */ - public function isCredentialsNonExpired() + public function isCredentialsNonExpired(): bool { return $this->credentialsNonExpired; } @@ -106,7 +106,7 @@ final class User implements UserInterface, EquatableInterface /** * {@inheritdoc} */ - public function isEnabled() + public function isEnabled(): bool { return $this->enabled; } @@ -121,7 +121,7 @@ final class User implements UserInterface, EquatableInterface /** * {@inheritdoc} */ - public function isEqualTo(UserInterface $user) + public function isEqualTo(UserInterface $user): bool { if (!$user instanceof self) { return false; diff --git a/src/Symfony/Component/Security/Http/Controller/UserValueResolver.php b/src/Symfony/Component/Security/Http/Controller/UserValueResolver.php index 221d8d8ead..7774e7b4a2 100644 --- a/src/Symfony/Component/Security/Http/Controller/UserValueResolver.php +++ b/src/Symfony/Component/Security/Http/Controller/UserValueResolver.php @@ -32,7 +32,7 @@ final class UserValueResolver implements ArgumentValueResolverInterface $this->tokenStorage = $tokenStorage; } - public function supports(Request $request, ArgumentMetadata $argument) + public function supports(Request $request, ArgumentMetadata $argument): bool { // only security user implementations are supported if (UserInterface::class !== $argument->getType()) { @@ -50,7 +50,7 @@ final class UserValueResolver implements ArgumentValueResolverInterface return $user instanceof UserInterface; } - public function resolve(Request $request, ArgumentMetadata $argument) + public function resolve(Request $request, ArgumentMetadata $argument): iterable { yield $this->tokenStorage->getToken()->getUser(); } diff --git a/src/Symfony/Component/Security/Http/Firewall/ContextListener.php b/src/Symfony/Component/Security/Http/Firewall/ContextListener.php index 8d626a1aed..470d2a8dc4 100644 --- a/src/Symfony/Component/Security/Http/Firewall/ContextListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/ContextListener.php @@ -140,11 +140,9 @@ class ContextListener /** * Refreshes the user by reloading it from the user provider. * - * @return TokenInterface|null - * * @throws \RuntimeException */ - protected function refreshUser(TokenInterface $token) + protected function refreshUser(TokenInterface $token): ?TokenInterface { $user = $token->getUser(); if (!$user instanceof UserInterface) { diff --git a/src/Symfony/Component/Security/Http/Firewall/LogoutListener.php b/src/Symfony/Component/Security/Http/Firewall/LogoutListener.php index 5ec26e7fc4..e915502e98 100644 --- a/src/Symfony/Component/Security/Http/Firewall/LogoutListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/LogoutListener.php @@ -113,10 +113,8 @@ class LogoutListener * The default implementation only processed requests to a specific path, * but a subclass could change this to logout requests where * certain parameters is present. - * - * @return bool */ - protected function requiresLogout(Request $request) + protected function requiresLogout(Request $request): bool { return isset($this->options['logout_path']) && $this->httpUtils->checkRequestPath($request, $this->options['logout_path']); } diff --git a/src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php b/src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php index d591d846dc..bbe82db233 100644 --- a/src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php @@ -118,7 +118,7 @@ class SwitchUserListener * @throws \LogicException * @throws AccessDeniedException */ - private function attemptSwitchUser(Request $request, $username) + private function attemptSwitchUser(Request $request, $username): ?TokenInterface { $token = $this->tokenStorage->getToken(); $originalToken = $this->getOriginalToken($token); @@ -167,7 +167,7 @@ class SwitchUserListener * * @throws AuthenticationCredentialsNotFoundException */ - private function attemptExitUser(Request $request) + private function attemptExitUser(Request $request): TokenInterface { if (null === ($currentToken = $this->tokenStorage->getToken()) || null === $original = $this->getOriginalToken($currentToken)) { throw new AuthenticationCredentialsNotFoundException('Could not find original Token object.'); diff --git a/src/Symfony/Component/Security/Http/RememberMe/ResponseListener.php b/src/Symfony/Component/Security/Http/RememberMe/ResponseListener.php index 66fdc3fc0b..dcbb7218a2 100644 --- a/src/Symfony/Component/Security/Http/RememberMe/ResponseListener.php +++ b/src/Symfony/Component/Security/Http/RememberMe/ResponseListener.php @@ -41,7 +41,7 @@ class ResponseListener implements EventSubscriberInterface /** * {@inheritdoc} */ - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [KernelEvents::RESPONSE => 'onKernelResponse']; } diff --git a/src/Symfony/Component/Serializer/Encoder/ChainDecoder.php b/src/Symfony/Component/Serializer/Encoder/ChainDecoder.php index 0100a6282f..2a55d93a60 100644 --- a/src/Symfony/Component/Serializer/Encoder/ChainDecoder.php +++ b/src/Symfony/Component/Serializer/Encoder/ChainDecoder.php @@ -43,7 +43,7 @@ class ChainDecoder implements ContextAwareDecoderInterface /** * {@inheritdoc} */ - public function supportsDecoding($format, array $context = []) + public function supportsDecoding($format, array $context = []): bool { try { $this->getDecoder($format, $context); diff --git a/src/Symfony/Component/Serializer/Encoder/ChainEncoder.php b/src/Symfony/Component/Serializer/Encoder/ChainEncoder.php index eb1b84ad3c..8bf2dfe6ef 100644 --- a/src/Symfony/Component/Serializer/Encoder/ChainEncoder.php +++ b/src/Symfony/Component/Serializer/Encoder/ChainEncoder.php @@ -43,7 +43,7 @@ class ChainEncoder implements ContextAwareEncoderInterface /** * {@inheritdoc} */ - public function supportsEncoding($format, array $context = []) + public function supportsEncoding($format, array $context = []): bool { try { $this->getEncoder($format, $context); @@ -59,10 +59,8 @@ class ChainEncoder implements ContextAwareEncoderInterface * * @param string $format * @param array $context - * - * @return bool */ - public function needsNormalization($format, array $context = []) + public function needsNormalization($format, array $context = []): bool { $encoder = $this->getEncoder($format, $context); diff --git a/src/Symfony/Component/Serializer/NameConverter/MetadataAwareNameConverter.php b/src/Symfony/Component/Serializer/NameConverter/MetadataAwareNameConverter.php index e863e013e7..1fef5507ff 100644 --- a/src/Symfony/Component/Serializer/NameConverter/MetadataAwareNameConverter.php +++ b/src/Symfony/Component/Serializer/NameConverter/MetadataAwareNameConverter.php @@ -40,7 +40,7 @@ final class MetadataAwareNameConverter implements AdvancedNameConverterInterface /** * {@inheritdoc} */ - public function normalize($propertyName, string $class = null, string $format = null, array $context = []) + public function normalize($propertyName, string $class = null, string $format = null, array $context = []): string { if (null === $class) { return $this->normalizeFallback($propertyName, $class, $format, $context); @@ -56,7 +56,7 @@ final class MetadataAwareNameConverter implements AdvancedNameConverterInterface /** * {@inheritdoc} */ - public function denormalize($propertyName, string $class = null, string $format = null, array $context = []) + public function denormalize($propertyName, string $class = null, string $format = null, array $context = []): string { if (null === $class) { return $this->denormalizeFallback($propertyName, $class, $format, $context); @@ -69,7 +69,7 @@ final class MetadataAwareNameConverter implements AdvancedNameConverterInterface return self::$denormalizeCache[$class][$propertyName] ?? $this->denormalizeFallback($propertyName, $class, $format, $context); } - private function getCacheValueForNormalization($propertyName, string $class) + private function getCacheValueForNormalization($propertyName, string $class): ?string { if (!$this->metadataFactory->hasMetadataFor($class)) { return null; @@ -83,12 +83,12 @@ final class MetadataAwareNameConverter implements AdvancedNameConverterInterface return $attributesMetadata[$propertyName]->getSerializedName() ?? null; } - private function normalizeFallback($propertyName, string $class = null, string $format = null, array $context = []) + private function normalizeFallback($propertyName, string $class = null, string $format = null, array $context = []): string { return $this->fallbackNameConverter ? $this->fallbackNameConverter->normalize($propertyName, $class, $format, $context) : $propertyName; } - private function getCacheValueForDenormalization($propertyName, string $class) + private function getCacheValueForDenormalization($propertyName, string $class): ?string { if (!isset(self::$attributesMetadataCache[$class])) { self::$attributesMetadataCache[$class] = $this->getCacheValueForAttributesMetadata($class); @@ -97,7 +97,7 @@ final class MetadataAwareNameConverter implements AdvancedNameConverterInterface return self::$attributesMetadataCache[$class][$propertyName] ?? null; } - private function denormalizeFallback($propertyName, string $class = null, string $format = null, array $context = []) + private function denormalizeFallback($propertyName, string $class = null, string $format = null, array $context = []): string { return $this->fallbackNameConverter ? $this->fallbackNameConverter->denormalize($propertyName, $class, $format, $context) : $propertyName; } diff --git a/src/Symfony/Component/Serializer/Tests/NameConverter/MetadataAwareNameConverterTest.php b/src/Symfony/Component/Serializer/Tests/NameConverter/MetadataAwareNameConverterTest.php index 7e2552ea8a..b78050e484 100644 --- a/src/Symfony/Component/Serializer/Tests/NameConverter/MetadataAwareNameConverterTest.php +++ b/src/Symfony/Component/Serializer/Tests/NameConverter/MetadataAwareNameConverterTest.php @@ -96,7 +96,7 @@ final class MetadataAwareNameConverterTest extends TestCase $this->assertEquals($expected, $nameConverter->denormalize($propertyName, SerializedNameDummy::class)); } - public function attributeProvider() + public function attributeProvider(): array { return [ ['foo', 'baz'], @@ -106,7 +106,7 @@ final class MetadataAwareNameConverterTest extends TestCase ]; } - public function fallbackAttributeProvider() + public function fallbackAttributeProvider(): array { return [ ['foo', 'baz'], diff --git a/src/Symfony/Component/Validator/Mapping/Cache/DoctrineCache.php b/src/Symfony/Component/Validator/Mapping/Cache/DoctrineCache.php index 36f1febc5a..2f54019328 100644 --- a/src/Symfony/Component/Validator/Mapping/Cache/DoctrineCache.php +++ b/src/Symfony/Component/Validator/Mapping/Cache/DoctrineCache.php @@ -36,7 +36,7 @@ final class DoctrineCache implements CacheInterface /** * {@inheritdoc} */ - public function has($class) + public function has($class): bool { return $this->cache->contains($class); } diff --git a/src/Symfony/Component/Validator/Mapping/Loader/PropertyInfoLoader.php b/src/Symfony/Component/Validator/Mapping/Loader/PropertyInfoLoader.php index 7ddd534275..379210b54b 100644 --- a/src/Symfony/Component/Validator/Mapping/Loader/PropertyInfoLoader.php +++ b/src/Symfony/Component/Validator/Mapping/Loader/PropertyInfoLoader.php @@ -44,7 +44,7 @@ final class PropertyInfoLoader implements LoaderInterface /** * {@inheritdoc} */ - public function loadClassMetadata(ClassMetadata $metadata) + public function loadClassMetadata(ClassMetadata $metadata): bool { $className = $metadata->getClassName(); if (null !== $this->classValidatorRegexp && !preg_match($this->classValidatorRegexp, $className)) { diff --git a/src/Symfony/Component/VarDumper/Caster/Caster.php b/src/Symfony/Component/VarDumper/Caster/Caster.php index a8a7e21247..fcc2322de0 100644 --- a/src/Symfony/Component/VarDumper/Caster/Caster.php +++ b/src/Symfony/Component/VarDumper/Caster/Caster.php @@ -46,7 +46,7 @@ class Caster * * @return array The array-cast of the object, with prefixed dynamic properties */ - public static function castObject($obj, $class, $hasDebugInfo = false) + public static function castObject($obj, $class, $hasDebugInfo = false): array { if ($hasDebugInfo) { $a = $obj->__debugInfo(); @@ -104,7 +104,7 @@ class Caster * * @return array The filtered array */ - public static function filter(array $a, $filter, array $listedProperties = [], &$count = 0) + public static function filter(array $a, $filter, array $listedProperties = [], &$count = 0): array { $count = 0; @@ -145,13 +145,14 @@ class Caster return $a; } - public static function castPhpIncompleteClass(\__PHP_Incomplete_Class $c, array $a, Stub $stub, $isNested) + public static function castPhpIncompleteClass(\__PHP_Incomplete_Class $c, array $a, Stub $stub, $isNested): array { if (isset($a['__PHP_Incomplete_Class_Name'])) { $stub->class .= '('.$a['__PHP_Incomplete_Class_Name'].')'; unset($a['__PHP_Incomplete_Class_Name']); } + return $a; } } diff --git a/src/Symfony/Component/VarExporter/Instantiator.php b/src/Symfony/Component/VarExporter/Instantiator.php index 06abbc75a6..9fd8cf3722 100644 --- a/src/Symfony/Component/VarExporter/Instantiator.php +++ b/src/Symfony/Component/VarExporter/Instantiator.php @@ -57,7 +57,7 @@ final class Instantiator * * @throws ExceptionInterface When the instance cannot be created */ - public static function instantiate(string $class, array $properties = [], array $privateProperties = []) + public static function instantiate(string $class, array $properties = [], array $privateProperties = []): object { $reflector = Registry::$reflectors[$class] ?? Registry::getClassReflector($class); diff --git a/src/Symfony/Component/VarExporter/Tests/VarExporterTest.php b/src/Symfony/Component/VarExporter/Tests/VarExporterTest.php index 6f54d76106..78ef7ed80a 100644 --- a/src/Symfony/Component/VarExporter/Tests/VarExporterTest.php +++ b/src/Symfony/Component/VarExporter/Tests/VarExporterTest.php @@ -322,7 +322,7 @@ final class FinalError extends \Error final class FinalArrayIterator extends \ArrayIterator { - public function serialize() + public function serialize(): string { return serialize([123, parent::serialize()]); } diff --git a/src/Symfony/Component/WebLink/EventListener/AddLinkHeaderListener.php b/src/Symfony/Component/WebLink/EventListener/AddLinkHeaderListener.php index d743f4664c..3027529a84 100644 --- a/src/Symfony/Component/WebLink/EventListener/AddLinkHeaderListener.php +++ b/src/Symfony/Component/WebLink/EventListener/AddLinkHeaderListener.php @@ -50,7 +50,7 @@ class AddLinkHeaderListener implements EventSubscriberInterface /** * {@inheritdoc} */ - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [KernelEvents::RESPONSE => 'onKernelResponse']; } diff --git a/src/Symfony/Component/WebLink/HttpHeaderSerializer.php b/src/Symfony/Component/WebLink/HttpHeaderSerializer.php index 6c7a039326..d80d96ec3b 100644 --- a/src/Symfony/Component/WebLink/HttpHeaderSerializer.php +++ b/src/Symfony/Component/WebLink/HttpHeaderSerializer.php @@ -26,10 +26,8 @@ final class HttpHeaderSerializer * Builds the value of the "Link" HTTP header. * * @param LinkInterface[]|\Traversable $links - * - * @return string|null */ - public function serialize(iterable $links) + public function serialize(iterable $links): ?string { $elements = []; foreach ($links as $link) { diff --git a/src/Symfony/Component/Workflow/MarkingStore/MethodMarkingStore.php b/src/Symfony/Component/Workflow/MarkingStore/MethodMarkingStore.php index a2341aadbd..df1a6a24ab 100644 --- a/src/Symfony/Component/Workflow/MarkingStore/MethodMarkingStore.php +++ b/src/Symfony/Component/Workflow/MarkingStore/MethodMarkingStore.php @@ -46,7 +46,7 @@ final class MethodMarkingStore implements MarkingStoreInterface /** * {@inheritdoc} */ - public function getMarking($subject) + public function getMarking($subject): Marking { $method = 'get'.ucfirst($this->property); diff --git a/src/Symfony/Component/Workflow/TransitionBlockerList.php b/src/Symfony/Component/Workflow/TransitionBlockerList.php index 8569b28fea..f7f4a63ea3 100644 --- a/src/Symfony/Component/Workflow/TransitionBlockerList.php +++ b/src/Symfony/Component/Workflow/TransitionBlockerList.php @@ -63,7 +63,7 @@ final class TransitionBlockerList implements \IteratorAggregate, \Countable * * @return \ArrayIterator|TransitionBlocker[] */ - public function getIterator() + public function getIterator(): \Traversable { return new \ArrayIterator($this->blockers); }