From bad9b7db252d790f230a5a80408a6e6e447be320 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 12 Aug 2021 18:00:10 +0200 Subject: [PATCH] Add return types - batch 4/n --- .../Component/BrowserKit/AbstractBrowser.php | 78 ++++-------- src/Symfony/Component/BrowserKit/Cookie.php | 22 ++-- .../Component/BrowserKit/CookieJar.php | 10 +- src/Symfony/Component/BrowserKit/History.php | 14 +-- src/Symfony/Component/BrowserKit/Request.php | 14 +-- src/Symfony/Component/Config/ConfigCache.php | 2 +- .../Component/Config/ConfigCacheFactory.php | 2 +- .../Config/ConfigCacheFactoryInterface.php | 4 +- .../Component/Config/ConfigCacheInterface.php | 4 +- .../Component/Config/Definition/ArrayNode.php | 18 +-- .../Component/Config/Definition/BaseNode.php | 41 +++---- .../Config/Definition/BooleanNode.php | 2 +- .../Builder/ArrayNodeDefinition.php | 74 ++++-------- .../Builder/BooleanNodeDefinition.php | 4 +- .../Definition/Builder/EnumNodeDefinition.php | 4 +- .../Config/Definition/Builder/ExprBuilder.php | 34 +++--- .../Builder/FloatNodeDefinition.php | 2 +- .../Builder/IntegerNodeDefinition.php | 2 +- .../Definition/Builder/MergeBuilder.php | 6 +- .../Config/Definition/Builder/NodeBuilder.php | 26 ++-- .../Definition/Builder/NodeDefinition.php | 62 ++++------ .../Builder/NormalizationBuilder.php | 4 +- .../Builder/NumericNodeDefinition.php | 6 +- .../Builder/ParentNodeDefinitionInterface.php | 8 +- .../Builder/ScalarNodeDefinition.php | 2 +- .../Config/Definition/Builder/TreeBuilder.php | 6 +- .../Definition/Builder/ValidationBuilder.php | 2 +- .../Builder/VariableNodeDefinition.php | 5 +- .../Component/Config/Definition/EnumNode.php | 2 +- .../InvalidConfigurationException.php | 5 +- .../Config/Definition/NodeInterface.php | 16 +-- .../Config/Definition/NumericNode.php | 4 +- .../Config/Definition/PrototypedArrayNode.php | 14 +-- .../Config/Definition/ScalarNode.php | 2 +- .../Config/Definition/VariableNode.php | 12 +- .../Config/Loader/DelegatingLoader.php | 4 +- .../Component/Config/Loader/FileLoader.php | 2 +- .../Config/Loader/GlobFileLoader.php | 4 +- .../Component/Config/Loader/Loader.php | 4 +- .../Config/Loader/LoaderResolver.php | 4 +- .../Config/Loader/LoaderResolverInterface.php | 2 +- .../Resource/SelfCheckingResourceChecker.php | 4 +- .../SelfCheckingResourceInterface.php | 2 +- .../Config/ResourceCheckerConfigCache.php | 4 +- .../ResourceCheckerConfigCacheFactory.php | 2 +- .../Component/Config/Util/XmlUtils.php | 8 +- src/Symfony/Component/Console/Application.php | 40 +++---- .../Component/Console/Command/Command.php | 50 ++++---- .../Component/Console/Command/HelpCommand.php | 2 +- .../Component/Console/Command/ListCommand.php | 2 +- .../CommandLoader/CommandLoaderInterface.php | 6 +- .../CommandLoader/ContainerCommandLoader.php | 7 +- .../CommandLoader/FactoryCommandLoader.php | 7 +- .../Component/Console/Event/ConsoleEvent.php | 6 +- .../Console/EventListener/ErrorListener.php | 2 +- .../Exception/CommandNotFoundException.php | 2 +- .../Console/Formatter/OutputFormatter.php | 12 +- .../Formatter/OutputFormatterInterface.php | 8 +- .../Formatter/OutputFormatterStyle.php | 2 +- .../OutputFormatterStyleInterface.php | 2 +- .../Formatter/OutputFormatterStyleStack.php | 8 +- .../Console/Helper/DebugFormatterHelper.php | 8 +- .../Console/Helper/DescriptorHelper.php | 4 +- .../Console/Helper/FormatterHelper.php | 8 +- .../Component/Console/Helper/Helper.php | 4 +- .../Console/Helper/HelperInterface.php | 6 +- .../Component/Console/Helper/HelperSet.php | 6 +- .../Console/Helper/ProgressIndicator.php | 4 +- .../Console/Helper/QuestionHelper.php | 6 +- .../Component/Console/Helper/Table.php | 16 +-- .../Component/Console/Helper/TableCell.php | 4 +- .../Console/Helper/TableCellStyle.php | 2 +- .../Component/Console/Helper/TableStyle.php | 26 ++-- .../Component/Console/Input/ArgvInput.php | 6 +- .../Component/Console/Input/ArrayInput.php | 6 +- src/Symfony/Component/Console/Input/Input.php | 16 +-- .../Component/Console/Input/InputArgument.php | 10 +- .../Console/Input/InputDefinition.php | 26 ++-- .../Console/Input/InputInterface.php | 20 ++-- .../Component/Console/Input/InputOption.php | 18 +-- .../Console/Logger/ConsoleLogger.php | 2 +- .../Console/Output/BufferedOutput.php | 2 +- .../Console/Output/ConsoleOutput.php | 6 +- .../Console/Output/ConsoleOutputInterface.php | 2 +- .../Component/Console/Output/NullOutput.php | 14 +-- .../Component/Console/Output/Output.php | 14 +-- .../Console/Output/OutputInterface.php | 14 +-- .../Component/Console/Output/StreamOutput.php | 2 +- .../Console/Output/TrimmedBufferOutput.php | 2 +- .../Console/Question/ChoiceQuestion.php | 12 +- .../Component/Console/Question/Question.php | 34 +++--- .../Component/Console/Style/OutputStyle.php | 16 +-- .../Console/Style/StyleInterface.php | 8 +- .../Component/Console/Style/SymfonyStyle.php | 16 ++- src/Symfony/Component/Console/Terminal.php | 4 +- .../Console/Tester/ApplicationTester.php | 2 +- .../Console/Tester/CommandTester.php | 2 +- .../Component/Console/Tester/TesterTrait.php | 12 +- .../Component/DependencyInjection/Alias.php | 8 +- .../Argument/ArgumentInterface.php | 2 +- .../Argument/ReferenceSetArgumentTrait.php | 2 +- .../Argument/ServiceClosureArgument.php | 2 +- .../DependencyInjection/ChildDefinition.php | 8 +- .../Compiler/AbstractRecursivePass.php | 4 +- .../Compiler/AnalyzeServiceReferencesPass.php | 2 +- .../Compiler/AutowirePass.php | 2 +- .../Compiler/AutowireRequiredMethodsPass.php | 2 +- .../AutowireRequiredPropertiesPass.php | 2 +- .../Compiler/CheckArgumentsValidityPass.php | 2 +- ...xceptionOnInvalidReferenceBehaviorPass.php | 2 +- .../Compiler/CheckReferenceValidityPass.php | 2 +- .../DependencyInjection/Compiler/Compiler.php | 6 +- .../Compiler/DecoratorServicePass.php | 2 +- .../Compiler/DefinitionErrorExceptionPass.php | 2 +- .../Compiler/InlineServiceDefinitionsPass.php | 2 +- .../MergeExtensionConfigurationPass.php | 2 +- .../Compiler/PassConfig.php | 14 +-- .../Compiler/PriorityTaggedServiceTrait.php | 2 +- .../RegisterServiceSubscribersPass.php | 2 +- .../Compiler/RemoveUnusedDefinitionsPass.php | 2 +- .../ReplaceAliasByActualDefinitionPass.php | 2 +- .../Compiler/ResolveBindingsPass.php | 2 +- .../Compiler/ResolveChildDefinitionsPass.php | 2 +- .../Compiler/ResolveEnvPlaceholdersPass.php | 2 +- .../Compiler/ResolveFactoryClassPass.php | 2 +- .../Compiler/ResolveHotPathPass.php | 2 +- .../Compiler/ResolveNamedArgumentsPass.php | 2 +- .../Compiler/ResolveNoPreloadPass.php | 2 +- .../ResolveParameterPlaceHoldersPass.php | 2 +- .../ResolveReferencesToAliasesPass.php | 2 +- .../ResolveServiceSubscribersPass.php | 2 +- .../ResolveTaggedIteratorArgumentPass.php | 2 +- .../Compiler/ServiceReferenceGraphEdge.php | 12 +- .../Compiler/ServiceReferenceGraphNode.php | 12 +- .../ContainerParametersResourceChecker.php | 4 +- .../DependencyInjection/Container.php | 20 ++-- .../DependencyInjection/ContainerBuilder.php | 76 ++++++------ .../ContainerInterface.php | 6 +- .../DependencyInjection/Definition.php | 112 +++++++++--------- .../Dumper/DumperInterface.php | 2 +- .../Dumper/GraphvizDumper.php | 2 +- .../DependencyInjection/Dumper/PhpDumper.php | 7 +- .../DependencyInjection/Dumper/XmlDumper.php | 2 +- .../DependencyInjection/Dumper/YamlDumper.php | 2 +- .../DependencyInjection/EnvVarProcessor.php | 4 +- .../EnvVarProcessorInterface.php | 4 +- .../ExpressionLanguageProvider.php | 2 +- .../Extension/Extension.php | 4 +- .../Extension/ExtensionInterface.php | 2 +- .../Instantiator/RealServiceInstantiator.php | 2 +- .../LazyProxy/PhpDumper/DumperInterface.php | 6 +- .../Loader/ClosureLoader.php | 4 +- .../Configurator/AbstractConfigurator.php | 4 +- .../Loader/Configurator/EnvConfigurator.php | 38 +++--- .../Loader/DirectoryLoader.php | 4 +- .../DependencyInjection/Loader/FileLoader.php | 2 +- .../Loader/GlobFileLoader.php | 4 +- .../Loader/IniFileLoader.php | 4 +- .../Loader/PhpFileLoader.php | 4 +- .../Loader/XmlFileLoader.php | 8 +- .../Loader/YamlFileLoader.php | 6 +- .../ParameterBag/ContainerBag.php | 4 +- .../ParameterBag/ContainerBagInterface.php | 6 +- .../EnvPlaceholderParameterBag.php | 6 +- .../ParameterBag/ParameterBag.php | 14 +-- .../ParameterBag/ParameterBagInterface.php | 10 +- .../DependencyInjection/Reference.php | 2 +- .../DependencyInjection/ServiceLocator.php | 2 +- .../TaggedContainerInterface.php | 2 +- .../Tests/Fixtures/php/services10.php | 5 +- .../Tests/Fixtures/php/services12.php | 5 +- .../Tests/Fixtures/php/services19.php | 5 +- .../Tests/Fixtures/php/services26.php | 5 +- .../Tests/Fixtures/php/services8.php | 5 +- .../Tests/Fixtures/php/services9_as_files.txt | 5 +- .../Tests/Fixtures/php/services9_compiled.php | 5 +- .../php/services9_inlined_factories.txt | 5 +- .../php/services9_lazy_inlined_factories.txt | 5 +- .../Fixtures/php/services_array_params.php | 5 +- .../Fixtures/php/services_base64_env.php | 5 +- .../Tests/Fixtures/php/services_csv_env.php | 5 +- .../Fixtures/php/services_default_env.php | 5 +- .../Tests/Fixtures/php/services_env_in_id.php | 5 +- .../php/services_errored_definition.php | 5 +- .../Fixtures/php/services_inline_requires.php | 5 +- .../Tests/Fixtures/php/services_json_env.php | 5 +- .../php/services_query_string_env.php | 5 +- .../Tests/Fixtures/php/services_rot13_env.php | 5 +- .../php/services_unsupported_characters.php | 5 +- .../Tests/Fixtures/php/services_url_env.php | 5 +- 190 files changed, 748 insertions(+), 929 deletions(-) diff --git a/src/Symfony/Component/BrowserKit/AbstractBrowser.php b/src/Symfony/Component/BrowserKit/AbstractBrowser.php index 496a28ee8a433..9c56258728f38 100644 --- a/src/Symfony/Component/BrowserKit/AbstractBrowser.php +++ b/src/Symfony/Component/BrowserKit/AbstractBrowser.php @@ -75,10 +75,8 @@ public function followMetaRefresh(bool $followMetaRefresh = true) /** * Returns whether client automatically follows redirects or not. - * - * @return bool */ - public function isFollowingRedirects() + public function isFollowingRedirects(): bool { return $this->followRedirects; } @@ -94,10 +92,8 @@ public function setMaxRedirects(int $maxRedirects) /** * Returns the maximum number of redirects that crawler can follow. - * - * @return int */ - public function getMaxRedirects() + public function getMaxRedirects(): int { return $this->maxRedirects; } @@ -136,10 +132,8 @@ public function setServerParameter(string $key, string $value) /** * Gets single server parameter for specified key. - * - * @return mixed */ - public function getServerParameter(string $key, mixed $default = '') + public function getServerParameter(string $key, mixed $default = ''): mixed { return $this->server[$key] ?? $default; } @@ -175,30 +169,24 @@ public function jsonRequest(string $method, string $uri, array $parameters = [], /** * Returns the History instance. - * - * @return History */ - public function getHistory() + public function getHistory(): History { return $this->history; } /** * Returns the CookieJar instance. - * - * @return CookieJar */ - public function getCookieJar() + public function getCookieJar(): CookieJar { return $this->cookieJar; } /** * Returns the current Crawler instance. - * - * @return Crawler */ - public function getCrawler() + public function getCrawler(): Crawler { if (null === $this->crawler) { throw new BadMethodCallException(sprintf('The "request()" method must be called before "%s()".', __METHOD__)); @@ -209,10 +197,8 @@ public function getCrawler() /** * Returns the current BrowserKit Response instance. - * - * @return Response */ - public function getInternalResponse() + public function getInternalResponse(): Response { if (null === $this->internalResponse) { throw new BadMethodCallException(sprintf('The "request()" method must be called before "%s()".', __METHOD__)); @@ -227,11 +213,9 @@ public function getInternalResponse() * The origin response is the response instance that is returned * by the code that handles requests. * - * @return object - * * @see doRequest() */ - public function getResponse() + public function getResponse(): object { if (null === $this->response) { throw new BadMethodCallException(sprintf('The "request()" method must be called before "%s()".', __METHOD__)); @@ -242,10 +226,8 @@ public function getResponse() /** * Returns the current BrowserKit Request instance. - * - * @return Request */ - public function getInternalRequest() + public function getInternalRequest(): Request { if (null === $this->internalRequest) { throw new BadMethodCallException(sprintf('The "request()" method must be called before "%s()".', __METHOD__)); @@ -260,11 +242,9 @@ public function getInternalRequest() * The origin request is the request instance that is sent * to the code that handles requests. * - * @return object - * * @see doRequest() */ - public function getRequest() + public function getRequest(): object { if (null === $this->request) { throw new BadMethodCallException(sprintf('The "request()" method must be called before "%s()".', __METHOD__)); @@ -275,10 +255,8 @@ public function getRequest() /** * Clicks on a given link. - * - * @return Crawler */ - public function click(Link $link) + public function click(Link $link): Crawler { if ($link instanceof Form) { return $this->submit($link); @@ -306,10 +284,8 @@ public function clickLink(string $linkText): Crawler * * @param array $values An array of form field values * @param array $serverParameters An array of server parameters - * - * @return Crawler */ - public function submit(Form $form, array $values = [], array $serverParameters = []) + public function submit(Form $form, array $values = [], array $serverParameters = []): Crawler { $form->setValues($values); @@ -347,10 +323,8 @@ public function submitForm(string $button, array $fieldValues = [], string $meth * @param array $server The server parameters (HTTP headers are referenced with an HTTP_ prefix as PHP does) * @param string $content The raw body data * @param bool $changeHistory Whether to update the history or not (only used internally for back(), forward(), and reload()) - * - * @return Crawler */ - public function request(string $method, string $uri, array $parameters = [], array $files = [], array $server = [], string $content = null, bool $changeHistory = true) + public function request(string $method, string $uri, array $parameters = [], array $files = [], array $server = [], string $content = null, bool $changeHistory = true): Crawler { if ($this->isMainRequest) { $this->redirectCount = 0; @@ -504,10 +478,8 @@ protected function filterResponse(object $response) * Creates a crawler. * * This method returns null if the DomCrawler component is not available. - * - * @return Crawler|null */ - protected function createCrawlerFromContent(string $uri, string $content, string $type) + protected function createCrawlerFromContent(string $uri, string $content, string $type): ?Crawler { if (!class_exists(Crawler::class)) { return null; @@ -521,10 +493,8 @@ protected function createCrawlerFromContent(string $uri, string $content, string /** * Goes back in the browser history. - * - * @return Crawler */ - public function back() + public function back(): Crawler { do { $request = $this->history->back(); @@ -535,10 +505,8 @@ public function back() /** * Goes forward in the browser history. - * - * @return Crawler */ - public function forward() + public function forward(): Crawler { do { $request = $this->history->forward(); @@ -549,10 +517,8 @@ public function forward() /** * Reloads the current browser. - * - * @return Crawler */ - public function reload() + public function reload(): Crawler { return $this->requestFromRequest($this->history->current(), false); } @@ -560,11 +526,9 @@ public function reload() /** * Follow redirects? * - * @return Crawler - * * @throws \LogicException If request was not a redirect */ - public function followRedirect() + public function followRedirect(): Crawler { if (empty($this->redirect)) { throw new \LogicException('The request was not redirected.'); @@ -639,7 +603,7 @@ public function restart() * * @return string An absolute URI */ - protected function getAbsoluteUri(string $uri) + protected function getAbsoluteUri(string $uri): string { // already absolute? if (0 === strpos($uri, 'http://') || 0 === strpos($uri, 'https://')) { @@ -682,10 +646,8 @@ protected function getAbsoluteUri(string $uri) * Makes a request from a Request object directly. * * @param bool $changeHistory Whether to update the history or not (only used internally for back(), forward(), and reload()) - * - * @return Crawler */ - protected function requestFromRequest(Request $request, bool $changeHistory = true) + protected function requestFromRequest(Request $request, bool $changeHistory = true): Crawler { return $this->request($request->getMethod(), $request->getUri(), $request->getParameters(), $request->getFiles(), $request->getServer(), $request->getContent(), $changeHistory); } diff --git a/src/Symfony/Component/BrowserKit/Cookie.php b/src/Symfony/Component/BrowserKit/Cookie.php index 6abdd9effc0d6..b785d306e42b9 100644 --- a/src/Symfony/Component/BrowserKit/Cookie.php +++ b/src/Symfony/Component/BrowserKit/Cookie.php @@ -119,11 +119,9 @@ public function __toString(): string /** * Creates a Cookie instance from a Set-Cookie header value. * - * @return static - * * @throws \InvalidArgumentException */ - public static function fromString(string $cookie, string $url = null) + public static function fromString(string $cookie, string $url = null): static { $parts = explode(';', $cookie); @@ -222,7 +220,7 @@ private static function parseDate(string $dateValue): ?string * * @return string The cookie name */ - public function getName() + public function getName(): string { return $this->name; } @@ -232,7 +230,7 @@ public function getName() * * @return string The cookie value */ - public function getValue() + public function getValue(): string { return $this->value; } @@ -242,7 +240,7 @@ public function getValue() * * @return string The cookie value */ - public function getRawValue() + public function getRawValue(): string { return $this->rawValue; } @@ -252,7 +250,7 @@ public function getRawValue() * * @return string|null The cookie expires time */ - public function getExpiresTime() + public function getExpiresTime(): ?string { return $this->expires; } @@ -262,7 +260,7 @@ public function getExpiresTime() * * @return string The cookie path */ - public function getPath() + public function getPath(): string { return $this->path; } @@ -272,7 +270,7 @@ public function getPath() * * @return string The cookie domain */ - public function getDomain() + public function getDomain(): string { return $this->domain; } @@ -282,7 +280,7 @@ public function getDomain() * * @return bool The cookie secure flag */ - public function isSecure() + public function isSecure(): bool { return $this->secure; } @@ -292,7 +290,7 @@ public function isSecure() * * @return bool The cookie httponly flag */ - public function isHttpOnly() + public function isHttpOnly(): bool { return $this->httponly; } @@ -302,7 +300,7 @@ public function isHttpOnly() * * @return bool true if the cookie has expired, false otherwise */ - public function isExpired() + public function isExpired(): bool { return null !== $this->expires && 0 != $this->expires && $this->expires <= time(); } diff --git a/src/Symfony/Component/BrowserKit/CookieJar.php b/src/Symfony/Component/BrowserKit/CookieJar.php index 4f7f21e1a4753..2788d9fd8c7e1 100644 --- a/src/Symfony/Component/BrowserKit/CookieJar.php +++ b/src/Symfony/Component/BrowserKit/CookieJar.php @@ -32,10 +32,8 @@ public function set(Cookie $cookie) * this method returns the first cookie for the given name/path * (this behavior ensures a BC behavior with previous versions of * Symfony). - * - * @return Cookie|null */ - public function get(string $name, string $path = '/', string $domain = null) + public function get(string $name, string $path = '/', string $domain = null): ?Cookie { $this->flushExpiredCookies(); @@ -143,7 +141,7 @@ public function updateFromResponse(Response $response, string $uri = null) * * @return Cookie[] An array of cookies */ - public function all() + public function all(): array { $this->flushExpiredCookies(); @@ -164,7 +162,7 @@ public function all() * * @return array An array of cookie values */ - public function allValues(string $uri, bool $returnsRawValue = false) + public function allValues(string $uri, bool $returnsRawValue = false): array { $this->flushExpiredCookies(); @@ -201,7 +199,7 @@ public function allValues(string $uri, bool $returnsRawValue = false) * * @return array An array of cookie values */ - public function allRawValues(string $uri) + public function allRawValues(string $uri): array { return $this->allValues($uri, true); } diff --git a/src/Symfony/Component/BrowserKit/History.php b/src/Symfony/Component/BrowserKit/History.php index 7af4769b08371..7abb2dc6c6115 100644 --- a/src/Symfony/Component/BrowserKit/History.php +++ b/src/Symfony/Component/BrowserKit/History.php @@ -45,7 +45,7 @@ public function add(Request $request) * * @return bool true if the history is empty, false otherwise */ - public function isEmpty() + public function isEmpty(): bool { return 0 == \count($this->stack); } @@ -53,11 +53,9 @@ public function isEmpty() /** * Goes back in the history. * - * @return Request - * * @throws \LogicException if the stack is already on the first page */ - public function back() + public function back(): Request { if ($this->position < 1) { throw new \LogicException('You are already on the first page.'); @@ -69,11 +67,9 @@ public function back() /** * Goes forward in the history. * - * @return Request - * * @throws \LogicException if the stack is already on the last page */ - public function forward() + public function forward(): Request { if ($this->position > \count($this->stack) - 2) { throw new \LogicException('You are already on the last page.'); @@ -85,11 +81,9 @@ public function forward() /** * Returns the current element in the history. * - * @return Request - * * @throws \LogicException if the stack is empty */ - public function current() + public function current(): Request { if (-1 == $this->position) { throw new \LogicException('The page history is empty.'); diff --git a/src/Symfony/Component/BrowserKit/Request.php b/src/Symfony/Component/BrowserKit/Request.php index c2eeba8ee4f4a..be29cdd666a13 100644 --- a/src/Symfony/Component/BrowserKit/Request.php +++ b/src/Symfony/Component/BrowserKit/Request.php @@ -54,7 +54,7 @@ public function __construct(string $uri, string $method, array $parameters = [], * * @return string The request URI */ - public function getUri() + public function getUri(): string { return $this->uri; } @@ -64,7 +64,7 @@ public function getUri() * * @return string The request HTTP method */ - public function getMethod() + public function getMethod(): string { return $this->method; } @@ -74,7 +74,7 @@ public function getMethod() * * @return array The request parameters */ - public function getParameters() + public function getParameters(): array { return $this->parameters; } @@ -84,7 +84,7 @@ public function getParameters() * * @return array The request files */ - public function getFiles() + public function getFiles(): array { return $this->files; } @@ -94,7 +94,7 @@ public function getFiles() * * @return array The request cookies */ - public function getCookies() + public function getCookies(): array { return $this->cookies; } @@ -104,7 +104,7 @@ public function getCookies() * * @return array The request server parameters */ - public function getServer() + public function getServer(): array { return $this->server; } @@ -114,7 +114,7 @@ public function getServer() * * @return string|null The request raw body data */ - public function getContent() + public function getContent(): ?string { return $this->content; } diff --git a/src/Symfony/Component/Config/ConfigCache.php b/src/Symfony/Component/Config/ConfigCache.php index 4b921f43d64e5..138ca487f3c16 100644 --- a/src/Symfony/Component/Config/ConfigCache.php +++ b/src/Symfony/Component/Config/ConfigCache.php @@ -51,7 +51,7 @@ public function __construct(string $file, bool $debug) * * @return bool true if the cache is fresh, false otherwise */ - public function isFresh() + public function isFresh(): bool { if (!$this->debug && is_file($this->getPath())) { return true; diff --git a/src/Symfony/Component/Config/ConfigCacheFactory.php b/src/Symfony/Component/Config/ConfigCacheFactory.php index 62a5c45e27c38..86351c48d5a90 100644 --- a/src/Symfony/Component/Config/ConfigCacheFactory.php +++ b/src/Symfony/Component/Config/ConfigCacheFactory.php @@ -35,7 +35,7 @@ public function __construct(bool $debug) /** * {@inheritdoc} */ - public function cache(string $file, callable $callback) + public function cache(string $file, callable $callback): ConfigCacheInterface { $cache = new ConfigCache($file, $this->debug); if (!$cache->isFresh()) { diff --git a/src/Symfony/Component/Config/ConfigCacheFactoryInterface.php b/src/Symfony/Component/Config/ConfigCacheFactoryInterface.php index 146ee9b568e13..01c90d1e30d7f 100644 --- a/src/Symfony/Component/Config/ConfigCacheFactoryInterface.php +++ b/src/Symfony/Component/Config/ConfigCacheFactoryInterface.php @@ -25,8 +25,6 @@ interface ConfigCacheFactoryInterface * * @param string $file The absolute cache file path * @param callable $callable The callable to be executed when the cache needs to be filled (i. e. is not fresh). The cache will be passed as the only parameter to this callback - * - * @return ConfigCacheInterface */ - public function cache(string $file, callable $callable); + public function cache(string $file, callable $callable): ConfigCacheInterface; } diff --git a/src/Symfony/Component/Config/ConfigCacheInterface.php b/src/Symfony/Component/Config/ConfigCacheInterface.php index 001e7e7c105e8..82981c7a64d5e 100644 --- a/src/Symfony/Component/Config/ConfigCacheInterface.php +++ b/src/Symfony/Component/Config/ConfigCacheInterface.php @@ -25,7 +25,7 @@ interface ConfigCacheInterface * * @return string The cache file path */ - public function getPath(); + public function getPath(): string; /** * Checks if the cache is still fresh. @@ -34,7 +34,7 @@ public function getPath(); * * @return bool Whether the cache is still fresh */ - public function isFresh(); + public function isFresh(): bool; /** * Writes the given content into the cache file. Metadata will be stored diff --git a/src/Symfony/Component/Config/Definition/ArrayNode.php b/src/Symfony/Component/Config/Definition/ArrayNode.php index 6ee6a6da3f8bb..4440f85275e84 100644 --- a/src/Symfony/Component/Config/Definition/ArrayNode.php +++ b/src/Symfony/Component/Config/Definition/ArrayNode.php @@ -46,7 +46,7 @@ public function setNormalizeKeys(bool $normalizeKeys) * If you have a mixed key like foo-bar_moo, it will not be altered. * The key will also not be altered if the target key already exists. */ - protected function preNormalize(mixed $value) + protected function preNormalize(mixed $value): mixed { if (!$this->normalizeKeys || !\is_array($value)) { return $value; @@ -70,7 +70,7 @@ protected function preNormalize(mixed $value) * * @return array */ - public function getChildren() + public function getChildren(): array { return $this->children; } @@ -90,7 +90,7 @@ public function setXmlRemappings(array $remappings) * * @return array an array of the form [[string, string]] */ - public function getXmlRemappings() + public function getXmlRemappings(): array { return $this->xmlRemappings; } @@ -151,7 +151,7 @@ public function setName(string $name) /** * {@inheritdoc} */ - public function hasDefaultValue() + public function hasDefaultValue(): bool { return $this->addIfNotSet; } @@ -159,7 +159,7 @@ public function hasDefaultValue() /** * {@inheritdoc} */ - public function getDefaultValue() + public function getDefaultValue(): mixed { if (!$this->hasDefaultValue()) { throw new \RuntimeException(sprintf('The node at path "%s" has no default value.', $this->getPath())); @@ -200,7 +200,7 @@ public function addChild(NodeInterface $node) * @throws UnsetKeyException * @throws InvalidConfigurationException if the node doesn't have enough children */ - protected function finalizeValue(mixed $value) + protected function finalizeValue(mixed $value): mixed { if (false === $value) { throw new UnsetKeyException(sprintf('Unsetting key for path "%s", value: %s.', $this->getPath(), json_encode($value))); @@ -264,7 +264,7 @@ protected function validateType(mixed $value) * * @throws InvalidConfigurationException */ - protected function normalizeValue(mixed $value) + protected function normalizeValue(mixed $value): mixed { if (false === $value) { return $value; @@ -325,7 +325,7 @@ protected function normalizeValue(mixed $value) * * @return array The remapped values */ - protected function remapXml(array $value) + protected function remapXml(array $value): array { foreach ($this->xmlRemappings as [$singular, $plural]) { if (!isset($value[$singular])) { @@ -345,7 +345,7 @@ protected function remapXml(array $value) * @throws InvalidConfigurationException * @throws \RuntimeException */ - protected function mergeValues(mixed $leftSide, mixed $rightSide) + protected function mergeValues(mixed $leftSide, mixed $rightSide): mixed { if (false === $rightSide) { // if this is still false after the last config has been merged the diff --git a/src/Symfony/Component/Config/Definition/BaseNode.php b/src/Symfony/Component/Config/Definition/BaseNode.php index e541ee9d95e71..afb03d78f92da 100644 --- a/src/Symfony/Component/Config/Definition/BaseNode.php +++ b/src/Symfony/Component/Config/Definition/BaseNode.php @@ -102,26 +102,17 @@ public function setAttribute(string $key, mixed $value) $this->attributes[$key] = $value; } - /** - * @return mixed - */ - public function getAttribute(string $key, mixed $default = null) + public function getAttribute(string $key, mixed $default = null): mixed { return $this->attributes[$key] ?? $default; } - /** - * @return bool - */ - public function hasAttribute(string $key) + public function hasAttribute(string $key): bool { return isset($this->attributes[$key]); } - /** - * @return array - */ - public function getAttributes() + public function getAttributes(): array { return $this->attributes; } @@ -149,7 +140,7 @@ public function setInfo(string $info) * * @return string|null The info text */ - public function getInfo() + public function getInfo(): ?string { return $this->getAttribute('info'); } @@ -167,7 +158,7 @@ public function setExample(string|array $example) * * @return string|array|null The example */ - public function getExample() + public function getExample(): string|array|null { return $this->getAttribute('example'); } @@ -238,17 +229,15 @@ public function setFinalValidationClosures(array $closures) /** * {@inheritdoc} */ - public function isRequired() + public function isRequired(): bool { return $this->required; } /** * Checks if this node is deprecated. - * - * @return bool */ - public function isDeprecated() + public function isDeprecated(): bool { return (bool) $this->deprecation; } @@ -269,7 +258,7 @@ public function getDeprecation(string $node, string $path): array /** * {@inheritdoc} */ - public function getName() + public function getName(): string { return $this->name; } @@ -277,7 +266,7 @@ public function getName() /** * {@inheritdoc} */ - public function getPath() + public function getPath(): string { if (null !== $this->parent) { return $this->parent->getPath().$this->pathSeparator.$this->name; @@ -372,17 +361,15 @@ final public function normalize(mixed $value): mixed * * @return mixed The normalized array value */ - protected function preNormalize(mixed $value) + protected function preNormalize(mixed $value): mixed { return $value; } /** * Returns parent node for this node. - * - * @return NodeInterface|null */ - public function getParent() + public function getParent(): ?NodeInterface { return $this->parent; } @@ -440,21 +427,21 @@ abstract protected function validateType(mixed $value); * * @return mixed The normalized value */ - abstract protected function normalizeValue(mixed $value); + abstract protected function normalizeValue(mixed $value): mixed; /** * Merges two values together. * * @return mixed The merged value */ - abstract protected function mergeValues(mixed $leftSide, mixed $rightSide); + abstract protected function mergeValues(mixed $leftSide, mixed $rightSide): mixed; /** * Finalizes a value. * * @return mixed The finalized value */ - abstract protected function finalizeValue(mixed $value); + abstract protected function finalizeValue(mixed $value): mixed; /** * Tests if placeholder values are allowed for this node. diff --git a/src/Symfony/Component/Config/Definition/BooleanNode.php b/src/Symfony/Component/Config/Definition/BooleanNode.php index 7cf651b21122a..7798567d9c461 100644 --- a/src/Symfony/Component/Config/Definition/BooleanNode.php +++ b/src/Symfony/Component/Config/Definition/BooleanNode.php @@ -39,7 +39,7 @@ protected function validateType(mixed $value) /** * {@inheritdoc} */ - protected function isValueEmpty(mixed $value) + protected function isValueEmpty(mixed $value): bool { // a boolean value cannot be empty return false; diff --git a/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php b/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php index 87cdcd9332ed0..0244a60bff810 100644 --- a/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php +++ b/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php @@ -13,6 +13,7 @@ use Symfony\Component\Config\Definition\ArrayNode; use Symfony\Component\Config\Definition\Exception\InvalidDefinitionException; +use Symfony\Component\Config\Definition\NodeInterface; use Symfony\Component\Config\Definition\PrototypedArrayNode; /** @@ -58,73 +59,50 @@ public function setBuilder(NodeBuilder $builder) /** * {@inheritdoc} */ - public function children() + public function children(): NodeBuilder { return $this->getNodeBuilder(); } /** * Sets a prototype for child nodes. - * - * @return NodeDefinition */ - public function prototype(string $type) + public function prototype(string $type): NodeDefinition { return $this->prototype = $this->getNodeBuilder()->node(null, $type)->setParent($this); } - /** - * @return VariableNodeDefinition - */ - public function variablePrototype() + public function variablePrototype(): VariableNodeDefinition { return $this->prototype('variable'); } - /** - * @return ScalarNodeDefinition - */ - public function scalarPrototype() + public function scalarPrototype(): ScalarNodeDefinition { return $this->prototype('scalar'); } - /** - * @return BooleanNodeDefinition - */ - public function booleanPrototype() + public function booleanPrototype(): BooleanNodeDefinition { return $this->prototype('boolean'); } - /** - * @return IntegerNodeDefinition - */ - public function integerPrototype() + public function integerPrototype(): IntegerNodeDefinition { return $this->prototype('integer'); } - /** - * @return FloatNodeDefinition - */ - public function floatPrototype() + public function floatPrototype(): FloatNodeDefinition { return $this->prototype('float'); } - /** - * @return ArrayNodeDefinition - */ - public function arrayPrototype() + public function arrayPrototype(): self { return $this->prototype('array'); } - /** - * @return EnumNodeDefinition - */ - public function enumPrototype() + public function enumPrototype(): EnumNodeDefinition { return $this->prototype('enum'); } @@ -138,7 +116,7 @@ public function enumPrototype() * * @return $this */ - public function addDefaultsIfNotSet() + public function addDefaultsIfNotSet(): static { $this->addDefaults = true; @@ -154,7 +132,7 @@ public function addDefaultsIfNotSet() * * @return $this */ - public function addDefaultChildrenIfNoneSet(int|string|array $children = null) + public function addDefaultChildrenIfNoneSet(int|string|array $children = null): static { $this->addDefaultChildren = $children; @@ -168,7 +146,7 @@ public function addDefaultChildrenIfNoneSet(int|string|array $children = null) * * @return $this */ - public function requiresAtLeastOneElement() + public function requiresAtLeastOneElement(): static { $this->atLeastOne = true; @@ -182,7 +160,7 @@ public function requiresAtLeastOneElement() * * @return $this */ - public function disallowNewKeysInSubsequentConfigs() + public function disallowNewKeysInSubsequentConfigs(): static { $this->allowNewKeys = false; @@ -197,7 +175,7 @@ public function disallowNewKeysInSubsequentConfigs() * * @return $this */ - public function fixXmlConfig(string $singular, string $plural = null) + public function fixXmlConfig(string $singular, string $plural = null): static { $this->normalization()->remap($singular, $plural); @@ -232,7 +210,7 @@ public function fixXmlConfig(string $singular, string $plural = null) * * @return $this */ - public function useAttributeAsKey(string $name, bool $removeKeyItem = true) + public function useAttributeAsKey(string $name, bool $removeKeyItem = true): static { $this->key = $name; $this->removeKeyItem = $removeKeyItem; @@ -245,7 +223,7 @@ public function useAttributeAsKey(string $name, bool $removeKeyItem = true) * * @return $this */ - public function canBeUnset(bool $allow = true) + public function canBeUnset(bool $allow = true): static { $this->merge()->allowUnset($allow); @@ -267,7 +245,7 @@ public function canBeUnset(bool $allow = true) * * @return $this */ - public function canBeEnabled() + public function canBeEnabled(): static { $this ->addDefaultsIfNotSet() @@ -297,7 +275,7 @@ public function canBeEnabled() * * @return $this */ - public function canBeDisabled() + public function canBeDisabled(): static { $this ->addDefaultsIfNotSet() @@ -317,7 +295,7 @@ public function canBeDisabled() * * @return $this */ - public function performNoDeepMerging() + public function performNoDeepMerging(): static { $this->performDeepMerging = false; @@ -337,7 +315,7 @@ public function performNoDeepMerging() * * @return $this */ - public function ignoreExtraKeys(bool $remove = true) + public function ignoreExtraKeys(bool $remove = true): static { $this->ignoreExtraKeys = true; $this->removeExtraKeys = $remove; @@ -350,7 +328,7 @@ public function ignoreExtraKeys(bool $remove = true) * * @return $this */ - public function normalizeKeys(bool $bool) + public function normalizeKeys(bool $bool): static { $this->normalizeKeys = $bool; @@ -360,7 +338,7 @@ public function normalizeKeys(bool $bool) /** * {@inheritdoc} */ - public function append(NodeDefinition $node) + public function append(NodeDefinition $node): static { $this->children[$node->name] = $node->setParent($this); @@ -372,7 +350,7 @@ public function append(NodeDefinition $node) * * @return NodeBuilder The node builder */ - protected function getNodeBuilder() + protected function getNodeBuilder(): NodeBuilder { if (null === $this->nodeBuilder) { $this->nodeBuilder = new NodeBuilder(); @@ -384,7 +362,7 @@ protected function getNodeBuilder() /** * {@inheritdoc} */ - protected function createNode() + protected function createNode(): NodeInterface { if (null === $this->prototype) { $node = new ArrayNode($this->name, $this->parent, $this->pathSeparator); @@ -520,7 +498,7 @@ protected function validatePrototypeNode(PrototypedArrayNode $node) /** * @return NodeDefinition[] */ - public function getChildNodeDefinitions() + public function getChildNodeDefinitions(): array { return $this->children; } diff --git a/src/Symfony/Component/Config/Definition/Builder/BooleanNodeDefinition.php b/src/Symfony/Component/Config/Definition/Builder/BooleanNodeDefinition.php index d19324273bff5..c9aedcb694e2b 100644 --- a/src/Symfony/Component/Config/Definition/Builder/BooleanNodeDefinition.php +++ b/src/Symfony/Component/Config/Definition/Builder/BooleanNodeDefinition.php @@ -36,7 +36,7 @@ public function __construct(?string $name, NodeParentInterface $parent = null) * * @return BooleanNode The node */ - protected function instantiateNode() + protected function instantiateNode(): BooleanNode { return new BooleanNode($this->name, $this->parent, $this->pathSeparator); } @@ -46,7 +46,7 @@ protected function instantiateNode() * * @throws InvalidDefinitionException */ - public function cannotBeEmpty() + public function cannotBeEmpty(): static { throw new InvalidDefinitionException('->cannotBeEmpty() is not applicable to BooleanNodeDefinition.'); } diff --git a/src/Symfony/Component/Config/Definition/Builder/EnumNodeDefinition.php b/src/Symfony/Component/Config/Definition/Builder/EnumNodeDefinition.php index f3f4b18da8a15..ba5b25feda88f 100644 --- a/src/Symfony/Component/Config/Definition/Builder/EnumNodeDefinition.php +++ b/src/Symfony/Component/Config/Definition/Builder/EnumNodeDefinition.php @@ -25,7 +25,7 @@ class EnumNodeDefinition extends ScalarNodeDefinition /** * @return $this */ - public function values(array $values) + public function values(array $values): static { $values = array_unique($values); @@ -45,7 +45,7 @@ public function values(array $values) * * @throws \RuntimeException */ - protected function instantiateNode() + protected function instantiateNode(): EnumNode { if (!isset($this->values)) { throw new \RuntimeException('You must call ->values() on enum nodes.'); diff --git a/src/Symfony/Component/Config/Definition/Builder/ExprBuilder.php b/src/Symfony/Component/Config/Definition/Builder/ExprBuilder.php index f0b7a5931e29a..71d156dfc47a1 100644 --- a/src/Symfony/Component/Config/Definition/Builder/ExprBuilder.php +++ b/src/Symfony/Component/Config/Definition/Builder/ExprBuilder.php @@ -35,7 +35,7 @@ public function __construct(NodeDefinition $node) * * @return $this */ - public function always(\Closure $then = null) + public function always(\Closure $then = null): static { $this->ifPart = function () { return true; }; @@ -53,7 +53,7 @@ public function always(\Closure $then = null) * * @return $this */ - public function ifTrue(\Closure $closure = null) + public function ifTrue(\Closure $closure = null): static { if (null === $closure) { $closure = function ($v) { return true === $v; }; @@ -69,7 +69,7 @@ public function ifTrue(\Closure $closure = null) * * @return $this */ - public function ifString() + public function ifString(): static { $this->ifPart = function ($v) { return \is_string($v); }; @@ -81,7 +81,7 @@ public function ifString() * * @return $this */ - public function ifNull() + public function ifNull(): static { $this->ifPart = function ($v) { return null === $v; }; @@ -90,10 +90,8 @@ public function ifNull() /** * Tests if the value is empty. - * - * @return ExprBuilder */ - public function ifEmpty() + public function ifEmpty(): self { $this->ifPart = function ($v) { return empty($v); }; @@ -105,7 +103,7 @@ public function ifEmpty() * * @return $this */ - public function ifArray() + public function ifArray(): static { $this->ifPart = function ($v) { return \is_array($v); }; @@ -117,7 +115,7 @@ public function ifArray() * * @return $this */ - public function ifInArray(array $array) + public function ifInArray(array $array): static { $this->ifPart = function ($v) use ($array) { return \in_array($v, $array, true); }; @@ -129,7 +127,7 @@ public function ifInArray(array $array) * * @return $this */ - public function ifNotInArray(array $array) + public function ifNotInArray(array $array): static { $this->ifPart = function ($v) use ($array) { return !\in_array($v, $array, true); }; @@ -141,7 +139,7 @@ public function ifNotInArray(array $array) * * @return $this */ - public function castToArray() + public function castToArray(): static { $this->ifPart = function ($v) { return !\is_array($v); }; $this->thenPart = function ($v) { return [$v]; }; @@ -154,7 +152,7 @@ public function castToArray() * * @return $this */ - public function then(\Closure $closure) + public function then(\Closure $closure): static { $this->thenPart = $closure; @@ -166,7 +164,7 @@ public function then(\Closure $closure) * * @return $this */ - public function thenEmptyArray() + public function thenEmptyArray(): static { $this->thenPart = function () { return []; }; @@ -182,7 +180,7 @@ public function thenEmptyArray() * * @throws \InvalidArgumentException */ - public function thenInvalid(string $message) + public function thenInvalid(string $message): static { $this->thenPart = function ($v) use ($message) { throw new \InvalidArgumentException(sprintf($message, json_encode($v))); }; @@ -196,7 +194,7 @@ public function thenInvalid(string $message) * * @throws UnsetKeyException */ - public function thenUnset() + public function thenUnset(): static { $this->thenPart = function () { throw new UnsetKeyException('Unsetting key.'); }; @@ -210,7 +208,7 @@ public function thenUnset() * * @throws \RuntimeException */ - public function end() + public function end(): NodeDefinition|ArrayNodeDefinition|VariableNodeDefinition { if (null === $this->ifPart) { throw new \RuntimeException('You must specify an if part.'); @@ -226,10 +224,8 @@ public function end() * Builds the expressions. * * @param ExprBuilder[] $expressions An array of ExprBuilder instances to build - * - * @return array */ - public static function buildExpressions(array $expressions) + public static function buildExpressions(array $expressions): array { foreach ($expressions as $k => $expr) { if ($expr instanceof self) { diff --git a/src/Symfony/Component/Config/Definition/Builder/FloatNodeDefinition.php b/src/Symfony/Component/Config/Definition/Builder/FloatNodeDefinition.php index 7b74271ae498a..ba5fa0c0cb9f2 100644 --- a/src/Symfony/Component/Config/Definition/Builder/FloatNodeDefinition.php +++ b/src/Symfony/Component/Config/Definition/Builder/FloatNodeDefinition.php @@ -25,7 +25,7 @@ class FloatNodeDefinition extends NumericNodeDefinition * * @return FloatNode The node */ - protected function instantiateNode() + protected function instantiateNode(): FloatNode { return new FloatNode($this->name, $this->parent, $this->min, $this->max, $this->pathSeparator); } diff --git a/src/Symfony/Component/Config/Definition/Builder/IntegerNodeDefinition.php b/src/Symfony/Component/Config/Definition/Builder/IntegerNodeDefinition.php index 0472a9870d9dc..55076378e2d13 100644 --- a/src/Symfony/Component/Config/Definition/Builder/IntegerNodeDefinition.php +++ b/src/Symfony/Component/Config/Definition/Builder/IntegerNodeDefinition.php @@ -25,7 +25,7 @@ class IntegerNodeDefinition extends NumericNodeDefinition * * @return IntegerNode The node */ - protected function instantiateNode() + protected function instantiateNode(): IntegerNode { return new IntegerNode($this->name, $this->parent, $this->min, $this->max, $this->pathSeparator); } diff --git a/src/Symfony/Component/Config/Definition/Builder/MergeBuilder.php b/src/Symfony/Component/Config/Definition/Builder/MergeBuilder.php index a88d49ba93a41..1b55b185bd970 100644 --- a/src/Symfony/Component/Config/Definition/Builder/MergeBuilder.php +++ b/src/Symfony/Component/Config/Definition/Builder/MergeBuilder.php @@ -32,7 +32,7 @@ public function __construct(NodeDefinition $node) * * @return $this */ - public function allowUnset(bool $allow = true) + public function allowUnset(bool $allow = true): static { $this->allowFalse = $allow; @@ -44,7 +44,7 @@ public function allowUnset(bool $allow = true) * * @return $this */ - public function denyOverwrite(bool $deny = true) + public function denyOverwrite(bool $deny = true): static { $this->allowOverwrite = !$deny; @@ -56,7 +56,7 @@ public function denyOverwrite(bool $deny = true) * * @return NodeDefinition|ArrayNodeDefinition|VariableNodeDefinition */ - public function end() + public function end(): NodeDefinition|ArrayNodeDefinition|VariableNodeDefinition { return $this->node; } diff --git a/src/Symfony/Component/Config/Definition/Builder/NodeBuilder.php b/src/Symfony/Component/Config/Definition/Builder/NodeBuilder.php index bab439b9ba2db..4d0cbd4f0b412 100644 --- a/src/Symfony/Component/Config/Definition/Builder/NodeBuilder.php +++ b/src/Symfony/Component/Config/Definition/Builder/NodeBuilder.php @@ -39,7 +39,7 @@ public function __construct() * * @return $this */ - public function setParent(ParentNodeDefinitionInterface $parent = null) + public function setParent(ParentNodeDefinitionInterface $parent = null): static { $this->parent = $parent; @@ -51,7 +51,7 @@ public function setParent(ParentNodeDefinitionInterface $parent = null) * * @return ArrayNodeDefinition The child node */ - public function arrayNode(string $name) + public function arrayNode(string $name): ArrayNodeDefinition { return $this->node($name, 'array'); } @@ -61,7 +61,7 @@ public function arrayNode(string $name) * * @return ScalarNodeDefinition The child node */ - public function scalarNode(string $name) + public function scalarNode(string $name): ScalarNodeDefinition { return $this->node($name, 'scalar'); } @@ -71,7 +71,7 @@ public function scalarNode(string $name) * * @return BooleanNodeDefinition The child node */ - public function booleanNode(string $name) + public function booleanNode(string $name): BooleanNodeDefinition { return $this->node($name, 'boolean'); } @@ -81,7 +81,7 @@ public function booleanNode(string $name) * * @return IntegerNodeDefinition The child node */ - public function integerNode(string $name) + public function integerNode(string $name): IntegerNodeDefinition { return $this->node($name, 'integer'); } @@ -91,17 +91,15 @@ public function integerNode(string $name) * * @return FloatNodeDefinition The child node */ - public function floatNode(string $name) + public function floatNode(string $name): FloatNodeDefinition { return $this->node($name, 'float'); } /** * Creates a child EnumNode. - * - * @return EnumNodeDefinition */ - public function enumNode(string $name) + public function enumNode(string $name): EnumNodeDefinition { return $this->node($name, 'enum'); } @@ -111,7 +109,7 @@ public function enumNode(string $name) * * @return VariableNodeDefinition The builder of the child node */ - public function variableNode(string $name) + public function variableNode(string $name): VariableNodeDefinition { return $this->node($name, 'variable'); } @@ -134,7 +132,7 @@ public function end() * @throws \RuntimeException When the node type is not registered * @throws \RuntimeException When the node class is not found */ - public function node(?string $name, string $type) + public function node(?string $name, string $type): NodeDefinition { $class = $this->getNodeClass($type); @@ -160,7 +158,7 @@ public function node(?string $name, string $type) * * @return $this */ - public function append(NodeDefinition $node) + public function append(NodeDefinition $node): static { if ($node instanceof BuilderAwareInterface) { $builder = clone $this; @@ -185,7 +183,7 @@ public function append(NodeDefinition $node) * * @return $this */ - public function setNodeClass(string $type, string $class) + public function setNodeClass(string $type, string $class): static { $this->nodeMapping[strtolower($type)] = $class; @@ -200,7 +198,7 @@ public function setNodeClass(string $type, string $class) * @throws \RuntimeException When the node type is not registered * @throws \RuntimeException When the node class is not found */ - protected function getNodeClass(string $type) + protected function getNodeClass(string $type): string { $type = strtolower($type); diff --git a/src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php b/src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php index 5213c1ca6e2d8..4edeabf0b3da3 100644 --- a/src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php +++ b/src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php @@ -49,7 +49,7 @@ public function __construct(?string $name, NodeParentInterface $parent = null) * * @return $this */ - public function setParent(NodeParentInterface $parent) + public function setParent(NodeParentInterface $parent): static { $this->parent = $parent; @@ -61,7 +61,7 @@ public function setParent(NodeParentInterface $parent) * * @return $this */ - public function info(string $info) + public function info(string $info): static { return $this->attribute('info', $info); } @@ -71,7 +71,7 @@ public function info(string $info) * * @return $this */ - public function example(string|array $example) + public function example(string|array $example): static { return $this->attribute('example', $example); } @@ -81,7 +81,7 @@ public function example(string|array $example) * * @return $this */ - public function attribute(string $key, mixed $value) + public function attribute(string $key, mixed $value): static { $this->attributes[$key] = $value; @@ -93,17 +93,15 @@ public function attribute(string $key, mixed $value) * * @return NodeParentInterface|NodeBuilder|NodeDefinition|ArrayNodeDefinition|VariableNodeDefinition|null The builder of the parent node */ - public function end() + public function end(): NodeParentInterface|NodeBuilder|NodeDefinition|ArrayNodeDefinition|VariableNodeDefinition|null { return $this->parent; } /** * Creates the node. - * - * @return NodeInterface */ - public function getNode(bool $forceRootNode = false) + public function getNode(bool $forceRootNode = false): NodeInterface { if ($forceRootNode) { $this->parent = null; @@ -130,7 +128,7 @@ public function getNode(bool $forceRootNode = false) * * @return $this */ - public function defaultValue(mixed $value) + public function defaultValue(mixed $value): static { $this->default = true; $this->defaultValue = $value; @@ -143,7 +141,7 @@ public function defaultValue(mixed $value) * * @return $this */ - public function isRequired() + public function isRequired(): static { $this->required = true; @@ -162,7 +160,7 @@ public function isRequired() * * @return $this */ - public function setDeprecated(string $package, string $version, string $message = 'The child node "%node%" at path "%path%" is deprecated.') + public function setDeprecated(string $package, string $version, string $message = 'The child node "%node%" at path "%path%" is deprecated.'): static { $this->deprecation = [ 'package' => $package, @@ -178,7 +176,7 @@ public function setDeprecated(string $package, string $version, string $message * * @return $this */ - public function treatNullLike(mixed $value) + public function treatNullLike(mixed $value): static { $this->nullEquivalent = $value; @@ -190,7 +188,7 @@ public function treatNullLike(mixed $value) * * @return $this */ - public function treatTrueLike(mixed $value) + public function treatTrueLike(mixed $value): static { $this->trueEquivalent = $value; @@ -202,7 +200,7 @@ public function treatTrueLike(mixed $value) * * @return $this */ - public function treatFalseLike(mixed $value) + public function treatFalseLike(mixed $value): static { $this->falseEquivalent = $value; @@ -214,7 +212,7 @@ public function treatFalseLike(mixed $value) * * @return $this */ - public function defaultNull() + public function defaultNull(): static { return $this->defaultValue(null); } @@ -224,7 +222,7 @@ public function defaultNull() * * @return $this */ - public function defaultTrue() + public function defaultTrue(): static { return $this->defaultValue(true); } @@ -234,17 +232,15 @@ public function defaultTrue() * * @return $this */ - public function defaultFalse() + public function defaultFalse(): static { return $this->defaultValue(false); } /** * Sets an expression to run before the normalization. - * - * @return ExprBuilder */ - public function beforeNormalization() + public function beforeNormalization(): ExprBuilder { return $this->normalization()->before(); } @@ -254,7 +250,7 @@ public function beforeNormalization() * * @return $this */ - public function cannotBeEmpty() + public function cannotBeEmpty(): static { $this->allowEmptyValue = false; @@ -267,10 +263,8 @@ public function cannotBeEmpty() * The expression receives the value of the node and must return it. It can * modify it. * An exception should be thrown when the node is not valid. - * - * @return ExprBuilder */ - public function validate() + public function validate(): ExprBuilder { return $this->validation()->rule(); } @@ -280,7 +274,7 @@ public function validate() * * @return $this */ - public function cannotBeOverwritten(bool $deny = true) + public function cannotBeOverwritten(bool $deny = true): static { $this->merge()->denyOverwrite($deny); @@ -289,10 +283,8 @@ public function cannotBeOverwritten(bool $deny = true) /** * Gets the builder for validation rules. - * - * @return ValidationBuilder */ - protected function validation() + protected function validation(): ValidationBuilder { if (null === $this->validation) { $this->validation = new ValidationBuilder($this); @@ -303,10 +295,8 @@ protected function validation() /** * Gets the builder for merging rules. - * - * @return MergeBuilder */ - protected function merge() + protected function merge(): MergeBuilder { if (null === $this->merge) { $this->merge = new MergeBuilder($this); @@ -317,10 +307,8 @@ protected function merge() /** * Gets the builder for normalization rules. - * - * @return NormalizationBuilder */ - protected function normalization() + protected function normalization(): NormalizationBuilder { if (null === $this->normalization) { $this->normalization = new NormalizationBuilder($this); @@ -332,18 +320,16 @@ protected function normalization() /** * Instantiate and configure the node according to this definition. * - * @return NodeInterface - * * @throws InvalidDefinitionException When the definition is invalid */ - abstract protected function createNode(); + abstract protected function createNode(): NodeInterface; /** * Set PathSeparator to use. * * @return $this */ - public function setPathSeparator(string $separator) + public function setPathSeparator(string $separator): static { if ($this instanceof ParentNodeDefinitionInterface) { foreach ($this->getChildNodeDefinitions() as $child) { diff --git a/src/Symfony/Component/Config/Definition/Builder/NormalizationBuilder.php b/src/Symfony/Component/Config/Definition/Builder/NormalizationBuilder.php index 06cbbd4345fff..59f92ffc6864b 100644 --- a/src/Symfony/Component/Config/Definition/Builder/NormalizationBuilder.php +++ b/src/Symfony/Component/Config/Definition/Builder/NormalizationBuilder.php @@ -35,7 +35,7 @@ public function __construct(NodeDefinition $node) * * @return $this */ - public function remap(string $key, string $plural = null) + public function remap(string $key, string $plural = null): static { $this->remappings[] = [$key, null === $plural ? $key.'s' : $plural]; @@ -47,7 +47,7 @@ public function remap(string $key, string $plural = null) * * @return ExprBuilder|$this */ - public function before(\Closure $closure = null) + public function before(\Closure $closure = null): ExprBuilder|static { if (null !== $closure) { $this->before[] = $closure; diff --git a/src/Symfony/Component/Config/Definition/Builder/NumericNodeDefinition.php b/src/Symfony/Component/Config/Definition/Builder/NumericNodeDefinition.php index 221029cbed891..83a67580c7248 100644 --- a/src/Symfony/Component/Config/Definition/Builder/NumericNodeDefinition.php +++ b/src/Symfony/Component/Config/Definition/Builder/NumericNodeDefinition.php @@ -30,7 +30,7 @@ abstract class NumericNodeDefinition extends ScalarNodeDefinition * * @throws \InvalidArgumentException when the constraint is inconsistent */ - public function max(int|float $max) + public function max(int|float $max): static { if (isset($this->min) && $this->min > $max) { throw new \InvalidArgumentException(sprintf('You cannot define a max(%s) as you already have a min(%s).', $max, $this->min)); @@ -47,7 +47,7 @@ public function max(int|float $max) * * @throws \InvalidArgumentException when the constraint is inconsistent */ - public function min(int|float $min) + public function min(int|float $min): static { if (isset($this->max) && $this->max < $min) { throw new \InvalidArgumentException(sprintf('You cannot define a min(%s) as you already have a max(%s).', $min, $this->max)); @@ -62,7 +62,7 @@ public function min(int|float $min) * * @throws InvalidDefinitionException */ - public function cannotBeEmpty() + public function cannotBeEmpty(): static { throw new InvalidDefinitionException('->cannotBeEmpty() is not applicable to NumericNodeDefinition.'); } diff --git a/src/Symfony/Component/Config/Definition/Builder/ParentNodeDefinitionInterface.php b/src/Symfony/Component/Config/Definition/Builder/ParentNodeDefinitionInterface.php index 449b91afdbc46..7b8a7eb80a89e 100644 --- a/src/Symfony/Component/Config/Definition/Builder/ParentNodeDefinitionInterface.php +++ b/src/Symfony/Component/Config/Definition/Builder/ParentNodeDefinitionInterface.php @@ -20,10 +20,8 @@ interface ParentNodeDefinitionInterface extends BuilderAwareInterface { /** * Returns a builder to add children nodes. - * - * @return NodeBuilder */ - public function children(); + public function children(): NodeBuilder; /** * Appends a node definition. @@ -40,12 +38,12 @@ public function children(); * * @return $this */ - public function append(NodeDefinition $node); + public function append(NodeDefinition $node): static; /** * Gets the child node definitions. * * @return NodeDefinition[] */ - public function getChildNodeDefinitions(); + public function getChildNodeDefinitions(): array; } diff --git a/src/Symfony/Component/Config/Definition/Builder/ScalarNodeDefinition.php b/src/Symfony/Component/Config/Definition/Builder/ScalarNodeDefinition.php index 428f61290a063..8a26eef12f533 100644 --- a/src/Symfony/Component/Config/Definition/Builder/ScalarNodeDefinition.php +++ b/src/Symfony/Component/Config/Definition/Builder/ScalarNodeDefinition.php @@ -25,7 +25,7 @@ class ScalarNodeDefinition extends VariableNodeDefinition * * @return ScalarNode The node */ - protected function instantiateNode() + protected function instantiateNode(): ScalarNode { return new ScalarNode($this->name, $this->parent, $this->pathSeparator); } diff --git a/src/Symfony/Component/Config/Definition/Builder/TreeBuilder.php b/src/Symfony/Component/Config/Definition/Builder/TreeBuilder.php index f3c3c2109cd72..4a106d1d289d2 100644 --- a/src/Symfony/Component/Config/Definition/Builder/TreeBuilder.php +++ b/src/Symfony/Component/Config/Definition/Builder/TreeBuilder.php @@ -32,7 +32,7 @@ public function __construct(string $name, string $type = 'array', NodeBuilder $b /** * @return NodeDefinition|ArrayNodeDefinition The root node (as an ArrayNodeDefinition when the type is 'array') */ - public function getRootNode(): NodeDefinition + public function getRootNode(): NodeDefinition|ArrayNodeDefinition { return $this->root; } @@ -40,11 +40,9 @@ public function getRootNode(): NodeDefinition /** * Builds the tree. * - * @return NodeInterface - * * @throws \RuntimeException */ - public function buildTree() + public function buildTree(): NodeInterface { if (null !== $this->tree) { return $this->tree; diff --git a/src/Symfony/Component/Config/Definition/Builder/ValidationBuilder.php b/src/Symfony/Component/Config/Definition/Builder/ValidationBuilder.php index 4efc726c0cf2d..1bee851b658c1 100644 --- a/src/Symfony/Component/Config/Definition/Builder/ValidationBuilder.php +++ b/src/Symfony/Component/Config/Definition/Builder/ValidationBuilder.php @@ -31,7 +31,7 @@ public function __construct(NodeDefinition $node) * * @return ExprBuilder|$this */ - public function rule(\Closure $closure = null) + public function rule(\Closure $closure = null): ExprBuilder|static { if (null !== $closure) { $this->rules[] = $closure; diff --git a/src/Symfony/Component/Config/Definition/Builder/VariableNodeDefinition.php b/src/Symfony/Component/Config/Definition/Builder/VariableNodeDefinition.php index 5f1254c959f0c..7a47b6d40bc0f 100644 --- a/src/Symfony/Component/Config/Definition/Builder/VariableNodeDefinition.php +++ b/src/Symfony/Component/Config/Definition/Builder/VariableNodeDefinition.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Config\Definition\Builder; +use Symfony\Component\Config\Definition\NodeInterface; use Symfony\Component\Config\Definition\VariableNode; /** @@ -25,7 +26,7 @@ class VariableNodeDefinition extends NodeDefinition * * @return VariableNode The node */ - protected function instantiateNode() + protected function instantiateNode(): VariableNode { return new VariableNode($this->name, $this->parent, $this->pathSeparator); } @@ -33,7 +34,7 @@ protected function instantiateNode() /** * {@inheritdoc} */ - protected function createNode() + protected function createNode(): NodeInterface { $node = $this->instantiateNode(); diff --git a/src/Symfony/Component/Config/Definition/EnumNode.php b/src/Symfony/Component/Config/Definition/EnumNode.php index 855743814b3f8..0001dd4946d3e 100644 --- a/src/Symfony/Component/Config/Definition/EnumNode.php +++ b/src/Symfony/Component/Config/Definition/EnumNode.php @@ -41,7 +41,7 @@ public function getValues() /** * {@inheritdoc} */ - protected function finalizeValue(mixed $value) + protected function finalizeValue(mixed $value): mixed { $value = parent::finalizeValue($value); diff --git a/src/Symfony/Component/Config/Definition/Exception/InvalidConfigurationException.php b/src/Symfony/Component/Config/Definition/Exception/InvalidConfigurationException.php index cdb4bc937cdbb..4ecf351570f2a 100644 --- a/src/Symfony/Component/Config/Definition/Exception/InvalidConfigurationException.php +++ b/src/Symfony/Component/Config/Definition/Exception/InvalidConfigurationException.php @@ -27,10 +27,7 @@ public function setPath(string $path) $this->path = $path; } - /** - * @return string|null - */ - public function getPath() + public function getPath(): ?string { return $this->path; } diff --git a/src/Symfony/Component/Config/Definition/NodeInterface.php b/src/Symfony/Component/Config/Definition/NodeInterface.php index bc6b01c754ddb..a56925fc232e7 100644 --- a/src/Symfony/Component/Config/Definition/NodeInterface.php +++ b/src/Symfony/Component/Config/Definition/NodeInterface.php @@ -30,28 +30,28 @@ interface NodeInterface * * @return string The name of the node */ - public function getName(); + public function getName(): string; /** * Returns the path of the node. * * @return string The node path */ - public function getPath(); + public function getPath(): string; /** * Returns true when the node is required. * * @return bool If the node is required */ - public function isRequired(); + public function isRequired(): bool; /** * Returns true when the node has a default value. * * @return bool If the node has a default value */ - public function hasDefaultValue(); + public function hasDefaultValue(): bool; /** * Returns the default value of the node. @@ -60,7 +60,7 @@ public function hasDefaultValue(); * * @throws \RuntimeException if the node has no default value */ - public function getDefaultValue(); + public function getDefaultValue(): mixed; /** * Normalizes a value. @@ -69,7 +69,7 @@ public function getDefaultValue(); * * @throws InvalidTypeException if the value type is invalid */ - public function normalize(mixed $value); + public function normalize(mixed $value): mixed; /** * Merges two values together. @@ -79,7 +79,7 @@ public function normalize(mixed $value); * @throws ForbiddenOverwriteException if the configuration path cannot be overwritten * @throws InvalidTypeException if the value type is invalid */ - public function merge(mixed $leftSide, mixed $rightSide); + public function merge(mixed $leftSide, mixed $rightSide): mixed; /** * Finalizes a value. @@ -89,5 +89,5 @@ public function merge(mixed $leftSide, mixed $rightSide); * @throws InvalidTypeException if the value type is invalid * @throws InvalidConfigurationException if the value is invalid configuration */ - public function finalize(mixed $value); + public function finalize(mixed $value): mixed; } diff --git a/src/Symfony/Component/Config/Definition/NumericNode.php b/src/Symfony/Component/Config/Definition/NumericNode.php index 0e26e0df445c4..4d3e01355e9e2 100644 --- a/src/Symfony/Component/Config/Definition/NumericNode.php +++ b/src/Symfony/Component/Config/Definition/NumericNode.php @@ -33,7 +33,7 @@ public function __construct(?string $name, NodeInterface $parent = null, int|flo /** * {@inheritdoc} */ - protected function finalizeValue(mixed $value) + protected function finalizeValue(mixed $value): mixed { $value = parent::finalizeValue($value); @@ -56,7 +56,7 @@ protected function finalizeValue(mixed $value) /** * {@inheritdoc} */ - protected function isValueEmpty(mixed $value) + protected function isValueEmpty(mixed $value): bool { // a numeric value cannot be empty return false; diff --git a/src/Symfony/Component/Config/Definition/PrototypedArrayNode.php b/src/Symfony/Component/Config/Definition/PrototypedArrayNode.php index 1f228a4aef6db..61ec105b475af 100644 --- a/src/Symfony/Component/Config/Definition/PrototypedArrayNode.php +++ b/src/Symfony/Component/Config/Definition/PrototypedArrayNode.php @@ -78,7 +78,7 @@ public function setKeyAttribute(string $attribute, bool $remove = true) * * @return string|null The name of the attribute */ - public function getKeyAttribute() + public function getKeyAttribute(): ?string { return $this->keyAttribute; } @@ -94,7 +94,7 @@ public function setDefaultValue(array $value) /** * {@inheritdoc} */ - public function hasDefaultValue() + public function hasDefaultValue(): bool { return true; } @@ -119,7 +119,7 @@ public function setAddChildrenIfNoneSet(int|string|array|null $children = ['defa * The default value could be either explicited or derived from the prototype * default value. */ - public function getDefaultValue() + public function getDefaultValue(): mixed { if (null !== $this->defaultChildren) { $default = $this->prototype->hasDefaultValue() ? $this->prototype->getDefaultValue() : []; @@ -147,7 +147,7 @@ public function setPrototype(PrototypeNodeInterface $node) * * @return PrototypeNodeInterface The prototype */ - public function getPrototype() + public function getPrototype(): PrototypeNodeInterface { return $this->prototype; } @@ -165,7 +165,7 @@ public function addChild(NodeInterface $node) /** * {@inheritdoc} */ - protected function finalizeValue(mixed $value) + protected function finalizeValue(mixed $value): mixed { if (false === $value) { throw new UnsetKeyException(sprintf('Unsetting key for path "%s", value: %s.', $this->getPath(), json_encode($value))); @@ -195,7 +195,7 @@ protected function finalizeValue(mixed $value) * * @throws DuplicateKeyException */ - protected function normalizeValue(mixed $value) + protected function normalizeValue(mixed $value): mixed { if (false === $value) { return $value; @@ -262,7 +262,7 @@ protected function normalizeValue(mixed $value) /** * {@inheritdoc} */ - protected function mergeValues(mixed $leftSide, mixed $rightSide) + protected function mergeValues(mixed $leftSide, mixed $rightSide): mixed { if (false === $rightSide) { // if this is still false after the last config has been merged the diff --git a/src/Symfony/Component/Config/Definition/ScalarNode.php b/src/Symfony/Component/Config/Definition/ScalarNode.php index 798a3aeda7e71..7f31625006376 100644 --- a/src/Symfony/Component/Config/Definition/ScalarNode.php +++ b/src/Symfony/Component/Config/Definition/ScalarNode.php @@ -46,7 +46,7 @@ protected function validateType(mixed $value) /** * {@inheritdoc} */ - protected function isValueEmpty(mixed $value) + protected function isValueEmpty(mixed $value): bool { // assume environment variables are never empty (which in practice is likely to be true during runtime) // not doing so breaks many configs that are valid today diff --git a/src/Symfony/Component/Config/Definition/VariableNode.php b/src/Symfony/Component/Config/Definition/VariableNode.php index 5571661012ba8..1999a31eb4f7c 100644 --- a/src/Symfony/Component/Config/Definition/VariableNode.php +++ b/src/Symfony/Component/Config/Definition/VariableNode.php @@ -36,7 +36,7 @@ public function setDefaultValue(mixed $value) /** * {@inheritdoc} */ - public function hasDefaultValue() + public function hasDefaultValue(): bool { return $this->defaultValueSet; } @@ -44,7 +44,7 @@ public function hasDefaultValue() /** * {@inheritdoc} */ - public function getDefaultValue() + public function getDefaultValue(): mixed { $v = $this->defaultValue; @@ -79,7 +79,7 @@ protected function validateType(mixed $value) /** * {@inheritdoc} */ - protected function finalizeValue(mixed $value) + protected function finalizeValue(mixed $value): mixed { // deny environment variables only when using custom validators // this avoids ever passing an empty value to final validation closures @@ -109,7 +109,7 @@ protected function finalizeValue(mixed $value) /** * {@inheritdoc} */ - protected function normalizeValue(mixed $value) + protected function normalizeValue(mixed $value): mixed { return $value; } @@ -117,7 +117,7 @@ protected function normalizeValue(mixed $value) /** * {@inheritdoc} */ - protected function mergeValues(mixed $leftSide, mixed $rightSide) + protected function mergeValues(mixed $leftSide, mixed $rightSide): mixed { return $rightSide; } @@ -133,7 +133,7 @@ protected function mergeValues(mixed $leftSide, mixed $rightSide) * * @see finalizeValue() */ - protected function isValueEmpty(mixed $value) + protected function isValueEmpty(mixed $value): bool { return empty($value); } diff --git a/src/Symfony/Component/Config/Loader/DelegatingLoader.php b/src/Symfony/Component/Config/Loader/DelegatingLoader.php index 77e483c45e7c5..29c2d3033286c 100644 --- a/src/Symfony/Component/Config/Loader/DelegatingLoader.php +++ b/src/Symfony/Component/Config/Loader/DelegatingLoader.php @@ -31,7 +31,7 @@ public function __construct(LoaderResolverInterface $resolver) /** * {@inheritdoc} */ - public function load(mixed $resource, string $type = null) + public function load(mixed $resource, string $type = null): mixed { if (false === $loader = $this->resolver->resolve($resource, $type)) { throw new LoaderLoadException($resource, null, 0, null, $type); @@ -43,7 +43,7 @@ public function load(mixed $resource, string $type = null) /** * {@inheritdoc} */ - public function supports(mixed $resource, string $type = null) + public function supports(mixed $resource, string $type = null): bool { return false !== $this->resolver->resolve($resource, $type); } diff --git a/src/Symfony/Component/Config/Loader/FileLoader.php b/src/Symfony/Component/Config/Loader/FileLoader.php index 9f7a1ef24a622..a139e92610c28 100644 --- a/src/Symfony/Component/Config/Loader/FileLoader.php +++ b/src/Symfony/Component/Config/Loader/FileLoader.php @@ -50,7 +50,7 @@ public function setCurrentDir(string $dir) * * @return FileLocatorInterface */ - public function getLocator() + public function getLocator(): FileLocatorInterface { return $this->locator; } diff --git a/src/Symfony/Component/Config/Loader/GlobFileLoader.php b/src/Symfony/Component/Config/Loader/GlobFileLoader.php index 857b733611102..f52d0f79d939e 100644 --- a/src/Symfony/Component/Config/Loader/GlobFileLoader.php +++ b/src/Symfony/Component/Config/Loader/GlobFileLoader.php @@ -21,7 +21,7 @@ class GlobFileLoader extends FileLoader /** * {@inheritdoc} */ - public function load(mixed $resource, string $type = null) + public function load(mixed $resource, string $type = null): mixed { return $this->import($resource); } @@ -29,7 +29,7 @@ public function load(mixed $resource, string $type = null) /** * {@inheritdoc} */ - public function supports(mixed $resource, string $type = null) + public function supports(mixed $resource, string $type = null): bool { return 'glob' === $type; } diff --git a/src/Symfony/Component/Config/Loader/Loader.php b/src/Symfony/Component/Config/Loader/Loader.php index 95f4bf6fef687..faa0f58369f13 100644 --- a/src/Symfony/Component/Config/Loader/Loader.php +++ b/src/Symfony/Component/Config/Loader/Loader.php @@ -31,7 +31,7 @@ public function __construct(string $env = null) /** * {@inheritdoc} */ - public function getResolver() + public function getResolver(): LoaderResolverInterface { return $this->resolver; } @@ -61,7 +61,7 @@ public function import(mixed $resource, string $type = null) * * @throws LoaderLoadException If no loader is found */ - public function resolve(mixed $resource, string $type = null) + public function resolve(mixed $resource, string $type = null): static|LoaderInterface { if ($this->supports($resource, $type)) { return $this; diff --git a/src/Symfony/Component/Config/Loader/LoaderResolver.php b/src/Symfony/Component/Config/Loader/LoaderResolver.php index 766301bb05db3..81e555f1a5c20 100644 --- a/src/Symfony/Component/Config/Loader/LoaderResolver.php +++ b/src/Symfony/Component/Config/Loader/LoaderResolver.php @@ -39,7 +39,7 @@ public function __construct(array $loaders = []) /** * {@inheritdoc} */ - public function resolve(mixed $resource, string $type = null) + public function resolve(mixed $resource, string $type = null): LoaderInterface|false { foreach ($this->loaders as $loader) { if ($loader->supports($resource, $type)) { @@ -61,7 +61,7 @@ public function addLoader(LoaderInterface $loader) * * @return LoaderInterface[] */ - public function getLoaders() + public function getLoaders(): array { return $this->loaders; } diff --git a/src/Symfony/Component/Config/Loader/LoaderResolverInterface.php b/src/Symfony/Component/Config/Loader/LoaderResolverInterface.php index fd5dc693541b5..e0be2ffd0b35f 100644 --- a/src/Symfony/Component/Config/Loader/LoaderResolverInterface.php +++ b/src/Symfony/Component/Config/Loader/LoaderResolverInterface.php @@ -25,5 +25,5 @@ interface LoaderResolverInterface * * @return LoaderInterface|false The loader or false if none is able to load the resource */ - public function resolve(mixed $resource, string $type = null); + public function resolve(mixed $resource, string $type = null): LoaderInterface|false; } diff --git a/src/Symfony/Component/Config/Resource/SelfCheckingResourceChecker.php b/src/Symfony/Component/Config/Resource/SelfCheckingResourceChecker.php index eab332393ab28..b02101329bc7b 100644 --- a/src/Symfony/Component/Config/Resource/SelfCheckingResourceChecker.php +++ b/src/Symfony/Component/Config/Resource/SelfCheckingResourceChecker.php @@ -23,12 +23,12 @@ */ class SelfCheckingResourceChecker implements ResourceCheckerInterface { - public function supports(ResourceInterface $metadata) + public function supports(ResourceInterface $metadata): bool { return $metadata instanceof SelfCheckingResourceInterface; } - public function isFresh(ResourceInterface $resource, int $timestamp) + public function isFresh(ResourceInterface $resource, int $timestamp): bool { /* @var SelfCheckingResourceInterface $resource */ return $resource->isFresh($timestamp); diff --git a/src/Symfony/Component/Config/Resource/SelfCheckingResourceInterface.php b/src/Symfony/Component/Config/Resource/SelfCheckingResourceInterface.php index c08d96973ec95..ab508586eb657 100644 --- a/src/Symfony/Component/Config/Resource/SelfCheckingResourceInterface.php +++ b/src/Symfony/Component/Config/Resource/SelfCheckingResourceInterface.php @@ -26,5 +26,5 @@ interface SelfCheckingResourceInterface extends ResourceInterface * * @return bool True if the resource has not been updated, false otherwise */ - public function isFresh(int $timestamp); + public function isFresh(int $timestamp): bool; } diff --git a/src/Symfony/Component/Config/ResourceCheckerConfigCache.php b/src/Symfony/Component/Config/ResourceCheckerConfigCache.php index 00e5c5763181c..10aff627c40ca 100644 --- a/src/Symfony/Component/Config/ResourceCheckerConfigCache.php +++ b/src/Symfony/Component/Config/ResourceCheckerConfigCache.php @@ -43,7 +43,7 @@ public function __construct(string $file, iterable $resourceCheckers = []) /** * {@inheritdoc} */ - public function getPath() + public function getPath(): string { return $this->file; } @@ -59,7 +59,7 @@ public function getPath() * * @return bool true if the cache is fresh, false otherwise */ - public function isFresh() + public function isFresh(): bool { if (!is_file($this->file)) { return false; diff --git a/src/Symfony/Component/Config/ResourceCheckerConfigCacheFactory.php b/src/Symfony/Component/Config/ResourceCheckerConfigCacheFactory.php index 61bdf17c46e18..4f6657bdc8ade 100644 --- a/src/Symfony/Component/Config/ResourceCheckerConfigCacheFactory.php +++ b/src/Symfony/Component/Config/ResourceCheckerConfigCacheFactory.php @@ -32,7 +32,7 @@ public function __construct(iterable $resourceCheckers = []) /** * {@inheritdoc} */ - public function cache(string $file, callable $callable) + public function cache(string $file, callable $callable): ConfigCacheInterface { $cache = new ResourceCheckerConfigCache($file, $this->resourceCheckers); if (!$cache->isFresh()) { diff --git a/src/Symfony/Component/Config/Util/XmlUtils.php b/src/Symfony/Component/Config/Util/XmlUtils.php index 3dae231db5066..60d7e4a1c5944 100644 --- a/src/Symfony/Component/Config/Util/XmlUtils.php +++ b/src/Symfony/Component/Config/Util/XmlUtils.php @@ -44,7 +44,7 @@ private function __construct() * @throws InvalidXmlException When parsing of XML with schema or callable produces any errors unrelated to the XML parsing itself * @throws \RuntimeException When DOM extension is missing */ - public static function parse(string $content, string|callable $schemaOrCallable = null) + public static function parse(string $content, string|callable $schemaOrCallable = null): \DOMDocument { if (!\extension_loaded('dom')) { throw new \LogicException('Extension DOM is required.'); @@ -116,7 +116,7 @@ public static function parse(string $content, string|callable $schemaOrCallable * @throws XmlParsingException When XML parsing returns any errors * @throws \RuntimeException When DOM extension is missing */ - public static function loadFile(string $file, string|callable $schemaOrCallable = null) + public static function loadFile(string $file, string|callable $schemaOrCallable = null): \DOMDocument { if (!is_file($file)) { throw new \InvalidArgumentException(sprintf('Resource "%s" is not a file.', $file)); @@ -159,7 +159,7 @@ public static function loadFile(string $file, string|callable $schemaOrCallable * * @return mixed */ - public static function convertDomElementToArray(\DOMElement $element, bool $checkPrefix = true) + public static function convertDomElementToArray(\DOMElement $element, bool $checkPrefix = true): mixed { $prefix = (string) $element->prefix; $empty = true; @@ -215,7 +215,7 @@ public static function convertDomElementToArray(\DOMElement $element, bool $chec * * @return mixed */ - public static function phpize(string|\Stringable $value) + public static function phpize(string|\Stringable $value): mixed { $value = (string) $value; $lowercaseValue = strtolower($value); diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index 477121bbc13b5..17006bccc70af 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -130,7 +130,7 @@ public function setSignalsToDispatchEvent(int ...$signalsToDispatchEvent) * * @throws \Exception When running fails. Bypass this when {@link setCatchExceptions()}. */ - public function run(InputInterface $input = null, OutputInterface $output = null) + public function run(InputInterface $input = null, OutputInterface $output = null): int { if (\function_exists('putenv')) { @putenv('LINES='.$this->terminal->getHeight()); @@ -315,7 +315,7 @@ public function setHelperSet(HelperSet $helperSet) * * @return HelperSet */ - public function getHelperSet() + public function getHelperSet(): HelperSet { if (!$this->helperSet) { $this->helperSet = $this->getDefaultHelperSet(); @@ -334,7 +334,7 @@ public function setDefinition(InputDefinition $definition) * * @return InputDefinition */ - public function getDefinition() + public function getDefinition(): InputDefinition { if (!$this->definition) { $this->definition = $this->getDefaultInputDefinition(); @@ -355,7 +355,7 @@ public function getDefinition() * * @return string A help message */ - public function getHelp() + public function getHelp(): string { return $this->getLongVersion(); } @@ -365,7 +365,7 @@ public function getHelp() * * @return bool Whether to catch exceptions or not during commands execution */ - public function areExceptionsCaught() + public function areExceptionsCaught(): bool { return $this->catchExceptions; } @@ -383,7 +383,7 @@ public function setCatchExceptions(bool $boolean) * * @return bool Whether to automatically exit after a command execution or not */ - public function isAutoExitEnabled() + public function isAutoExitEnabled(): bool { return $this->autoExit; } @@ -401,7 +401,7 @@ public function setAutoExit(bool $boolean) * * @return string The application name */ - public function getName() + public function getName(): string { return $this->name; } @@ -419,7 +419,7 @@ public function setName(string $name) * * @return string The application version */ - public function getVersion() + public function getVersion(): string { return $this->version; } @@ -455,7 +455,7 @@ public function getLongVersion() * * @return Command The newly created command */ - public function register(string $name) + public function register(string $name): Command { return $this->add(new Command($name)); } @@ -551,7 +551,7 @@ public function get(string $name) * * @return bool true if the command exists, false otherwise */ - public function has(string $name) + public function has(string $name): bool { $this->init(); @@ -565,7 +565,7 @@ public function has(string $name) * * @return string[] An array of namespaces */ - public function getNamespaces() + public function getNamespaces(): array { $namespaces = []; foreach ($this->all() as $command) { @@ -590,7 +590,7 @@ public function getNamespaces() * * @throws NamespaceNotFoundException When namespace is incorrect or ambiguous */ - public function findNamespace(string $namespace) + public function findNamespace(string $namespace): string { $allNamespaces = $this->getNamespaces(); $expr = implode('[^:]*:', array_map('preg_quote', explode(':', $namespace))).'[^:]*'; @@ -782,7 +782,7 @@ public function all(string $namespace = null) * * @return string[][] An array of abbreviations */ - public static function getAbbreviations(array $names) + public static function getAbbreviations(array $names): array { $abbrevs = []; foreach ($names as $name) { @@ -1022,7 +1022,7 @@ protected function doRunCommand(Command $command, InputInterface $input, OutputI * * @return string|null */ - protected function getCommandName(InputInterface $input) + protected function getCommandName(InputInterface $input): ?string { return $this->singleCommand ? $this->defaultCommand : $input->getFirstArgument(); } @@ -1032,7 +1032,7 @@ protected function getCommandName(InputInterface $input) * * @return InputDefinition */ - protected function getDefaultInputDefinition() + protected function getDefaultInputDefinition(): InputDefinition { return new InputDefinition([ new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'), @@ -1050,7 +1050,7 @@ protected function getDefaultInputDefinition() * * @return Command[] */ - protected function getDefaultCommands() + protected function getDefaultCommands(): array { return [new HelpCommand(), new ListCommand()]; } @@ -1060,7 +1060,7 @@ protected function getDefaultCommands() * * @return HelperSet */ - protected function getDefaultHelperSet() + protected function getDefaultHelperSet(): HelperSet { return new HelperSet([ new FormatterHelper(), @@ -1085,7 +1085,7 @@ private function getAbbreviationSuggestions(array $abbrevs): string * * @return string The namespace of the command */ - public function extractNamespace(string $name, int $limit = null) + public function extractNamespace(string $name, int $limit = null): string { $parts = explode(':', $name, -1); @@ -1142,10 +1142,8 @@ private function findAlternatives(string $name, iterable $collection): array /** * Sets the default Command name. - * - * @return self */ - public function setDefaultCommand(string $commandName, bool $isSingleCommand = false) + public function setDefaultCommand(string $commandName, bool $isSingleCommand = false): static { $this->defaultCommand = explode('|', ltrim($commandName, '|'))[0]; diff --git a/src/Symfony/Component/Console/Command/Command.php b/src/Symfony/Component/Console/Command/Command.php index ea44f88f234b2..d11b84dd97a95 100644 --- a/src/Symfony/Component/Console/Command/Command.php +++ b/src/Symfony/Component/Console/Command/Command.php @@ -63,7 +63,7 @@ class Command /** * @return string|null The default command name or null when no default name is set */ - public static function getDefaultName() + public static function getDefaultName(): ?string { $class = static::class; @@ -155,7 +155,7 @@ public function setHelperSet(HelperSet $helperSet) * * @return HelperSet|null */ - public function getHelperSet() + public function getHelperSet(): ?HelperSet { return $this->helperSet; } @@ -165,7 +165,7 @@ public function getHelperSet() * * @return Application|null */ - public function getApplication() + public function getApplication(): ?Application { return $this->application; } @@ -248,7 +248,7 @@ protected function initialize(InputInterface $input, OutputInterface $output) * @see setCode() * @see execute() */ - public function run(InputInterface $input, OutputInterface $output) + public function run(InputInterface $input, OutputInterface $output): int { // add the application arguments and options $this->mergeApplicationDefinition(); @@ -320,7 +320,7 @@ public function run(InputInterface $input, OutputInterface $output) * * @see execute() */ - public function setCode(callable $code) + public function setCode(callable $code): static { if ($code instanceof \Closure) { $r = new \ReflectionFunction($code); @@ -373,7 +373,7 @@ public function mergeApplicationDefinition(bool $mergeArgs = true) * * @return $this */ - public function setDefinition(array|InputDefinition $definition) + public function setDefinition(array|InputDefinition $definition): static { if ($definition instanceof InputDefinition) { $this->definition = $definition; @@ -391,7 +391,7 @@ public function setDefinition(array|InputDefinition $definition) * * @return InputDefinition */ - public function getDefinition() + public function getDefinition(): InputDefinition { return $this->fullDefinition ?? $this->getNativeDefinition(); } @@ -406,7 +406,7 @@ public function getDefinition() * * @return InputDefinition */ - public function getNativeDefinition() + public function getNativeDefinition(): InputDefinition { if (null === $this->definition) { throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', static::class)); @@ -425,7 +425,7 @@ public function getNativeDefinition() * * @return $this */ - public function addArgument(string $name, int $mode = null, string $description = '', mixed $default = null) + public function addArgument(string $name, int $mode = null, string $description = '', mixed $default = null): static { $this->definition->addArgument(new InputArgument($name, $mode, $description, $default)); if (null !== $this->fullDefinition) { @@ -446,7 +446,7 @@ public function addArgument(string $name, int $mode = null, string $description * * @return $this */ - public function addOption(string $name, string|array $shortcut = null, int $mode = null, string $description = '', mixed $default = null) + public function addOption(string $name, string|array $shortcut = null, int $mode = null, string $description = '', mixed $default = null): static { $this->definition->addOption(new InputOption($name, $shortcut, $mode, $description, $default)); if (null !== $this->fullDefinition) { @@ -468,7 +468,7 @@ public function addOption(string $name, string|array $shortcut = null, int $mode * * @throws InvalidArgumentException When the name is invalid */ - public function setName(string $name) + public function setName(string $name): static { $this->validateName($name); @@ -485,7 +485,7 @@ public function setName(string $name) * * @return $this */ - public function setProcessTitle(string $title) + public function setProcessTitle(string $title): static { $this->processTitle = $title; @@ -497,7 +497,7 @@ public function setProcessTitle(string $title) * * @return string|null */ - public function getName() + public function getName(): ?string { return $this->name; } @@ -517,7 +517,7 @@ public function setHidden(bool $hidden = true): static /** * @return bool whether the command should be publicly shown or not */ - public function isHidden() + public function isHidden(): bool { return $this->hidden; } @@ -527,7 +527,7 @@ public function isHidden() * * @return $this */ - public function setDescription(string $description) + public function setDescription(string $description): static { $this->description = $description; @@ -539,7 +539,7 @@ public function setDescription(string $description) * * @return string The description for the command */ - public function getDescription() + public function getDescription(): string { return $this->description; } @@ -549,7 +549,7 @@ public function getDescription() * * @return $this */ - public function setHelp(string $help) + public function setHelp(string $help): static { $this->help = $help; @@ -561,7 +561,7 @@ public function setHelp(string $help) * * @return string The help for the command */ - public function getHelp() + public function getHelp(): string { return $this->help; } @@ -572,7 +572,7 @@ public function getHelp() * * @return string The processed help for the command */ - public function getProcessedHelp() + public function getProcessedHelp(): string { $name = $this->name; $isSingleCommand = $this->application && $this->application->isSingleCommand(); @@ -598,7 +598,7 @@ public function getProcessedHelp() * * @throws InvalidArgumentException When an alias is invalid */ - public function setAliases(iterable $aliases) + public function setAliases(iterable $aliases): static { $list = []; @@ -617,7 +617,7 @@ public function setAliases(iterable $aliases) * * @return array An array of aliases for the command */ - public function getAliases() + public function getAliases(): array { return $this->aliases; } @@ -629,7 +629,7 @@ public function getAliases() * * @return string The synopsis */ - public function getSynopsis(bool $short = false) + public function getSynopsis(bool $short = false): string { $key = $short ? 'short' : 'long'; @@ -645,7 +645,7 @@ public function getSynopsis(bool $short = false) * * @return $this */ - public function addUsage(string $usage) + public function addUsage(string $usage): static { if (!str_starts_with($usage, $this->name)) { $usage = sprintf('%s %s', $this->name, $usage); @@ -661,7 +661,7 @@ public function addUsage(string $usage) * * @return array */ - public function getUsages() + public function getUsages(): array { return $this->usages; } @@ -674,7 +674,7 @@ public function getUsages() * @throws LogicException if no HelperSet is defined * @throws InvalidArgumentException if the helper is not defined */ - public function getHelper(string $name) + public function getHelper(string $name): mixed { if (null === $this->helperSet) { throw new LogicException(sprintf('Cannot retrieve helper "%s" because there is no HelperSet defined. Did you forget to add your command to the application or to set the application on the command using the setApplication() method? You can also set the HelperSet directly using the setHelperSet() method.', $name)); diff --git a/src/Symfony/Component/Console/Command/HelpCommand.php b/src/Symfony/Component/Console/Command/HelpCommand.php index 9bcd7764d7b55..72a0792927df9 100644 --- a/src/Symfony/Component/Console/Command/HelpCommand.php +++ b/src/Symfony/Component/Console/Command/HelpCommand.php @@ -64,7 +64,7 @@ public function setCommand(Command $command) /** * {@inheritdoc} */ - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { if (null === $this->command) { $this->command = $this->getApplication()->find($input->getArgument('command_name')); diff --git a/src/Symfony/Component/Console/Command/ListCommand.php b/src/Symfony/Component/Console/Command/ListCommand.php index a192285128490..ef9873e748edb 100644 --- a/src/Symfony/Component/Console/Command/ListCommand.php +++ b/src/Symfony/Component/Console/Command/ListCommand.php @@ -62,7 +62,7 @@ protected function configure() /** * {@inheritdoc} */ - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $helper = new DescriptorHelper(); $helper->describe($output, $this->getApplication(), [ diff --git a/src/Symfony/Component/Console/CommandLoader/CommandLoaderInterface.php b/src/Symfony/Component/Console/CommandLoader/CommandLoaderInterface.php index d4f44e88fd974..d297ceb2409e0 100644 --- a/src/Symfony/Component/Console/CommandLoader/CommandLoaderInterface.php +++ b/src/Symfony/Component/Console/CommandLoader/CommandLoaderInterface.php @@ -26,17 +26,17 @@ interface CommandLoaderInterface * * @throws CommandNotFoundException */ - public function get(string $name); + public function get(string $name): Command; /** * Checks if a command exists. * * @return bool */ - public function has(string $name); + public function has(string $name): bool; /** * @return string[] All registered command names */ - public function getNames(); + public function getNames(): array; } diff --git a/src/Symfony/Component/Console/CommandLoader/ContainerCommandLoader.php b/src/Symfony/Component/Console/CommandLoader/ContainerCommandLoader.php index ddccb3d45f416..ede9096f5246e 100644 --- a/src/Symfony/Component/Console/CommandLoader/ContainerCommandLoader.php +++ b/src/Symfony/Component/Console/CommandLoader/ContainerCommandLoader.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Console\CommandLoader; +use Symfony\Component\Console\Command\Command; use Psr\Container\ContainerInterface; use Symfony\Component\Console\Exception\CommandNotFoundException; @@ -36,7 +37,7 @@ public function __construct(ContainerInterface $container, array $commandMap) /** * {@inheritdoc} */ - public function get(string $name) + public function get(string $name): Command { if (!$this->has($name)) { throw new CommandNotFoundException(sprintf('Command "%s" does not exist.', $name)); @@ -48,7 +49,7 @@ public function get(string $name) /** * {@inheritdoc} */ - public function has(string $name) + public function has(string $name): bool { return isset($this->commandMap[$name]) && $this->container->has($this->commandMap[$name]); } @@ -56,7 +57,7 @@ public function has(string $name) /** * {@inheritdoc} */ - public function getNames() + public function getNames(): array { return array_keys($this->commandMap); } diff --git a/src/Symfony/Component/Console/CommandLoader/FactoryCommandLoader.php b/src/Symfony/Component/Console/CommandLoader/FactoryCommandLoader.php index 7e2db346471a2..1c64bb872b481 100644 --- a/src/Symfony/Component/Console/CommandLoader/FactoryCommandLoader.php +++ b/src/Symfony/Component/Console/CommandLoader/FactoryCommandLoader.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Console\CommandLoader; +use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Exception\CommandNotFoundException; /** @@ -33,7 +34,7 @@ public function __construct(array $factories) /** * {@inheritdoc} */ - public function has(string $name) + public function has(string $name): bool { return isset($this->factories[$name]); } @@ -41,7 +42,7 @@ public function has(string $name) /** * {@inheritdoc} */ - public function get(string $name) + public function get(string $name): Command { if (!isset($this->factories[$name])) { throw new CommandNotFoundException(sprintf('Command "%s" does not exist.', $name)); @@ -55,7 +56,7 @@ public function get(string $name) /** * {@inheritdoc} */ - public function getNames() + public function getNames(): array { return array_keys($this->factories); } diff --git a/src/Symfony/Component/Console/Event/ConsoleEvent.php b/src/Symfony/Component/Console/Event/ConsoleEvent.php index fba4d28fbd5b6..b63e756b2694d 100644 --- a/src/Symfony/Component/Console/Event/ConsoleEvent.php +++ b/src/Symfony/Component/Console/Event/ConsoleEvent.php @@ -40,7 +40,7 @@ public function __construct(Command $command = null, InputInterface $input, Outp * * @return Command|null */ - public function getCommand() + public function getCommand(): ?Command { return $this->command; } @@ -50,7 +50,7 @@ public function getCommand() * * @return InputInterface */ - public function getInput() + public function getInput(): InputInterface { return $this->input; } @@ -60,7 +60,7 @@ public function getInput() * * @return OutputInterface */ - public function getOutput() + public function getOutput(): OutputInterface { return $this->output; } diff --git a/src/Symfony/Component/Console/EventListener/ErrorListener.php b/src/Symfony/Component/Console/EventListener/ErrorListener.php index 5f34ca4c0adf3..61bd9d3443a4e 100644 --- a/src/Symfony/Component/Console/EventListener/ErrorListener.php +++ b/src/Symfony/Component/Console/EventListener/ErrorListener.php @@ -69,7 +69,7 @@ public function onConsoleTerminate(ConsoleTerminateEvent $event) $this->logger->debug('Command "{command}" exited with code "{code}"', ['command' => $inputString, 'code' => $exitCode]); } - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ ConsoleEvents::ERROR => ['onConsoleError', -128], diff --git a/src/Symfony/Component/Console/Exception/CommandNotFoundException.php b/src/Symfony/Component/Console/Exception/CommandNotFoundException.php index 590a71c779642..9aca96c77ae52 100644 --- a/src/Symfony/Component/Console/Exception/CommandNotFoundException.php +++ b/src/Symfony/Component/Console/Exception/CommandNotFoundException.php @@ -36,7 +36,7 @@ public function __construct(string $message, array $alternatives = [], int $code /** * @return string[] A list of similar defined names */ - public function getAlternatives() + public function getAlternatives(): array { return $this->alternatives; } diff --git a/src/Symfony/Component/Console/Formatter/OutputFormatter.php b/src/Symfony/Component/Console/Formatter/OutputFormatter.php index 80d59b3b4d155..5cc1fb307e209 100644 --- a/src/Symfony/Component/Console/Formatter/OutputFormatter.php +++ b/src/Symfony/Component/Console/Formatter/OutputFormatter.php @@ -38,7 +38,7 @@ public function __clone() * * @return string Escaped text */ - public static function escape(string $text) + public static function escape(string $text): string { $text = preg_replace('/([^\\\\]?)decorated; } @@ -110,7 +110,7 @@ public function setStyle(string $name, OutputFormatterStyleInterface $style) /** * {@inheritdoc} */ - public function hasStyle(string $name) + public function hasStyle(string $name): bool { return isset($this->styles[strtolower($name)]); } @@ -118,7 +118,7 @@ public function hasStyle(string $name) /** * {@inheritdoc} */ - public function getStyle(string $name) + public function getStyle(string $name): OutputFormatterStyleInterface { if (!$this->hasStyle($name)) { throw new InvalidArgumentException(sprintf('Undefined style: "%s".', $name)); @@ -130,7 +130,7 @@ public function getStyle(string $name) /** * {@inheritdoc} */ - public function format(?string $message) + public function format(?string $message): ?string { return $this->formatAndWrap($message, 0); } @@ -188,7 +188,7 @@ public function formatAndWrap(?string $message, int $width) /** * @return OutputFormatterStyleStack */ - public function getStyleStack() + public function getStyleStack(): OutputFormatterStyleStack { return $this->styleStack; } diff --git a/src/Symfony/Component/Console/Formatter/OutputFormatterInterface.php b/src/Symfony/Component/Console/Formatter/OutputFormatterInterface.php index 41474eacd162c..c6b9ab62f33f9 100644 --- a/src/Symfony/Component/Console/Formatter/OutputFormatterInterface.php +++ b/src/Symfony/Component/Console/Formatter/OutputFormatterInterface.php @@ -28,7 +28,7 @@ public function setDecorated(bool $decorated); * * @return bool true if the output will decorate messages, false otherwise */ - public function isDecorated(); + public function isDecorated(): bool; /** * Sets a new style. @@ -40,7 +40,7 @@ public function setStyle(string $name, OutputFormatterStyleInterface $style); * * @return bool */ - public function hasStyle(string $name); + public function hasStyle(string $name): bool; /** * Gets style options from style with specified name. @@ -49,12 +49,12 @@ public function hasStyle(string $name); * * @throws \InvalidArgumentException When style isn't defined */ - public function getStyle(string $name); + public function getStyle(string $name): OutputFormatterStyleInterface; /** * Formats a message according to the given styles. * * @return string|null */ - public function format(?string $message); + public function format(?string $message): ?string; } diff --git a/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php b/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php index 0fb36ac632575..6514549a787b5 100644 --- a/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php +++ b/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php @@ -92,7 +92,7 @@ public function setOptions(array $options) /** * {@inheritdoc} */ - public function apply(string $text) + public function apply(string $text): string { if (null === $this->handlesHrefGracefully) { $this->handlesHrefGracefully = 'JetBrains-JediTerm' !== getenv('TERMINAL_EMULATOR') diff --git a/src/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php b/src/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php index b30560d22e161..120759f296fbc 100644 --- a/src/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php +++ b/src/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php @@ -48,5 +48,5 @@ public function setOptions(array $options); * * @return string */ - public function apply(string $text); + public function apply(string $text): string; } diff --git a/src/Symfony/Component/Console/Formatter/OutputFormatterStyleStack.php b/src/Symfony/Component/Console/Formatter/OutputFormatterStyleStack.php index fc48dc0e15e6a..a5695b1a53902 100644 --- a/src/Symfony/Component/Console/Formatter/OutputFormatterStyleStack.php +++ b/src/Symfony/Component/Console/Formatter/OutputFormatterStyleStack.php @@ -55,7 +55,7 @@ public function push(OutputFormatterStyleInterface $style) * * @throws InvalidArgumentException When style tags incorrectly nested */ - public function pop(OutputFormatterStyleInterface $style = null) + public function pop(OutputFormatterStyleInterface $style = null): OutputFormatterStyleInterface { if (empty($this->styles)) { return $this->emptyStyle; @@ -81,7 +81,7 @@ public function pop(OutputFormatterStyleInterface $style = null) * * @return OutputFormatterStyle */ - public function getCurrent() + public function getCurrent(): OutputFormatterStyle { if (empty($this->styles)) { return $this->emptyStyle; @@ -93,7 +93,7 @@ public function getCurrent() /** * @return $this */ - public function setEmptyStyle(OutputFormatterStyleInterface $emptyStyle) + public function setEmptyStyle(OutputFormatterStyleInterface $emptyStyle): static { $this->emptyStyle = $emptyStyle; @@ -103,7 +103,7 @@ public function setEmptyStyle(OutputFormatterStyleInterface $emptyStyle) /** * @return OutputFormatterStyleInterface */ - public function getEmptyStyle() + public function getEmptyStyle(): OutputFormatterStyleInterface { return $this->emptyStyle; } diff --git a/src/Symfony/Component/Console/Helper/DebugFormatterHelper.php b/src/Symfony/Component/Console/Helper/DebugFormatterHelper.php index 9d07ec2441eac..c1c281b21258d 100644 --- a/src/Symfony/Component/Console/Helper/DebugFormatterHelper.php +++ b/src/Symfony/Component/Console/Helper/DebugFormatterHelper.php @@ -29,7 +29,7 @@ class DebugFormatterHelper extends Helper * * @return string */ - public function start(string $id, string $message, string $prefix = 'RUN') + public function start(string $id, string $message, string $prefix = 'RUN'): string { $this->started[$id] = ['border' => ++$this->count % \count($this->colors)]; @@ -41,7 +41,7 @@ public function start(string $id, string $message, string $prefix = 'RUN') * * @return string */ - public function progress(string $id, string $buffer, bool $error = false, string $prefix = 'OUT', string $errorPrefix = 'ERR') + public function progress(string $id, string $buffer, bool $error = false, string $prefix = 'OUT', string $errorPrefix = 'ERR'): string { $message = ''; @@ -77,7 +77,7 @@ public function progress(string $id, string $buffer, bool $error = false, string * * @return string */ - public function stop(string $id, string $message, bool $successful, string $prefix = 'RES') + public function stop(string $id, string $message, bool $successful, string $prefix = 'RES'): string { $trailingEOL = isset($this->started[$id]['out']) || isset($this->started[$id]['err']) ? "\n" : ''; @@ -100,7 +100,7 @@ private function getBorder(string $id): string /** * {@inheritdoc} */ - public function getName() + public function getName(): string { return 'debug_formatter'; } diff --git a/src/Symfony/Component/Console/Helper/DescriptorHelper.php b/src/Symfony/Component/Console/Helper/DescriptorHelper.php index f2ad9db7a194c..e975edbdcb5bc 100644 --- a/src/Symfony/Component/Console/Helper/DescriptorHelper.php +++ b/src/Symfony/Component/Console/Helper/DescriptorHelper.php @@ -70,7 +70,7 @@ public function describe(OutputInterface $output, ?object $object, array $option * * @return $this */ - public function register(string $format, DescriptorInterface $descriptor) + public function register(string $format, DescriptorInterface $descriptor): static { $this->descriptors[$format] = $descriptor; @@ -80,7 +80,7 @@ public function register(string $format, DescriptorInterface $descriptor) /** * {@inheritdoc} */ - public function getName() + public function getName(): string { return 'descriptor'; } diff --git a/src/Symfony/Component/Console/Helper/FormatterHelper.php b/src/Symfony/Component/Console/Helper/FormatterHelper.php index b6c72b8810e82..6a6f26848a016 100644 --- a/src/Symfony/Component/Console/Helper/FormatterHelper.php +++ b/src/Symfony/Component/Console/Helper/FormatterHelper.php @@ -25,7 +25,7 @@ class FormatterHelper extends Helper * * @return string The format section */ - public function formatSection(string $section, string $message, string $style = 'info') + public function formatSection(string $section, string $message, string $style = 'info'): string { return sprintf('<%s>[%s] %s', $style, $section, $style, $message); } @@ -35,7 +35,7 @@ public function formatSection(string $section, string $message, string $style = * * @return string The formatter message */ - public function formatBlock(string|array $messages, string $style, bool $large = false) + public function formatBlock(string|array $messages, string $style, bool $large = false): string { if (!\is_array($messages)) { $messages = [$messages]; @@ -69,7 +69,7 @@ public function formatBlock(string|array $messages, string $style, bool $large = * * @return string */ - public function truncate(string $message, int $length, string $suffix = '...') + public function truncate(string $message, int $length, string $suffix = '...'): string { $computedLength = $length - self::width($suffix); @@ -83,7 +83,7 @@ public function truncate(string $message, int $length, string $suffix = '...') /** * {@inheritdoc} */ - public function getName() + public function getName(): string { return 'formatter'; } diff --git a/src/Symfony/Component/Console/Helper/Helper.php b/src/Symfony/Component/Console/Helper/Helper.php index bd408fa61cb3c..aa2c8adfff662 100644 --- a/src/Symfony/Component/Console/Helper/Helper.php +++ b/src/Symfony/Component/Console/Helper/Helper.php @@ -34,7 +34,7 @@ public function setHelperSet(HelperSet $helperSet = null) /** * {@inheritdoc} */ - public function getHelperSet() + public function getHelperSet(): ?HelperSet { return $this->helperSet; } @@ -82,7 +82,7 @@ public static function length(?string $string): int * * @return string The string subset */ - public static function substr(?string $string, int $from, int $length = null) + public static function substr(?string $string, int $from, int $length = null): string { $string ?? $string = ''; diff --git a/src/Symfony/Component/Console/Helper/HelperInterface.php b/src/Symfony/Component/Console/Helper/HelperInterface.php index e3b7f92561d0a..a87065a0f480b 100644 --- a/src/Symfony/Component/Console/Helper/HelperInterface.php +++ b/src/Symfony/Component/Console/Helper/HelperInterface.php @@ -25,15 +25,13 @@ public function setHelperSet(HelperSet $helperSet = null); /** * Gets the helper set associated with this helper. - * - * @return HelperSet|null */ - public function getHelperSet(); + public function getHelperSet(): ?HelperSet; /** * Returns the canonical name of this helper. * * @return string The canonical name */ - public function getName(); + public function getName(): string; } diff --git a/src/Symfony/Component/Console/Helper/HelperSet.php b/src/Symfony/Component/Console/Helper/HelperSet.php index 471acf58f818d..ebe9e5aff54a5 100644 --- a/src/Symfony/Component/Console/Helper/HelperSet.php +++ b/src/Symfony/Component/Console/Helper/HelperSet.php @@ -52,7 +52,7 @@ public function set(HelperInterface $helper, string $alias = null) * * @return bool true if the helper is defined, false otherwise */ - public function has(string $name) + public function has(string $name): bool { return isset($this->helpers[$name]); } @@ -64,7 +64,7 @@ public function has(string $name) * * @throws InvalidArgumentException if the helper is not defined */ - public function get(string $name) + public function get(string $name): HelperInterface { if (!$this->has($name)) { throw new InvalidArgumentException(sprintf('The helper "%s" is not defined.', $name)); @@ -83,7 +83,7 @@ public function setCommand(Command $command = null) * * @return Command */ - public function getCommand() + public function getCommand(): Command { return $this->command; } diff --git a/src/Symfony/Component/Console/Helper/ProgressIndicator.php b/src/Symfony/Component/Console/Helper/ProgressIndicator.php index 2d8774201abf5..cbe9a88feb2bb 100644 --- a/src/Symfony/Component/Console/Helper/ProgressIndicator.php +++ b/src/Symfony/Component/Console/Helper/ProgressIndicator.php @@ -136,7 +136,7 @@ public function finish(string $message) * * @return string|null A format string */ - public static function getFormatDefinition(string $name) + public static function getFormatDefinition(string $name): ?string { if (!self::$formats) { self::$formats = self::initFormats(); @@ -164,7 +164,7 @@ public static function setPlaceholderFormatterDefinition(string $name, callable * * @return callable|null A PHP callable */ - public static function getPlaceholderFormatterDefinition(string $name) + public static function getPlaceholderFormatterDefinition(string $name): ?callable { if (!self::$formatters) { self::$formatters = self::initPlaceholderFormatters(); diff --git a/src/Symfony/Component/Console/Helper/QuestionHelper.php b/src/Symfony/Component/Console/Helper/QuestionHelper.php index 6423b50e44046..170cecc5176b9 100644 --- a/src/Symfony/Component/Console/Helper/QuestionHelper.php +++ b/src/Symfony/Component/Console/Helper/QuestionHelper.php @@ -45,7 +45,7 @@ class QuestionHelper extends Helper * * @throws RuntimeException If there is no data to read in the input stream */ - public function ask(InputInterface $input, OutputInterface $output, Question $question) + public function ask(InputInterface $input, OutputInterface $output, Question $question): mixed { if ($output instanceof ConsoleOutputInterface) { $output = $output->getErrorOutput(); @@ -83,7 +83,7 @@ public function ask(InputInterface $input, OutputInterface $output, Question $qu /** * {@inheritdoc} */ - public function getName() + public function getName(): string { return 'question'; } @@ -196,7 +196,7 @@ protected function writePrompt(OutputInterface $output, Question $question) /** * @return string[] */ - protected function formatChoiceQuestionChoices(ChoiceQuestion $question, string $tag) + protected function formatChoiceQuestionChoices(ChoiceQuestion $question, string $tag): array { $messages = []; diff --git a/src/Symfony/Component/Console/Helper/Table.php b/src/Symfony/Component/Console/Helper/Table.php index 146c1410b342f..8f94bc5e984fc 100644 --- a/src/Symfony/Component/Console/Helper/Table.php +++ b/src/Symfony/Component/Console/Helper/Table.php @@ -117,7 +117,7 @@ public static function setStyleDefinition(string $name, TableStyle $style) * * @return TableStyle */ - public static function getStyleDefinition(string $name) + public static function getStyleDefinition(string $name): TableStyle { if (!self::$styles) { self::$styles = self::initStyles(); @@ -135,7 +135,7 @@ public static function getStyleDefinition(string $name) * * @return $this */ - public function setStyle(TableStyle|string $name) + public function setStyle(TableStyle|string $name): static { $this->style = $this->resolveStyle($name); @@ -147,7 +147,7 @@ public function setStyle(TableStyle|string $name) * * @return TableStyle */ - public function getStyle() + public function getStyle(): TableStyle { return $this->style; } @@ -159,7 +159,7 @@ public function getStyle() * * @return $this */ - public function setColumnStyle(int $columnIndex, TableStyle|string $name) + public function setColumnStyle(int $columnIndex, TableStyle|string $name): static { $this->columnStyles[$columnIndex] = $this->resolveStyle($name); @@ -173,7 +173,7 @@ public function setColumnStyle(int $columnIndex, TableStyle|string $name) * * @return TableStyle */ - public function getColumnStyle(int $columnIndex) + public function getColumnStyle(int $columnIndex): TableStyle { return $this->columnStyles[$columnIndex] ?? $this->getStyle(); } @@ -183,7 +183,7 @@ public function getColumnStyle(int $columnIndex) * * @return $this */ - public function setColumnWidth(int $columnIndex, int $width) + public function setColumnWidth(int $columnIndex, int $width): static { $this->columnWidths[$columnIndex] = $width; @@ -195,7 +195,7 @@ public function setColumnWidth(int $columnIndex, int $width) * * @return $this */ - public function setColumnWidths(array $widths) + public function setColumnWidths(array $widths): static { $this->columnWidths = []; foreach ($widths as $index => $width) { @@ -213,7 +213,7 @@ public function setColumnWidths(array $widths) * * @return $this */ - public function setColumnMaxWidth(int $columnIndex, int $width): self + public function setColumnMaxWidth(int $columnIndex, int $width): static { if (!$this->output->getFormatter() instanceof WrappableOutputFormatterInterface) { throw new \LogicException(sprintf('Setting a maximum column width is only supported when using a "%s" formatter, got "%s".', WrappableOutputFormatterInterface::class, get_debug_type($this->output->getFormatter()))); diff --git a/src/Symfony/Component/Console/Helper/TableCell.php b/src/Symfony/Component/Console/Helper/TableCell.php index 6abeacb090a30..2897319b127b7 100644 --- a/src/Symfony/Component/Console/Helper/TableCell.php +++ b/src/Symfony/Component/Console/Helper/TableCell.php @@ -54,7 +54,7 @@ public function __toString(): string * * @return int */ - public function getColspan() + public function getColspan(): int { return (int) $this->options['colspan']; } @@ -64,7 +64,7 @@ public function getColspan() * * @return int */ - public function getRowspan() + public function getRowspan(): int { return (int) $this->options['rowspan']; } diff --git a/src/Symfony/Component/Console/Helper/TableCellStyle.php b/src/Symfony/Component/Console/Helper/TableCellStyle.php index ad9aea83b18cb..c2ff198b2223b 100644 --- a/src/Symfony/Component/Console/Helper/TableCellStyle.php +++ b/src/Symfony/Component/Console/Helper/TableCellStyle.php @@ -63,7 +63,7 @@ public function getOptions(): array * * @return string[] */ - public function getTagOptions() + public function getTagOptions(): array { return array_filter( $this->getOptions(), diff --git a/src/Symfony/Component/Console/Helper/TableStyle.php b/src/Symfony/Component/Console/Helper/TableStyle.php index 07265b467ae5e..c260fd9d709ae 100644 --- a/src/Symfony/Component/Console/Helper/TableStyle.php +++ b/src/Symfony/Component/Console/Helper/TableStyle.php @@ -53,7 +53,7 @@ class TableStyle * * @return $this */ - public function setPaddingChar(string $paddingChar) + public function setPaddingChar(string $paddingChar): static { if (!$paddingChar) { throw new LogicException('The padding char must not be empty.'); @@ -69,7 +69,7 @@ public function setPaddingChar(string $paddingChar) * * @return string */ - public function getPaddingChar() + public function getPaddingChar(): string { return $this->paddingChar; } @@ -196,7 +196,7 @@ public function setDefaultCrossingChar(string $char): self * * @return string */ - public function getCrossingChar() + public function getCrossingChar(): string { return $this->crossingChar; } @@ -229,7 +229,7 @@ public function getCrossingChars(): array * * @return $this */ - public function setCellHeaderFormat(string $cellHeaderFormat) + public function setCellHeaderFormat(string $cellHeaderFormat): static { $this->cellHeaderFormat = $cellHeaderFormat; @@ -241,7 +241,7 @@ public function setCellHeaderFormat(string $cellHeaderFormat) * * @return string */ - public function getCellHeaderFormat() + public function getCellHeaderFormat(): string { return $this->cellHeaderFormat; } @@ -251,7 +251,7 @@ public function getCellHeaderFormat() * * @return $this */ - public function setCellRowFormat(string $cellRowFormat) + public function setCellRowFormat(string $cellRowFormat): static { $this->cellRowFormat = $cellRowFormat; @@ -263,7 +263,7 @@ public function setCellRowFormat(string $cellRowFormat) * * @return string */ - public function getCellRowFormat() + public function getCellRowFormat(): string { return $this->cellRowFormat; } @@ -273,7 +273,7 @@ public function getCellRowFormat() * * @return $this */ - public function setCellRowContentFormat(string $cellRowContentFormat) + public function setCellRowContentFormat(string $cellRowContentFormat): static { $this->cellRowContentFormat = $cellRowContentFormat; @@ -285,7 +285,7 @@ public function setCellRowContentFormat(string $cellRowContentFormat) * * @return string */ - public function getCellRowContentFormat() + public function getCellRowContentFormat(): string { return $this->cellRowContentFormat; } @@ -295,7 +295,7 @@ public function getCellRowContentFormat() * * @return $this */ - public function setBorderFormat(string $borderFormat) + public function setBorderFormat(string $borderFormat): static { $this->borderFormat = $borderFormat; @@ -307,7 +307,7 @@ public function setBorderFormat(string $borderFormat) * * @return string */ - public function getBorderFormat() + public function getBorderFormat(): string { return $this->borderFormat; } @@ -317,7 +317,7 @@ public function getBorderFormat() * * @return $this */ - public function setPadType(int $padType) + public function setPadType(int $padType): static { if (!\in_array($padType, [\STR_PAD_LEFT, \STR_PAD_RIGHT, \STR_PAD_BOTH], true)) { throw new InvalidArgumentException('Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH).'); @@ -333,7 +333,7 @@ public function setPadType(int $padType) * * @return int */ - public function getPadType() + public function getPadType(): int { return $this->padType; } diff --git a/src/Symfony/Component/Console/Input/ArgvInput.php b/src/Symfony/Component/Console/Input/ArgvInput.php index 67323b53608a0..62acac895fbc9 100644 --- a/src/Symfony/Component/Console/Input/ArgvInput.php +++ b/src/Symfony/Component/Console/Input/ArgvInput.php @@ -259,7 +259,7 @@ private function addLongOption(string $name, mixed $value) /** * {@inheritdoc} */ - public function getFirstArgument() + public function getFirstArgument(): ?string { $isOption = false; foreach ($this->tokens as $i => $token) { @@ -294,7 +294,7 @@ public function getFirstArgument() /** * {@inheritdoc} */ - public function hasParameterOption(string|array $values, bool $onlyParams = false) + public function hasParameterOption(string|array $values, bool $onlyParams = false): bool { $values = (array) $values; @@ -319,7 +319,7 @@ public function hasParameterOption(string|array $values, bool $onlyParams = fals /** * {@inheritdoc} */ - public function getParameterOption(string|array $values, string|bool|int|float|array|null $default = false, bool $onlyParams = false) + public function getParameterOption(string|array $values, string|bool|int|float|array|null $default = false, bool $onlyParams = false): mixed { $values = (array) $values; $tokens = $this->tokens; diff --git a/src/Symfony/Component/Console/Input/ArrayInput.php b/src/Symfony/Component/Console/Input/ArrayInput.php index cd2ae77977951..4c423b08bd16a 100644 --- a/src/Symfony/Component/Console/Input/ArrayInput.php +++ b/src/Symfony/Component/Console/Input/ArrayInput.php @@ -37,7 +37,7 @@ public function __construct(array $parameters, InputDefinition $definition = nul /** * {@inheritdoc} */ - public function getFirstArgument() + public function getFirstArgument(): ?string { foreach ($this->parameters as $param => $value) { if ($param && \is_string($param) && '-' === $param[0]) { @@ -53,7 +53,7 @@ public function getFirstArgument() /** * {@inheritdoc} */ - public function hasParameterOption(string|array $values, bool $onlyParams = false) + public function hasParameterOption(string|array $values, bool $onlyParams = false): bool { $values = (array) $values; @@ -77,7 +77,7 @@ public function hasParameterOption(string|array $values, bool $onlyParams = fals /** * {@inheritdoc} */ - public function getParameterOption(string|array $values, string|bool|int|float|array|null $default = false, bool $onlyParams = false) + public function getParameterOption(string|array $values, string|bool|int|float|array|null $default = false, bool $onlyParams = false): mixed { $values = (array) $values; diff --git a/src/Symfony/Component/Console/Input/Input.php b/src/Symfony/Component/Console/Input/Input.php index e8b30b9c663ec..c77885b2268c6 100644 --- a/src/Symfony/Component/Console/Input/Input.php +++ b/src/Symfony/Component/Console/Input/Input.php @@ -80,7 +80,7 @@ public function validate() /** * {@inheritdoc} */ - public function isInteractive() + public function isInteractive(): bool { return $this->interactive; } @@ -96,7 +96,7 @@ public function setInteractive(bool $interactive) /** * {@inheritdoc} */ - public function getArguments() + public function getArguments(): array { return array_merge($this->definition->getArgumentDefaults(), $this->arguments); } @@ -104,7 +104,7 @@ public function getArguments() /** * {@inheritdoc} */ - public function getArgument(string $name) + public function getArgument(string $name): mixed { if (!$this->definition->hasArgument($name)) { throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name)); @@ -128,7 +128,7 @@ public function setArgument(string $name, mixed $value) /** * {@inheritdoc} */ - public function hasArgument(string $name) + public function hasArgument(string $name): bool { return $this->definition->hasArgument($name); } @@ -136,7 +136,7 @@ public function hasArgument(string $name) /** * {@inheritdoc} */ - public function getOptions() + public function getOptions(): array { return array_merge($this->definition->getOptionDefaults(), $this->options); } @@ -144,7 +144,7 @@ public function getOptions() /** * {@inheritdoc} */ - public function getOption(string $name) + public function getOption(string $name): mixed { if ($this->definition->hasNegation($name)) { if (null === $value = $this->getOption($this->definition->negationToName($name))) { @@ -180,7 +180,7 @@ public function setOption(string $name, mixed $value) /** * {@inheritdoc} */ - public function hasOption(string $name) + public function hasOption(string $name): bool { return $this->definition->hasOption($name) || $this->definition->hasNegation($name); } @@ -190,7 +190,7 @@ public function hasOption(string $name) * * @return string */ - public function escapeToken(string $token) + public function escapeToken(string $token): string { return preg_match('{^[\w-]+$}', $token) ? $token : escapeshellarg($token); } diff --git a/src/Symfony/Component/Console/Input/InputArgument.php b/src/Symfony/Component/Console/Input/InputArgument.php index db90241176203..1fb20e7a9a6ee 100644 --- a/src/Symfony/Component/Console/Input/InputArgument.php +++ b/src/Symfony/Component/Console/Input/InputArgument.php @@ -58,7 +58,7 @@ public function __construct(string $name, int $mode = null, string $description * * @return string The argument name */ - public function getName() + public function getName(): string { return $this->name; } @@ -68,7 +68,7 @@ public function getName() * * @return bool true if parameter mode is self::REQUIRED, false otherwise */ - public function isRequired() + public function isRequired(): bool { return self::REQUIRED === (self::REQUIRED & $this->mode); } @@ -78,7 +78,7 @@ public function isRequired() * * @return bool true if mode is self::IS_ARRAY, false otherwise */ - public function isArray() + public function isArray(): bool { return self::IS_ARRAY === (self::IS_ARRAY & $this->mode); } @@ -110,7 +110,7 @@ public function setDefault(string|bool|int|float|array $default = null) * * @return string|bool|int|float|array|null */ - public function getDefault() + public function getDefault(): string|bool|int|float|array|null { return $this->default; } @@ -120,7 +120,7 @@ public function getDefault() * * @return string The description text */ - public function getDescription() + public function getDescription(): string { return $this->description; } diff --git a/src/Symfony/Component/Console/Input/InputDefinition.php b/src/Symfony/Component/Console/Input/InputDefinition.php index cc9ff3515a0ba..0e1a910e194e6 100644 --- a/src/Symfony/Component/Console/Input/InputDefinition.php +++ b/src/Symfony/Component/Console/Input/InputDefinition.php @@ -128,7 +128,7 @@ public function addArgument(InputArgument $argument) * * @throws InvalidArgumentException When argument given doesn't exist */ - public function getArgument(string|int $name) + public function getArgument(string|int $name): InputArgument { if (!$this->hasArgument($name)) { throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name)); @@ -144,7 +144,7 @@ public function getArgument(string|int $name) * * @return bool true if the InputArgument object exists, false otherwise */ - public function hasArgument(string|int $name) + public function hasArgument(string|int $name): bool { $arguments = \is_int($name) ? array_values($this->arguments) : $this->arguments; @@ -156,7 +156,7 @@ public function hasArgument(string|int $name) * * @return InputArgument[] An array of InputArgument objects */ - public function getArguments() + public function getArguments(): array { return $this->arguments; } @@ -166,7 +166,7 @@ public function getArguments() * * @return int The number of InputArguments */ - public function getArgumentCount() + public function getArgumentCount(): int { return null !== $this->lastArrayArgument ? \PHP_INT_MAX : \count($this->arguments); } @@ -176,7 +176,7 @@ public function getArgumentCount() * * @return int The number of required InputArguments */ - public function getArgumentRequiredCount() + public function getArgumentRequiredCount(): int { return $this->requiredCount; } @@ -184,7 +184,7 @@ public function getArgumentRequiredCount() /** * @return array */ - public function getArgumentDefaults() + public function getArgumentDefaults(): array { $values = []; foreach ($this->arguments as $argument) { @@ -262,7 +262,7 @@ public function addOption(InputOption $option) * * @throws InvalidArgumentException When option given doesn't exist */ - public function getOption(string $name) + public function getOption(string $name): InputOption { if (!$this->hasOption($name)) { throw new InvalidArgumentException(sprintf('The "--%s" option does not exist.', $name)); @@ -279,7 +279,7 @@ public function getOption(string $name) * * @return bool true if the InputOption object exists, false otherwise */ - public function hasOption(string $name) + public function hasOption(string $name): bool { return isset($this->options[$name]); } @@ -289,7 +289,7 @@ public function hasOption(string $name) * * @return InputOption[] An array of InputOption objects */ - public function getOptions() + public function getOptions(): array { return $this->options; } @@ -299,7 +299,7 @@ public function getOptions() * * @return bool true if the InputOption object exists, false otherwise */ - public function hasShortcut(string $name) + public function hasShortcut(string $name): bool { return isset($this->shortcuts[$name]); } @@ -317,7 +317,7 @@ public function hasNegation(string $name): bool * * @return InputOption An InputOption object */ - public function getOptionForShortcut(string $shortcut) + public function getOptionForShortcut(string $shortcut): InputOption { return $this->getOption($this->shortcutToName($shortcut)); } @@ -325,7 +325,7 @@ public function getOptionForShortcut(string $shortcut) /** * @return array */ - public function getOptionDefaults() + public function getOptionDefaults(): array { $values = []; foreach ($this->options as $option) { @@ -372,7 +372,7 @@ public function negationToName(string $negation): string * * @return string The synopsis */ - public function getSynopsis(bool $short = false) + public function getSynopsis(bool $short = false): string { $elements = []; diff --git a/src/Symfony/Component/Console/Input/InputInterface.php b/src/Symfony/Component/Console/Input/InputInterface.php index f67366fd0577f..0825cd8c504b8 100644 --- a/src/Symfony/Component/Console/Input/InputInterface.php +++ b/src/Symfony/Component/Console/Input/InputInterface.php @@ -26,7 +26,7 @@ interface InputInterface * * @return string|null The value of the first argument or null otherwise */ - public function getFirstArgument(); + public function getFirstArgument(): ?string; /** * Returns true if the raw parameters (not parsed) contain a value. @@ -41,7 +41,7 @@ public function getFirstArgument(); * * @return bool true if the value is contained in the raw parameters */ - public function hasParameterOption(string|array $values, bool $onlyParams = false); + public function hasParameterOption(string|array $values, bool $onlyParams = false): bool; /** * Returns the value of a raw option (not parsed). @@ -57,7 +57,7 @@ public function hasParameterOption(string|array $values, bool $onlyParams = fals * * @return mixed The option value */ - public function getParameterOption(string|array $values, string|bool|int|float|array|null $default = false, bool $onlyParams = false); + public function getParameterOption(string|array $values, string|bool|int|float|array|null $default = false, bool $onlyParams = false): mixed; /** * Binds the current Input instance with the given arguments and options. @@ -78,7 +78,7 @@ public function validate(); * * @return array */ - public function getArguments(); + public function getArguments(): array; /** * Returns the argument value for a given argument name. @@ -87,7 +87,7 @@ public function getArguments(); * * @throws InvalidArgumentException When argument given doesn't exist */ - public function getArgument(string $name); + public function getArgument(string $name): mixed; /** * Sets an argument value by name. @@ -101,14 +101,14 @@ public function setArgument(string $name, mixed $value); * * @return bool true if the InputArgument object exists, false otherwise */ - public function hasArgument(string $name); + public function hasArgument(string $name): bool; /** * Returns all the given options merged with the default values. * * @return array */ - public function getOptions(); + public function getOptions(): array; /** * Returns the option value for a given option name. @@ -117,7 +117,7 @@ public function getOptions(); * * @throws InvalidArgumentException When option given doesn't exist */ - public function getOption(string $name); + public function getOption(string $name): mixed; /** * Sets an option value by name. @@ -131,14 +131,14 @@ public function setOption(string $name, mixed $value); * * @return bool true if the InputOption object exists, false otherwise */ - public function hasOption(string $name); + public function hasOption(string $name): bool; /** * Is this input means interactive? * * @return bool */ - public function isInteractive(); + public function isInteractive(): bool; /** * Sets the input interactivity. diff --git a/src/Symfony/Component/Console/Input/InputOption.php b/src/Symfony/Component/Console/Input/InputOption.php index 5bc94a34860b1..8f50ecf9884d3 100644 --- a/src/Symfony/Component/Console/Input/InputOption.php +++ b/src/Symfony/Component/Console/Input/InputOption.php @@ -112,7 +112,7 @@ public function __construct(string $name, string|array $shortcut = null, int $mo * * @return string|null The shortcut */ - public function getShortcut() + public function getShortcut(): ?string { return $this->shortcut; } @@ -122,7 +122,7 @@ public function getShortcut() * * @return string The name */ - public function getName() + public function getName(): string { return $this->name; } @@ -132,7 +132,7 @@ public function getName() * * @return bool true if value mode is not self::VALUE_NONE, false otherwise */ - public function acceptValue() + public function acceptValue(): bool { return $this->isValueRequired() || $this->isValueOptional(); } @@ -142,7 +142,7 @@ public function acceptValue() * * @return bool true if value mode is self::VALUE_REQUIRED, false otherwise */ - public function isValueRequired() + public function isValueRequired(): bool { return self::VALUE_REQUIRED === (self::VALUE_REQUIRED & $this->mode); } @@ -152,7 +152,7 @@ public function isValueRequired() * * @return bool true if value mode is self::VALUE_OPTIONAL, false otherwise */ - public function isValueOptional() + public function isValueOptional(): bool { return self::VALUE_OPTIONAL === (self::VALUE_OPTIONAL & $this->mode); } @@ -162,7 +162,7 @@ public function isValueOptional() * * @return bool true if mode is self::VALUE_IS_ARRAY, false otherwise */ - public function isArray() + public function isArray(): bool { return self::VALUE_IS_ARRAY === (self::VALUE_IS_ARRAY & $this->mode); } @@ -194,7 +194,7 @@ public function setDefault(string|bool|int|float|array $default = null) * * @return string|bool|int|float|array|null */ - public function getDefault() + public function getDefault(): string|bool|int|float|array|null { return $this->default; } @@ -204,7 +204,7 @@ public function getDefault() * * @return string The description text */ - public function getDescription() + public function getDescription(): string { return $this->description; } @@ -214,7 +214,7 @@ public function getDescription() * * @return bool */ - public function equals(self $option) + public function equals(self $option): bool { return $option->getName() === $this->getName() && $option->getShortcut() === $this->getShortcut() diff --git a/src/Symfony/Component/Console/Logger/ConsoleLogger.php b/src/Symfony/Component/Console/Logger/ConsoleLogger.php index ab9ade0a1f0bd..74b41485e5e4f 100644 --- a/src/Symfony/Component/Console/Logger/ConsoleLogger.php +++ b/src/Symfony/Component/Console/Logger/ConsoleLogger.php @@ -90,7 +90,7 @@ public function log($level, $message, array $context = []): void * * @return bool */ - public function hasErrored() + public function hasErrored(): bool { return $this->errored; } diff --git a/src/Symfony/Component/Console/Output/BufferedOutput.php b/src/Symfony/Component/Console/Output/BufferedOutput.php index d37c6e323805a..bd1105650ae47 100644 --- a/src/Symfony/Component/Console/Output/BufferedOutput.php +++ b/src/Symfony/Component/Console/Output/BufferedOutput.php @@ -23,7 +23,7 @@ class BufferedOutput extends Output * * @return string */ - public function fetch() + public function fetch(): string { $content = $this->buffer; $this->buffer = ''; diff --git a/src/Symfony/Component/Console/Output/ConsoleOutput.php b/src/Symfony/Component/Console/Output/ConsoleOutput.php index 2cda213a04b09..b88414ffc864a 100644 --- a/src/Symfony/Component/Console/Output/ConsoleOutput.php +++ b/src/Symfony/Component/Console/Output/ConsoleOutput.php @@ -94,7 +94,7 @@ public function setVerbosity(int $level) /** * {@inheritdoc} */ - public function getErrorOutput() + public function getErrorOutput(): OutputInterface { return $this->stderr; } @@ -113,7 +113,7 @@ public function setErrorOutput(OutputInterface $error) * * @return bool */ - protected function hasStdoutSupport() + protected function hasStdoutSupport(): bool { return false === $this->isRunningOS400(); } @@ -124,7 +124,7 @@ protected function hasStdoutSupport() * * @return bool */ - protected function hasStderrSupport() + protected function hasStderrSupport(): bool { return false === $this->isRunningOS400(); } diff --git a/src/Symfony/Component/Console/Output/ConsoleOutputInterface.php b/src/Symfony/Component/Console/Output/ConsoleOutputInterface.php index 6b6635f580ffa..4c7c860515f66 100644 --- a/src/Symfony/Component/Console/Output/ConsoleOutputInterface.php +++ b/src/Symfony/Component/Console/Output/ConsoleOutputInterface.php @@ -24,7 +24,7 @@ interface ConsoleOutputInterface extends OutputInterface * * @return OutputInterface */ - public function getErrorOutput(); + public function getErrorOutput(): OutputInterface; public function setErrorOutput(OutputInterface $error); diff --git a/src/Symfony/Component/Console/Output/NullOutput.php b/src/Symfony/Component/Console/Output/NullOutput.php index 4c6f715aca7ea..982f3c3963380 100644 --- a/src/Symfony/Component/Console/Output/NullOutput.php +++ b/src/Symfony/Component/Console/Output/NullOutput.php @@ -37,7 +37,7 @@ public function setFormatter(OutputFormatterInterface $formatter) /** * {@inheritdoc} */ - public function getFormatter() + public function getFormatter(): OutputFormatterInterface { if ($this->formatter) { return $this->formatter; @@ -57,7 +57,7 @@ public function setDecorated(bool $decorated) /** * {@inheritdoc} */ - public function isDecorated() + public function isDecorated(): bool { return false; } @@ -73,7 +73,7 @@ public function setVerbosity(int $level) /** * {@inheritdoc} */ - public function getVerbosity() + public function getVerbosity(): int { return self::VERBOSITY_QUIET; } @@ -81,7 +81,7 @@ public function getVerbosity() /** * {@inheritdoc} */ - public function isQuiet() + public function isQuiet(): bool { return true; } @@ -89,7 +89,7 @@ public function isQuiet() /** * {@inheritdoc} */ - public function isVerbose() + public function isVerbose(): bool { return false; } @@ -97,7 +97,7 @@ public function isVerbose() /** * {@inheritdoc} */ - public function isVeryVerbose() + public function isVeryVerbose(): bool { return false; } @@ -105,7 +105,7 @@ public function isVeryVerbose() /** * {@inheritdoc} */ - public function isDebug() + public function isDebug(): bool { return false; } diff --git a/src/Symfony/Component/Console/Output/Output.php b/src/Symfony/Component/Console/Output/Output.php index 8fd2cc370cf56..27b2b9b5fee81 100644 --- a/src/Symfony/Component/Console/Output/Output.php +++ b/src/Symfony/Component/Console/Output/Output.php @@ -55,7 +55,7 @@ public function setFormatter(OutputFormatterInterface $formatter) /** * {@inheritdoc} */ - public function getFormatter() + public function getFormatter(): OutputFormatterInterface { return $this->formatter; } @@ -71,7 +71,7 @@ public function setDecorated(bool $decorated) /** * {@inheritdoc} */ - public function isDecorated() + public function isDecorated(): bool { return $this->formatter->isDecorated(); } @@ -87,7 +87,7 @@ public function setVerbosity(int $level) /** * {@inheritdoc} */ - public function getVerbosity() + public function getVerbosity(): int { return $this->verbosity; } @@ -95,7 +95,7 @@ public function getVerbosity() /** * {@inheritdoc} */ - public function isQuiet() + public function isQuiet(): bool { return self::VERBOSITY_QUIET === $this->verbosity; } @@ -103,7 +103,7 @@ public function isQuiet() /** * {@inheritdoc} */ - public function isVerbose() + public function isVerbose(): bool { return self::VERBOSITY_VERBOSE <= $this->verbosity; } @@ -111,7 +111,7 @@ public function isVerbose() /** * {@inheritdoc} */ - public function isVeryVerbose() + public function isVeryVerbose(): bool { return self::VERBOSITY_VERY_VERBOSE <= $this->verbosity; } @@ -119,7 +119,7 @@ public function isVeryVerbose() /** * {@inheritdoc} */ - public function isDebug() + public function isDebug(): bool { return self::VERBOSITY_DEBUG <= $this->verbosity; } diff --git a/src/Symfony/Component/Console/Output/OutputInterface.php b/src/Symfony/Component/Console/Output/OutputInterface.php index 1278a1a7185d0..1295f46555846 100644 --- a/src/Symfony/Component/Console/Output/OutputInterface.php +++ b/src/Symfony/Component/Console/Output/OutputInterface.php @@ -55,35 +55,35 @@ public function setVerbosity(int $level); * * @return int The current level of verbosity (one of the VERBOSITY constants) */ - public function getVerbosity(); + public function getVerbosity(): int; /** * Returns whether verbosity is quiet (-q). * * @return bool true if verbosity is set to VERBOSITY_QUIET, false otherwise */ - public function isQuiet(); + public function isQuiet(): bool; /** * Returns whether verbosity is verbose (-v). * * @return bool true if verbosity is set to VERBOSITY_VERBOSE, false otherwise */ - public function isVerbose(); + public function isVerbose(): bool; /** * Returns whether verbosity is very verbose (-vv). * * @return bool true if verbosity is set to VERBOSITY_VERY_VERBOSE, false otherwise */ - public function isVeryVerbose(); + public function isVeryVerbose(): bool; /** * Returns whether verbosity is debug (-vvv). * * @return bool true if verbosity is set to VERBOSITY_DEBUG, false otherwise */ - public function isDebug(); + public function isDebug(): bool; /** * Sets the decorated flag. @@ -95,7 +95,7 @@ public function setDecorated(bool $decorated); * * @return bool true if the output will decorate messages, false otherwise */ - public function isDecorated(); + public function isDecorated(): bool; public function setFormatter(OutputFormatterInterface $formatter); @@ -104,5 +104,5 @@ public function setFormatter(OutputFormatterInterface $formatter); * * @return OutputFormatterInterface */ - public function getFormatter(); + public function getFormatter(): OutputFormatterInterface; } diff --git a/src/Symfony/Component/Console/Output/StreamOutput.php b/src/Symfony/Component/Console/Output/StreamOutput.php index ea434527b9053..fdcb4d190ee4f 100644 --- a/src/Symfony/Component/Console/Output/StreamOutput.php +++ b/src/Symfony/Component/Console/Output/StreamOutput.php @@ -91,7 +91,7 @@ protected function doWrite(string $message, bool $newline) * * @return bool true if the stream supports colorization, false otherwise */ - protected function hasColorSupport() + protected function hasColorSupport(): bool { // Follow https://no-color.org/ if (isset($_SERVER['NO_COLOR']) || false !== getenv('NO_COLOR')) { diff --git a/src/Symfony/Component/Console/Output/TrimmedBufferOutput.php b/src/Symfony/Component/Console/Output/TrimmedBufferOutput.php index 5455c5b47db72..79332007fdea2 100644 --- a/src/Symfony/Component/Console/Output/TrimmedBufferOutput.php +++ b/src/Symfony/Component/Console/Output/TrimmedBufferOutput.php @@ -38,7 +38,7 @@ public function __construct(int $maxLength, ?int $verbosity = self::VERBOSITY_NO * * @return string */ - public function fetch() + public function fetch(): string { $content = $this->buffer; $this->buffer = ''; diff --git a/src/Symfony/Component/Console/Question/ChoiceQuestion.php b/src/Symfony/Component/Console/Question/ChoiceQuestion.php index 6f7f6e73557d2..85df8975b19cb 100644 --- a/src/Symfony/Component/Console/Question/ChoiceQuestion.php +++ b/src/Symfony/Component/Console/Question/ChoiceQuestion.php @@ -48,7 +48,7 @@ public function __construct(string $question, array $choices, mixed $default = n * * @return array */ - public function getChoices() + public function getChoices(): array { return $this->choices; } @@ -60,7 +60,7 @@ public function getChoices() * * @return $this */ - public function setMultiselect(bool $multiselect) + public function setMultiselect(bool $multiselect): static { $this->multiselect = $multiselect; $this->setValidator($this->getDefaultValidator()); @@ -73,7 +73,7 @@ public function setMultiselect(bool $multiselect) * * @return bool */ - public function isMultiselect() + public function isMultiselect(): bool { return $this->multiselect; } @@ -83,7 +83,7 @@ public function isMultiselect() * * @return string */ - public function getPrompt() + public function getPrompt(): string { return $this->prompt; } @@ -93,7 +93,7 @@ public function getPrompt() * * @return $this */ - public function setPrompt(string $prompt) + public function setPrompt(string $prompt): static { $this->prompt = $prompt; @@ -107,7 +107,7 @@ public function setPrompt(string $prompt) * * @return $this */ - public function setErrorMessage(string $errorMessage) + public function setErrorMessage(string $errorMessage): static { $this->errorMessage = $errorMessage; $this->setValidator($this->getDefaultValidator()); diff --git a/src/Symfony/Component/Console/Question/Question.php b/src/Symfony/Component/Console/Question/Question.php index 654fc5472bb96..8215ca9e2be40 100644 --- a/src/Symfony/Component/Console/Question/Question.php +++ b/src/Symfony/Component/Console/Question/Question.php @@ -47,7 +47,7 @@ public function __construct(string $question, string|bool|int|float $default = n * * @return string */ - public function getQuestion() + public function getQuestion(): string { return $this->question; } @@ -57,7 +57,7 @@ public function getQuestion() * * @return string|bool|int|float|null */ - public function getDefault() + public function getDefault(): string|bool|int|float|null { return $this->default; } @@ -75,7 +75,7 @@ public function isMultiline(): bool * * @return $this */ - public function setMultiline(bool $multiline): self + public function setMultiline(bool $multiline): static { $this->multiline = $multiline; @@ -87,7 +87,7 @@ public function setMultiline(bool $multiline): self * * @return bool */ - public function isHidden() + public function isHidden(): bool { return $this->hidden; } @@ -99,7 +99,7 @@ public function isHidden() * * @throws LogicException In case the autocompleter is also used */ - public function setHidden(bool $hidden) + public function setHidden(bool $hidden): static { if ($this->autocompleterCallback) { throw new LogicException('A hidden question cannot use the autocompleter.'); @@ -115,7 +115,7 @@ public function setHidden(bool $hidden) * * @return bool */ - public function isHiddenFallback() + public function isHiddenFallback(): bool { return $this->hiddenFallback; } @@ -125,7 +125,7 @@ public function isHiddenFallback() * * @return $this */ - public function setHiddenFallback(bool $fallback) + public function setHiddenFallback(bool $fallback): static { $this->hiddenFallback = (bool) $fallback; @@ -137,7 +137,7 @@ public function setHiddenFallback(bool $fallback) * * @return iterable|null */ - public function getAutocompleterValues() + public function getAutocompleterValues(): ?iterable { $callback = $this->getAutocompleterCallback(); @@ -151,7 +151,7 @@ public function getAutocompleterValues() * * @throws LogicException */ - public function setAutocompleterValues(?iterable $values) + public function setAutocompleterValues(?iterable $values): static { if (\is_array($values)) { $values = $this->isAssoc($values) ? array_merge(array_keys($values), array_values($values)) : array_values($values); @@ -186,7 +186,7 @@ public function getAutocompleterCallback(): ?callable * * @return $this */ - public function setAutocompleterCallback(callable $callback = null): self + public function setAutocompleterCallback(callable $callback = null): static { if ($this->hidden && null !== $callback) { throw new LogicException('A hidden question cannot use the autocompleter.'); @@ -202,7 +202,7 @@ public function setAutocompleterCallback(callable $callback = null): self * * @return $this */ - public function setValidator(callable $validator = null) + public function setValidator(callable $validator = null): static { $this->validator = $validator; @@ -214,7 +214,7 @@ public function setValidator(callable $validator = null) * * @return callable|null */ - public function getValidator() + public function getValidator(): ?callable { return $this->validator; } @@ -228,7 +228,7 @@ public function getValidator() * * @throws InvalidArgumentException in case the number of attempts is invalid */ - public function setMaxAttempts(?int $attempts) + public function setMaxAttempts(?int $attempts): static { if (null !== $attempts) { $attempts = (int) $attempts; @@ -249,7 +249,7 @@ public function setMaxAttempts(?int $attempts) * * @return int|null */ - public function getMaxAttempts() + public function getMaxAttempts(): ?int { return $this->attempts; } @@ -261,7 +261,7 @@ public function getMaxAttempts() * * @return $this */ - public function setNormalizer(callable $normalizer) + public function setNormalizer(callable $normalizer): static { $this->normalizer = $normalizer; @@ -275,7 +275,7 @@ public function setNormalizer(callable $normalizer) * * @return callable|null */ - public function getNormalizer() + public function getNormalizer(): ?callable { return $this->normalizer; } @@ -293,7 +293,7 @@ public function isTrimmable(): bool /** * @return $this */ - public function setTrimmable(bool $trimmable): self + public function setTrimmable(bool $trimmable): static { $this->trimmable = $trimmable; diff --git a/src/Symfony/Component/Console/Style/OutputStyle.php b/src/Symfony/Component/Console/Style/OutputStyle.php index c1075aa4e6023..15e595fd157a5 100644 --- a/src/Symfony/Component/Console/Style/OutputStyle.php +++ b/src/Symfony/Component/Console/Style/OutputStyle.php @@ -41,7 +41,7 @@ public function newLine(int $count = 1) /** * @return ProgressBar */ - public function createProgressBar(int $max = 0) + public function createProgressBar(int $max = 0): ProgressBar { return new ProgressBar($this->output, $max); } @@ -73,7 +73,7 @@ public function setVerbosity(int $level) /** * {@inheritdoc} */ - public function getVerbosity() + public function getVerbosity(): int { return $this->output->getVerbosity(); } @@ -89,7 +89,7 @@ public function setDecorated(bool $decorated) /** * {@inheritdoc} */ - public function isDecorated() + public function isDecorated(): bool { return $this->output->isDecorated(); } @@ -105,7 +105,7 @@ public function setFormatter(OutputFormatterInterface $formatter) /** * {@inheritdoc} */ - public function getFormatter() + public function getFormatter(): OutputFormatterInterface { return $this->output->getFormatter(); } @@ -113,7 +113,7 @@ public function getFormatter() /** * {@inheritdoc} */ - public function isQuiet() + public function isQuiet(): bool { return $this->output->isQuiet(); } @@ -121,7 +121,7 @@ public function isQuiet() /** * {@inheritdoc} */ - public function isVerbose() + public function isVerbose(): bool { return $this->output->isVerbose(); } @@ -129,7 +129,7 @@ public function isVerbose() /** * {@inheritdoc} */ - public function isVeryVerbose() + public function isVeryVerbose(): bool { return $this->output->isVeryVerbose(); } @@ -137,7 +137,7 @@ public function isVeryVerbose() /** * {@inheritdoc} */ - public function isDebug() + public function isDebug(): bool { return $this->output->isDebug(); } diff --git a/src/Symfony/Component/Console/Style/StyleInterface.php b/src/Symfony/Component/Console/Style/StyleInterface.php index 7b0a35927b40f..aeb69d7740a98 100644 --- a/src/Symfony/Component/Console/Style/StyleInterface.php +++ b/src/Symfony/Component/Console/Style/StyleInterface.php @@ -73,28 +73,28 @@ public function table(array $headers, array $rows); * * @return mixed */ - public function ask(string $question, string $default = null, callable $validator = null); + public function ask(string $question, string $default = null, callable $validator = null): mixed; /** * Asks a question with the user input hidden. * * @return mixed */ - public function askHidden(string $question, callable $validator = null); + public function askHidden(string $question, callable $validator = null): mixed; /** * Asks for confirmation. * * @return bool */ - public function confirm(string $question, bool $default = true); + public function confirm(string $question, bool $default = true): bool; /** * Asks a choice question. * * @return mixed */ - public function choice(string $question, array $choices, mixed $default = null); + public function choice(string $question, array $choices, mixed $default = null): mixed; /** * Add newline(s). diff --git a/src/Symfony/Component/Console/Style/SymfonyStyle.php b/src/Symfony/Component/Console/Style/SymfonyStyle.php index d5eb795aa6cfa..d1b1ec08d2710 100644 --- a/src/Symfony/Component/Console/Style/SymfonyStyle.php +++ b/src/Symfony/Component/Console/Style/SymfonyStyle.php @@ -256,7 +256,7 @@ public function definitionList(string|array|TableSeparator ...$list) /** * {@inheritdoc} */ - public function ask(string $question, string $default = null, callable $validator = null) + public function ask(string $question, string $default = null, callable $validator = null): mixed { $question = new Question($question, $default); $question->setValidator($validator); @@ -267,7 +267,7 @@ public function ask(string $question, string $default = null, callable $validato /** * {@inheritdoc} */ - public function askHidden(string $question, callable $validator = null) + public function askHidden(string $question, callable $validator = null): mixed { $question = new Question($question); @@ -280,7 +280,7 @@ public function askHidden(string $question, callable $validator = null) /** * {@inheritdoc} */ - public function confirm(string $question, bool $default = true) + public function confirm(string $question, bool $default = true): bool { return $this->askQuestion(new ConfirmationQuestion($question, $default)); } @@ -288,7 +288,7 @@ public function confirm(string $question, bool $default = true) /** * {@inheritdoc} */ - public function choice(string $question, array $choices, mixed $default = null) + public function choice(string $question, array $choices, mixed $default = null): mixed { if (null !== $default) { $values = array_flip($choices); @@ -328,7 +328,7 @@ public function progressFinish() /** * {@inheritdoc} */ - public function createProgressBar(int $max = 0) + public function createProgressBar(int $max = 0): ProgressBar { $progressBar = parent::createProgressBar($max); @@ -344,7 +344,7 @@ public function createProgressBar(int $max = 0) /** * @return mixed */ - public function askQuestion(Question $question) + public function askQuestion(Question $question): mixed { if ($this->input->isInteractive()) { $this->autoPrependBlock(); @@ -405,10 +405,8 @@ public function newLine(int $count = 1) /** * Returns a new instance which makes use of stderr if available. - * - * @return self */ - public function getErrorStyle() + public function getErrorStyle(): self { return new self($this->input, $this->getErrorOutput()); } diff --git a/src/Symfony/Component/Console/Terminal.php b/src/Symfony/Component/Console/Terminal.php index 08c53535b1d35..5a05427821c03 100644 --- a/src/Symfony/Component/Console/Terminal.php +++ b/src/Symfony/Component/Console/Terminal.php @@ -22,7 +22,7 @@ class Terminal * * @return int */ - public function getWidth() + public function getWidth(): int { $width = getenv('COLUMNS'); if (false !== $width) { @@ -41,7 +41,7 @@ public function getWidth() * * @return int */ - public function getHeight() + public function getHeight(): int { $height = getenv('LINES'); if (false !== $height) { diff --git a/src/Symfony/Component/Console/Tester/ApplicationTester.php b/src/Symfony/Component/Console/Tester/ApplicationTester.php index d021c14358f2d..82a7b282e1482 100644 --- a/src/Symfony/Component/Console/Tester/ApplicationTester.php +++ b/src/Symfony/Component/Console/Tester/ApplicationTester.php @@ -49,7 +49,7 @@ public function __construct(Application $application) * * @return int The command exit code */ - public function run(array $input, array $options = []) + public function run(array $input, array $options = []): int { $this->input = new ArrayInput($input); if (isset($options['interactive'])) { diff --git a/src/Symfony/Component/Console/Tester/CommandTester.php b/src/Symfony/Component/Console/Tester/CommandTester.php index 57efc9a6754b2..fa55ce00ed508 100644 --- a/src/Symfony/Component/Console/Tester/CommandTester.php +++ b/src/Symfony/Component/Console/Tester/CommandTester.php @@ -48,7 +48,7 @@ public function __construct(Command $command) * * @return int The command exit code */ - public function execute(array $input, array $options = []) + public function execute(array $input, array $options = []): int { // set the command name automatically if the application requires // this argument and no command name was passed diff --git a/src/Symfony/Component/Console/Tester/TesterTrait.php b/src/Symfony/Component/Console/Tester/TesterTrait.php index 462e8a1f714ce..c33e59983c384 100644 --- a/src/Symfony/Component/Console/Tester/TesterTrait.php +++ b/src/Symfony/Component/Console/Tester/TesterTrait.php @@ -35,7 +35,7 @@ trait TesterTrait * * @return string The display */ - public function getDisplay(bool $normalize = false) + public function getDisplay(bool $normalize = false): string { if (null === $this->output) { throw new \RuntimeException('Output not initialized, did you execute the command before requesting the display?'); @@ -59,7 +59,7 @@ public function getDisplay(bool $normalize = false) * * @return string */ - public function getErrorOutput(bool $normalize = false) + public function getErrorOutput(bool $normalize = false): string { if (!$this->captureStreamsIndependently) { throw new \LogicException('The error output is not available when the tester is run without "capture_stderr_separately" option set.'); @@ -81,7 +81,7 @@ public function getErrorOutput(bool $normalize = false) * * @return InputInterface */ - public function getInput() + public function getInput(): InputInterface { return $this->input; } @@ -91,7 +91,7 @@ public function getInput() * * @return OutputInterface */ - public function getOutput() + public function getOutput(): OutputInterface { return $this->output; } @@ -103,7 +103,7 @@ public function getOutput() * * @return int The status code */ - public function getStatusCode() + public function getStatusCode(): int { if (null === $this->statusCode) { throw new \RuntimeException('Status code not initialized, did you execute the command before requesting the status code?'); @@ -125,7 +125,7 @@ public function assertCommandIsSuccessful(string $message = ''): void * * @return $this */ - public function setInputs(array $inputs) + public function setInputs(array $inputs): static { $this->inputs = $inputs; diff --git a/src/Symfony/Component/DependencyInjection/Alias.php b/src/Symfony/Component/DependencyInjection/Alias.php index c483610a95e24..0c13c0f3d357f 100644 --- a/src/Symfony/Component/DependencyInjection/Alias.php +++ b/src/Symfony/Component/DependencyInjection/Alias.php @@ -32,7 +32,7 @@ public function __construct(string $id, bool $public = false) * * @return bool */ - public function isPublic() + public function isPublic(): bool { return $this->public; } @@ -42,7 +42,7 @@ public function isPublic() * * @return $this */ - public function setPublic(bool $boolean) + public function setPublic(bool $boolean): static { $this->public = $boolean; @@ -54,7 +54,7 @@ public function setPublic(bool $boolean) * * @return bool */ - public function isPrivate() + public function isPrivate(): bool { return !$this->public; } @@ -71,7 +71,7 @@ public function isPrivate() * * @throws InvalidArgumentException when the message template is invalid */ - public function setDeprecated(string $package, string $version, string $message) + public function setDeprecated(string $package, string $version, string $message): static { if ('' !== $message) { if (preg_match('#[\r\n]|\*/#', $message)) { diff --git a/src/Symfony/Component/DependencyInjection/Argument/ArgumentInterface.php b/src/Symfony/Component/DependencyInjection/Argument/ArgumentInterface.php index b46eb77be749e..fac379b1a3848 100644 --- a/src/Symfony/Component/DependencyInjection/Argument/ArgumentInterface.php +++ b/src/Symfony/Component/DependencyInjection/Argument/ArgumentInterface.php @@ -21,7 +21,7 @@ interface ArgumentInterface /** * @return array */ - public function getValues(); + public function getValues(): array; public function setValues(array $values); } diff --git a/src/Symfony/Component/DependencyInjection/Argument/ReferenceSetArgumentTrait.php b/src/Symfony/Component/DependencyInjection/Argument/ReferenceSetArgumentTrait.php index f542d81c4d145..fddf396fe81ef 100644 --- a/src/Symfony/Component/DependencyInjection/Argument/ReferenceSetArgumentTrait.php +++ b/src/Symfony/Component/DependencyInjection/Argument/ReferenceSetArgumentTrait.php @@ -33,7 +33,7 @@ public function __construct(array $values) /** * @return Reference[] The values in the set */ - public function getValues() + public function getValues(): array { return $this->values; } diff --git a/src/Symfony/Component/DependencyInjection/Argument/ServiceClosureArgument.php b/src/Symfony/Component/DependencyInjection/Argument/ServiceClosureArgument.php index 64b3f95d15df7..bbb1f9a2985f4 100644 --- a/src/Symfony/Component/DependencyInjection/Argument/ServiceClosureArgument.php +++ b/src/Symfony/Component/DependencyInjection/Argument/ServiceClosureArgument.php @@ -31,7 +31,7 @@ public function __construct(Reference $reference) /** * {@inheritdoc} */ - public function getValues() + public function getValues(): array { return $this->values; } diff --git a/src/Symfony/Component/DependencyInjection/ChildDefinition.php b/src/Symfony/Component/DependencyInjection/ChildDefinition.php index cab1d62617dec..c1e5995f88e4f 100644 --- a/src/Symfony/Component/DependencyInjection/ChildDefinition.php +++ b/src/Symfony/Component/DependencyInjection/ChildDefinition.php @@ -36,7 +36,7 @@ public function __construct(string $parent) * * @return string */ - public function getParent() + public function getParent(): string { return $this->parent; } @@ -46,7 +46,7 @@ public function getParent() * * @return $this */ - public function setParent(string $parent) + public function setParent(string $parent): static { $this->parent = $parent; @@ -63,7 +63,7 @@ public function setParent(string $parent) * * @throws OutOfBoundsException When the argument does not exist */ - public function getArgument(int|string $index) + public function getArgument(int|string $index): mixed { if (\array_key_exists('index_'.$index, $this->arguments)) { return $this->arguments['index_'.$index]; @@ -84,7 +84,7 @@ public function getArgument(int|string $index) * * @throws InvalidArgumentException when $index isn't an integer */ - public function replaceArgument(int|string $index, mixed $value) + public function replaceArgument(int|string $index, mixed $value): static { if (\is_int($index)) { $this->arguments['index_'.$index] = $value; diff --git a/src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php b/src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php index f769b6fcc859d..21fa193bc7e5f 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php @@ -106,7 +106,7 @@ protected function processValue(mixed $value, bool $isRoot = false) * * @throws RuntimeException */ - protected function getConstructor(Definition $definition, bool $required) + protected function getConstructor(Definition $definition, bool $required): ?\ReflectionFunctionAbstract { if ($definition->isSynthetic()) { return null; @@ -166,7 +166,7 @@ protected function getConstructor(Definition $definition, bool $required) * * @return \ReflectionFunctionAbstract */ - protected function getReflectionMethod(Definition $definition, string $method) + protected function getReflectionMethod(Definition $definition, string $method): \ReflectionFunctionAbstract { if ('__construct' === $method) { return $this->getConstructor($definition, true); diff --git a/src/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php b/src/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php index 67327ec740bfb..4f53882d90569 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php @@ -76,7 +76,7 @@ public function process(ContainerBuilder $container) } } - protected function processValue(mixed $value, bool $isRoot = false) + protected function processValue(mixed $value, bool $isRoot = false): mixed { $lazy = $this->lazy; $inExpression = $this->inExpression(); diff --git a/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php b/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php index 16fcb628e7ffd..a29658e866819 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php @@ -72,7 +72,7 @@ public function process(ContainerBuilder $container) /** * {@inheritdoc} */ - protected function processValue(mixed $value, bool $isRoot = false) + protected function processValue(mixed $value, bool $isRoot = false): mixed { try { return $this->doProcessValue($value, $isRoot); diff --git a/src/Symfony/Component/DependencyInjection/Compiler/AutowireRequiredMethodsPass.php b/src/Symfony/Component/DependencyInjection/Compiler/AutowireRequiredMethodsPass.php index 61757a0c1a161..0bbc5cbe6fe89 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/AutowireRequiredMethodsPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/AutowireRequiredMethodsPass.php @@ -24,7 +24,7 @@ class AutowireRequiredMethodsPass extends AbstractRecursivePass /** * {@inheritdoc} */ - protected function processValue(mixed $value, bool $isRoot = false) + protected function processValue(mixed $value, bool $isRoot = false): mixed { $value = parent::processValue($value, $isRoot); diff --git a/src/Symfony/Component/DependencyInjection/Compiler/AutowireRequiredPropertiesPass.php b/src/Symfony/Component/DependencyInjection/Compiler/AutowireRequiredPropertiesPass.php index a79728c1e8d0f..41032030560c2 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/AutowireRequiredPropertiesPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/AutowireRequiredPropertiesPass.php @@ -27,7 +27,7 @@ class AutowireRequiredPropertiesPass extends AbstractRecursivePass /** * {@inheritdoc} */ - protected function processValue(mixed $value, bool $isRoot = false) + protected function processValue(mixed $value, bool $isRoot = false): mixed { $value = parent::processValue($value, $isRoot); diff --git a/src/Symfony/Component/DependencyInjection/Compiler/CheckArgumentsValidityPass.php b/src/Symfony/Component/DependencyInjection/Compiler/CheckArgumentsValidityPass.php index 26a0272b68a76..c21568a4782ef 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/CheckArgumentsValidityPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/CheckArgumentsValidityPass.php @@ -32,7 +32,7 @@ public function __construct(bool $throwExceptions = true) /** * {@inheritdoc} */ - protected function processValue(mixed $value, bool $isRoot = false) + protected function processValue(mixed $value, bool $isRoot = false): mixed { if (!$value instanceof Definition) { return parent::processValue($value, $isRoot); diff --git a/src/Symfony/Component/DependencyInjection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php b/src/Symfony/Component/DependencyInjection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php index eb4af610b165c..86618eea90611 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php @@ -43,7 +43,7 @@ public function process(ContainerBuilder $container) } } - protected function processValue(mixed $value, bool $isRoot = false) + protected function processValue(mixed $value, bool $isRoot = false): mixed { if (!$value instanceof Reference) { return parent::processValue($value, $isRoot); diff --git a/src/Symfony/Component/DependencyInjection/Compiler/CheckReferenceValidityPass.php b/src/Symfony/Component/DependencyInjection/Compiler/CheckReferenceValidityPass.php index 4e9ca8fd28d0e..eb3385b5315ba 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/CheckReferenceValidityPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/CheckReferenceValidityPass.php @@ -25,7 +25,7 @@ */ class CheckReferenceValidityPass extends AbstractRecursivePass { - protected function processValue(mixed $value, bool $isRoot = false) + protected function processValue(mixed $value, bool $isRoot = false): mixed { if ($isRoot && $value instanceof Definition && ($value->isSynthetic() || $value->isAbstract())) { return $value; diff --git a/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php b/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php index 48ae81ecfd0de..50bb532207048 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php @@ -34,7 +34,7 @@ public function __construct() /** * @return PassConfig */ - public function getPassConfig() + public function getPassConfig(): PassConfig { return $this->passConfig; } @@ -42,7 +42,7 @@ public function getPassConfig() /** * @return ServiceReferenceGraph */ - public function getServiceReferenceGraph() + public function getServiceReferenceGraph(): ServiceReferenceGraph { return $this->serviceReferenceGraph; } @@ -67,7 +67,7 @@ public function log(CompilerPassInterface $pass, string $message) /** * @return array */ - public function getLog() + public function getLog(): array { return $this->log; } diff --git a/src/Symfony/Component/DependencyInjection/Compiler/DecoratorServicePass.php b/src/Symfony/Component/DependencyInjection/Compiler/DecoratorServicePass.php index 85ae4bbf1b203..f5493a88bc5de 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/DecoratorServicePass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/DecoratorServicePass.php @@ -107,7 +107,7 @@ public function process(ContainerBuilder $container) } } - protected function processValue(mixed $value, bool $isRoot = false) + protected function processValue(mixed $value, bool $isRoot = false): mixed { if ($value instanceof Reference && '.inner' === (string) $value) { return new Reference($this->currentId, $value->getInvalidBehavior()); diff --git a/src/Symfony/Component/DependencyInjection/Compiler/DefinitionErrorExceptionPass.php b/src/Symfony/Component/DependencyInjection/Compiler/DefinitionErrorExceptionPass.php index c6a1fc31374b9..18d959524694c 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/DefinitionErrorExceptionPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/DefinitionErrorExceptionPass.php @@ -26,7 +26,7 @@ class DefinitionErrorExceptionPass extends AbstractRecursivePass /** * {@inheritdoc} */ - protected function processValue(mixed $value, bool $isRoot = false) + protected function processValue(mixed $value, bool $isRoot = false): mixed { if (!$value instanceof Definition || !$value->hasErrors()) { return parent::processValue($value, $isRoot); diff --git a/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php b/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php index 7a2f849e8f77c..19c74480d96a7 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php @@ -107,7 +107,7 @@ public function process(ContainerBuilder $container) /** * {@inheritdoc} */ - protected function processValue(mixed $value, bool $isRoot = false) + protected function processValue(mixed $value, bool $isRoot = false): mixed { if ($value instanceof ArgumentInterface) { // Reference found in ArgumentInterface::getValues() are not inlineable diff --git a/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php b/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php index 546268a2859d1..c64381886a37c 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php @@ -171,7 +171,7 @@ public function __construct(ExtensionInterface $extension, ParameterBagInterface /** * {@inheritdoc} */ - public function addCompilerPass(CompilerPassInterface $pass, string $type = PassConfig::TYPE_BEFORE_OPTIMIZATION, int $priority = 0): self + public function addCompilerPass(CompilerPassInterface $pass, string $type = PassConfig::TYPE_BEFORE_OPTIMIZATION, int $priority = 0): static { throw new LogicException(sprintf('You cannot add compiler pass "%s" from extension "%s". Compiler passes must be registered before the container is compiled.', get_debug_type($pass), $this->extensionClass)); } diff --git a/src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php b/src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php index 85cdfe6cc5ea1..24227e55b614d 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php @@ -100,7 +100,7 @@ public function __construct() * * @return CompilerPassInterface[] */ - public function getPasses() + public function getPasses(): array { return array_merge( [$this->mergePass], @@ -137,7 +137,7 @@ public function addPass(CompilerPassInterface $pass, string $type = self::TYPE_B * * @return CompilerPassInterface[] */ - public function getAfterRemovingPasses() + public function getAfterRemovingPasses(): array { return $this->sortPasses($this->afterRemovingPasses); } @@ -147,7 +147,7 @@ public function getAfterRemovingPasses() * * @return CompilerPassInterface[] */ - public function getBeforeOptimizationPasses() + public function getBeforeOptimizationPasses(): array { return $this->sortPasses($this->beforeOptimizationPasses); } @@ -157,7 +157,7 @@ public function getBeforeOptimizationPasses() * * @return CompilerPassInterface[] */ - public function getBeforeRemovingPasses() + public function getBeforeRemovingPasses(): array { return $this->sortPasses($this->beforeRemovingPasses); } @@ -167,7 +167,7 @@ public function getBeforeRemovingPasses() * * @return CompilerPassInterface[] */ - public function getOptimizationPasses() + public function getOptimizationPasses(): array { return $this->sortPasses($this->optimizationPasses); } @@ -177,7 +177,7 @@ public function getOptimizationPasses() * * @return CompilerPassInterface[] */ - public function getRemovingPasses() + public function getRemovingPasses(): array { return $this->sortPasses($this->removingPasses); } @@ -187,7 +187,7 @@ public function getRemovingPasses() * * @return CompilerPassInterface */ - public function getMergePass() + public function getMergePass(): CompilerPassInterface { return $this->mergePass; } diff --git a/src/Symfony/Component/DependencyInjection/Compiler/PriorityTaggedServiceTrait.php b/src/Symfony/Component/DependencyInjection/Compiler/PriorityTaggedServiceTrait.php index 639acff52451f..0126747f7f781 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/PriorityTaggedServiceTrait.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/PriorityTaggedServiceTrait.php @@ -117,7 +117,7 @@ class PriorityTaggedServiceUtil /** * @return string|int|null */ - public static function getDefault(ContainerBuilder $container, string $serviceId, string $class, string $defaultMethod, string $tagName, ?string $indexAttribute, bool $checkTaggedItem) + public static function getDefault(ContainerBuilder $container, string $serviceId, string $class, string $defaultMethod, string $tagName, ?string $indexAttribute, bool $checkTaggedItem): string|int|null { if (!($r = $container->getReflectionClass($class)) || (!$checkTaggedItem && !$r->hasMethod($defaultMethod))) { return null; diff --git a/src/Symfony/Component/DependencyInjection/Compiler/RegisterServiceSubscribersPass.php b/src/Symfony/Component/DependencyInjection/Compiler/RegisterServiceSubscribersPass.php index d78d80f98dbcb..d01eff40b452f 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/RegisterServiceSubscribersPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/RegisterServiceSubscribersPass.php @@ -30,7 +30,7 @@ */ class RegisterServiceSubscribersPass extends AbstractRecursivePass { - protected function processValue(mixed $value, bool $isRoot = false) + protected function processValue(mixed $value, bool $isRoot = false): mixed { if (!$value instanceof Definition || $value->isAbstract() || $value->isSynthetic() || !$value->hasTag('container.service_subscriber')) { return parent::processValue($value, $isRoot); diff --git a/src/Symfony/Component/DependencyInjection/Compiler/RemoveUnusedDefinitionsPass.php b/src/Symfony/Component/DependencyInjection/Compiler/RemoveUnusedDefinitionsPass.php index f2b3869b05cf2..35f824d172929 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/RemoveUnusedDefinitionsPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/RemoveUnusedDefinitionsPass.php @@ -75,7 +75,7 @@ public function process(ContainerBuilder $container) /** * {@inheritdoc} */ - protected function processValue(mixed $value, bool $isRoot = false) + protected function processValue(mixed $value, bool $isRoot = false): mixed { if (!$value instanceof Reference) { return parent::processValue($value, $isRoot); diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ReplaceAliasByActualDefinitionPass.php b/src/Symfony/Component/DependencyInjection/Compiler/ReplaceAliasByActualDefinitionPass.php index d59a5d84f9d62..ed2c7fcd6d301 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ReplaceAliasByActualDefinitionPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ReplaceAliasByActualDefinitionPass.php @@ -79,7 +79,7 @@ public function process(ContainerBuilder $container) /** * {@inheritdoc} */ - protected function processValue(mixed $value, bool $isRoot = false) + protected function processValue(mixed $value, bool $isRoot = false): mixed { if ($value instanceof Reference && isset($this->replacements[$referenceId = (string) $value])) { // Perform the replacement diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ResolveBindingsPass.php b/src/Symfony/Component/DependencyInjection/Compiler/ResolveBindingsPass.php index 1fdff3cccc487..b58d4a452549f 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ResolveBindingsPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ResolveBindingsPass.php @@ -93,7 +93,7 @@ public function process(ContainerBuilder $container) /** * {@inheritdoc} */ - protected function processValue(mixed $value, bool $isRoot = false) + protected function processValue(mixed $value, bool $isRoot = false): mixed { if ($value instanceof TypedReference && $value->getType() === (string) $value) { // Already checked diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ResolveChildDefinitionsPass.php b/src/Symfony/Component/DependencyInjection/Compiler/ResolveChildDefinitionsPass.php index 1c407fdac3d7a..d403c0fb9af09 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ResolveChildDefinitionsPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ResolveChildDefinitionsPass.php @@ -29,7 +29,7 @@ class ResolveChildDefinitionsPass extends AbstractRecursivePass { private array $currentPath; - protected function processValue(mixed $value, bool $isRoot = false) + protected function processValue(mixed $value, bool $isRoot = false): mixed { if (!$value instanceof Definition) { return parent::processValue($value, $isRoot); diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ResolveEnvPlaceholdersPass.php b/src/Symfony/Component/DependencyInjection/Compiler/ResolveEnvPlaceholdersPass.php index 8be94ed5bd0e9..a7130795532c7 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ResolveEnvPlaceholdersPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ResolveEnvPlaceholdersPass.php @@ -18,7 +18,7 @@ */ class ResolveEnvPlaceholdersPass extends AbstractRecursivePass { - protected function processValue(mixed $value, bool $isRoot = false) + protected function processValue(mixed $value, bool $isRoot = false): mixed { if (\is_string($value)) { return $this->container->resolveEnvPlaceholders($value, true); diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ResolveFactoryClassPass.php b/src/Symfony/Component/DependencyInjection/Compiler/ResolveFactoryClassPass.php index 28181d7335fd8..7d5d95d20fc56 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ResolveFactoryClassPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ResolveFactoryClassPass.php @@ -22,7 +22,7 @@ class ResolveFactoryClassPass extends AbstractRecursivePass /** * {@inheritdoc} */ - protected function processValue(mixed $value, bool $isRoot = false) + protected function processValue(mixed $value, bool $isRoot = false): mixed { if ($value instanceof Definition && \is_array($factory = $value->getFactory()) && null === $factory[0]) { if (null === $class = $value->getClass()) { diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ResolveHotPathPass.php b/src/Symfony/Component/DependencyInjection/Compiler/ResolveHotPathPass.php index 8c20ac468ed4a..200921373dedb 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ResolveHotPathPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ResolveHotPathPass.php @@ -41,7 +41,7 @@ public function process(ContainerBuilder $container) /** * {@inheritdoc} */ - protected function processValue(mixed $value, bool $isRoot = false) + protected function processValue(mixed $value, bool $isRoot = false): mixed { if ($value instanceof ArgumentInterface) { return $value; diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ResolveNamedArgumentsPass.php b/src/Symfony/Component/DependencyInjection/Compiler/ResolveNamedArgumentsPass.php index 1fa08562a5f7c..b4f38b4273479 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ResolveNamedArgumentsPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ResolveNamedArgumentsPass.php @@ -27,7 +27,7 @@ class ResolveNamedArgumentsPass extends AbstractRecursivePass /** * {@inheritdoc} */ - protected function processValue(mixed $value, bool $isRoot = false) + protected function processValue(mixed $value, bool $isRoot = false): mixed { if ($value instanceof AbstractArgument && $value->getText().'.' === $value->getTextWithContext()) { $value->setContext(sprintf('A value found in service "%s"', $this->currentId)); diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ResolveNoPreloadPass.php b/src/Symfony/Component/DependencyInjection/Compiler/ResolveNoPreloadPass.php index 6c71d9087abd0..211245e2d9ef0 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ResolveNoPreloadPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ResolveNoPreloadPass.php @@ -64,7 +64,7 @@ public function process(ContainerBuilder $container) /** * {@inheritdoc} */ - protected function processValue(mixed $value, bool $isRoot = false) + protected function processValue(mixed $value, bool $isRoot = false): mixed { if ($value instanceof Reference && ContainerBuilder::IGNORE_ON_UNINITIALIZED_REFERENCE !== $value->getInvalidBehavior() && $this->container->hasDefinition($id = (string) $value)) { $definition = $this->container->getDefinition($id); diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ResolveParameterPlaceHoldersPass.php b/src/Symfony/Component/DependencyInjection/Compiler/ResolveParameterPlaceHoldersPass.php index 688cc5da80dc4..25245d859235c 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ResolveParameterPlaceHoldersPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ResolveParameterPlaceHoldersPass.php @@ -60,7 +60,7 @@ public function process(ContainerBuilder $container) unset($this->bag); } - protected function processValue(mixed $value, bool $isRoot = false) + protected function processValue(mixed $value, bool $isRoot = false): mixed { if (\is_string($value)) { try { diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ResolveReferencesToAliasesPass.php b/src/Symfony/Component/DependencyInjection/Compiler/ResolveReferencesToAliasesPass.php index 9b07f62a7dc9c..f6ee152929def 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ResolveReferencesToAliasesPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ResolveReferencesToAliasesPass.php @@ -42,7 +42,7 @@ public function process(ContainerBuilder $container) /** * {@inheritdoc} */ - protected function processValue(mixed $value, bool $isRoot = false) + protected function processValue(mixed $value, bool $isRoot = false): mixed { if (!$value instanceof Reference) { return parent::processValue($value, $isRoot); diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ResolveServiceSubscribersPass.php b/src/Symfony/Component/DependencyInjection/Compiler/ResolveServiceSubscribersPass.php index 1578960868ec5..96ac6db6cf3b7 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ResolveServiceSubscribersPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ResolveServiceSubscribersPass.php @@ -25,7 +25,7 @@ class ResolveServiceSubscribersPass extends AbstractRecursivePass { private ?string $serviceLocator = null; - protected function processValue(mixed $value, bool $isRoot = false) + protected function processValue(mixed $value, bool $isRoot = false): mixed { if ($value instanceof Reference && $this->serviceLocator && \in_array((string) $value, [ContainerInterface::class, ServiceProviderInterface::class], true)) { return new Reference($this->serviceLocator); diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ResolveTaggedIteratorArgumentPass.php b/src/Symfony/Component/DependencyInjection/Compiler/ResolveTaggedIteratorArgumentPass.php index 4513ca8a66a9f..d9362a6402046 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ResolveTaggedIteratorArgumentPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ResolveTaggedIteratorArgumentPass.php @@ -25,7 +25,7 @@ class ResolveTaggedIteratorArgumentPass extends AbstractRecursivePass /** * {@inheritdoc} */ - protected function processValue(mixed $value, bool $isRoot = false) + protected function processValue(mixed $value, bool $isRoot = false): mixed { if (!$value instanceof TaggedIteratorArgument) { return parent::processValue($value, $isRoot); diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphEdge.php b/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphEdge.php index 89c686da5ea5e..1a22171f022c6 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphEdge.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphEdge.php @@ -42,7 +42,7 @@ public function __construct(ServiceReferenceGraphNode $sourceNode, ServiceRefere * * @return mixed */ - public function getValue() + public function getValue(): mixed { return $this->value; } @@ -52,7 +52,7 @@ public function getValue() * * @return ServiceReferenceGraphNode */ - public function getSourceNode() + public function getSourceNode(): ServiceReferenceGraphNode { return $this->sourceNode; } @@ -62,7 +62,7 @@ public function getSourceNode() * * @return ServiceReferenceGraphNode */ - public function getDestNode() + public function getDestNode(): ServiceReferenceGraphNode { return $this->destNode; } @@ -72,7 +72,7 @@ public function getDestNode() * * @return bool */ - public function isLazy() + public function isLazy(): bool { return $this->lazy; } @@ -82,7 +82,7 @@ public function isLazy() * * @return bool */ - public function isWeak() + public function isWeak(): bool { return $this->weak; } @@ -92,7 +92,7 @@ public function isWeak() * * @return bool */ - public function isReferencedByConstructor() + public function isReferencedByConstructor(): bool { return $this->byConstructor; } diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphNode.php b/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphNode.php index 6fcd8fbab846d..9183229955c01 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphNode.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphNode.php @@ -49,7 +49,7 @@ public function addOutEdge(ServiceReferenceGraphEdge $edge) * * @return bool */ - public function isAlias() + public function isAlias(): bool { return $this->value instanceof Alias; } @@ -59,7 +59,7 @@ public function isAlias() * * @return bool True if the value is a Definition instance */ - public function isDefinition() + public function isDefinition(): bool { return $this->value instanceof Definition; } @@ -69,7 +69,7 @@ public function isDefinition() * * @return string */ - public function getId() + public function getId(): string { return $this->id; } @@ -79,7 +79,7 @@ public function getId() * * @return ServiceReferenceGraphEdge[] */ - public function getInEdges() + public function getInEdges(): array { return $this->inEdges; } @@ -89,7 +89,7 @@ public function getInEdges() * * @return ServiceReferenceGraphEdge[] */ - public function getOutEdges() + public function getOutEdges(): array { return $this->outEdges; } @@ -99,7 +99,7 @@ public function getOutEdges() * * @return mixed The value */ - public function getValue() + public function getValue(): mixed { return $this->value; } diff --git a/src/Symfony/Component/DependencyInjection/Config/ContainerParametersResourceChecker.php b/src/Symfony/Component/DependencyInjection/Config/ContainerParametersResourceChecker.php index b6741b13a2129..6901127056876 100644 --- a/src/Symfony/Component/DependencyInjection/Config/ContainerParametersResourceChecker.php +++ b/src/Symfony/Component/DependencyInjection/Config/ContainerParametersResourceChecker.php @@ -30,7 +30,7 @@ public function __construct(ContainerInterface $container) /** * {@inheritdoc} */ - public function supports(ResourceInterface $metadata) + public function supports(ResourceInterface $metadata): bool { return $metadata instanceof ContainerParametersResource; } @@ -38,7 +38,7 @@ public function supports(ResourceInterface $metadata) /** * {@inheritdoc} */ - public function isFresh(ResourceInterface $resource, int $timestamp) + public function isFresh(ResourceInterface $resource, int $timestamp): bool { foreach ($resource->getParameters() as $key => $value) { if (!$this->container->hasParameter($key) || $this->container->getParameter($key) !== $value) { diff --git a/src/Symfony/Component/DependencyInjection/Container.php b/src/Symfony/Component/DependencyInjection/Container.php index ea06e0bc241d5..2eb55d60ea3e3 100644 --- a/src/Symfony/Component/DependencyInjection/Container.php +++ b/src/Symfony/Component/DependencyInjection/Container.php @@ -89,7 +89,7 @@ public function compile() * * @return bool */ - public function isCompiled() + public function isCompiled(): bool { return $this->compiled; } @@ -99,7 +99,7 @@ public function isCompiled() * * @return ParameterBagInterface */ - public function getParameterBag() + public function getParameterBag(): ParameterBagInterface { return $this->parameterBag; } @@ -119,7 +119,7 @@ public function getParameter(string $name) /** * @return bool The presence of parameter in container */ - public function hasParameter(string $name) + public function hasParameter(string $name): bool { return $this->parameterBag->has($name); } @@ -199,7 +199,7 @@ public function has(string $id): bool * * @see Reference */ - public function get(string $id, int $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE) + public function get(string $id, int $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE): ?object { return $this->services[$id] ?? $this->services[$id = $this->aliases[$id] ?? $id] @@ -266,7 +266,7 @@ private function make(string $id, int $invalidBehavior) * * @return bool true if service has already been initialized, false otherwise */ - public function initialized(string $id) + public function initialized(string $id): bool { if (isset($this->aliases[$id])) { $id = $this->aliases[$id]; @@ -303,7 +303,7 @@ public function reset() * * @return string[] An array of all defined service ids */ - public function getServiceIds() + public function getServiceIds(): array { return array_map('strval', array_unique(array_merge(['service_container'], array_keys($this->fileMap), array_keys($this->methodMap), array_keys($this->aliases), array_keys($this->services)))); } @@ -313,7 +313,7 @@ public function getServiceIds() * * @return array */ - public function getRemovedIds() + public function getRemovedIds(): array { return []; } @@ -323,7 +323,7 @@ public function getRemovedIds() * * @return string The camelized string */ - public static function camelize(string $id) + public static function camelize(string $id): string { return strtr(ucwords(strtr($id, ['_' => ' ', '.' => '_ ', '\\' => '_ '])), [' ' => '']); } @@ -333,7 +333,7 @@ public static function camelize(string $id) * * @return string The underscored string */ - public static function underscore(string $id) + public static function underscore(string $id): string { return strtolower(preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'], ['\\1_\\2', '\\1_\\2'], str_replace('_', '.', $id))); } @@ -353,7 +353,7 @@ protected function load(string $file) * * @throws EnvNotFoundException When the environment variable is not found and has no default value */ - protected function getEnv(string $name) + protected function getEnv(string $name): mixed { if (isset($this->resolving[$envName = "env($name)"])) { throw new ParameterCircularReferenceException(array_keys($this->resolving)); diff --git a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php index 7a9c35d375085..5f08bdf0a1a71 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php +++ b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php @@ -163,7 +163,7 @@ public function setResourceTracking(bool $track) * * @return bool true If resources are tracked, false otherwise */ - public function isTrackingResources() + public function isTrackingResources(): bool { return $this->trackResources; } @@ -192,7 +192,7 @@ public function registerExtension(ExtensionInterface $extension) * * @throws LogicException if the extension is not registered */ - public function getExtension(string $name) + public function getExtension(string $name): ExtensionInterface { if (isset($this->extensions[$name])) { return $this->extensions[$name]; @@ -210,7 +210,7 @@ public function getExtension(string $name) * * @return ExtensionInterface[] An array of ExtensionInterface */ - public function getExtensions() + public function getExtensions(): array { return $this->extensions; } @@ -220,7 +220,7 @@ public function getExtensions() * * @return bool If the extension exists */ - public function hasExtension(string $name) + public function hasExtension(string $name): bool { return isset($this->extensions[$name]) || isset($this->extensionsByNs[$name]); } @@ -230,7 +230,7 @@ public function hasExtension(string $name) * * @return ResourceInterface[] An array of resources */ - public function getResources() + public function getResources(): array { return array_values($this->resources); } @@ -238,7 +238,7 @@ public function getResources() /** * @return $this */ - public function addResource(ResourceInterface $resource) + public function addResource(ResourceInterface $resource): static { if (!$this->trackResources) { return $this; @@ -260,7 +260,7 @@ public function addResource(ResourceInterface $resource) * * @return $this */ - public function setResources(array $resources) + public function setResources(array $resources): static { if (!$this->trackResources) { return $this; @@ -278,7 +278,7 @@ public function setResources(array $resources) * * @return $this */ - public function addObjectResource(object|string $object) + public function addObjectResource(object|string $object): static { if ($this->trackResources) { if (\is_object($object)) { @@ -409,7 +409,7 @@ public function fileExists(string $path, bool|string $trackContents = true): boo * @throws BadMethodCallException When this ContainerBuilder is compiled * @throws \LogicException if the extension is not registered */ - public function loadFromExtension(string $extension, array $values = null) + public function loadFromExtension(string $extension, array $values = null): static { if ($this->isCompiled()) { throw new BadMethodCallException('Cannot load from an extension on a compiled container.'); @@ -434,7 +434,7 @@ public function loadFromExtension(string $extension, array $values = null) * * @return $this */ - public function addCompilerPass(CompilerPassInterface $pass, string $type = PassConfig::TYPE_BEFORE_OPTIMIZATION, int $priority = 0) + public function addCompilerPass(CompilerPassInterface $pass, string $type = PassConfig::TYPE_BEFORE_OPTIMIZATION, int $priority = 0): static { $this->getCompiler()->addPass($pass, $type, $priority); @@ -448,7 +448,7 @@ public function addCompilerPass(CompilerPassInterface $pass, string $type = Pass * * @return PassConfig The compiler pass config */ - public function getCompilerPassConfig() + public function getCompilerPassConfig(): PassConfig { return $this->getCompiler()->getPassConfig(); } @@ -458,7 +458,7 @@ public function getCompilerPassConfig() * * @return Compiler The compiler */ - public function getCompiler() + public function getCompiler(): Compiler { return $this->compiler ??= new Compiler(); } @@ -506,7 +506,7 @@ public function has(string $id): bool * * @see Reference */ - public function get(string $id, int $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE) + public function get(string $id, int $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE): ?object { if ($this->isCompiled() && isset($this->removedIds[$id]) && ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE >= $invalidBehavior) { return parent::get($id); @@ -659,7 +659,7 @@ public function merge(self $container) * * @return array An array of configuration */ - public function getExtensionConfig(string $name) + public function getExtensionConfig(string $name): array { if (!isset($this->extensionConfigs[$name])) { $this->extensionConfigs[$name] = []; @@ -744,7 +744,7 @@ public function compile(bool $resolveEnvPlaceholders = false) /** * {@inheritdoc} */ - public function getServiceIds() + public function getServiceIds(): array { return array_map('strval', array_unique(array_merge(array_keys($this->getDefinitions()), array_keys($this->aliasDefinitions), parent::getServiceIds()))); } @@ -754,7 +754,7 @@ public function getServiceIds() * * @return array */ - public function getRemovedIds() + public function getRemovedIds(): array { return $this->removedIds; } @@ -786,7 +786,7 @@ public function setAliases(array $aliases) * @throws InvalidArgumentException if the id is not a string or an Alias * @throws InvalidArgumentException if the alias is for itself */ - public function setAlias(string $alias, string|Alias $id) + public function setAlias(string $alias, string|Alias $id): Alias { if ('' === $alias || '\\' === $alias[-1] || \strlen($alias) !== strcspn($alias, "\0\r\n'")) { throw new InvalidArgumentException(sprintf('Invalid alias id: "%s".', $alias)); @@ -816,7 +816,7 @@ public function removeAlias(string $alias) /** * @return bool true if the alias exists, false otherwise */ - public function hasAlias(string $id) + public function hasAlias(string $id): bool { return isset($this->aliasDefinitions[$id]); } @@ -824,7 +824,7 @@ public function hasAlias(string $id) /** * @return Alias[] An array of aliases */ - public function getAliases() + public function getAliases(): array { return $this->aliasDefinitions; } @@ -834,7 +834,7 @@ public function getAliases() * * @throws InvalidArgumentException if the alias does not exist */ - public function getAlias(string $id) + public function getAlias(string $id): Alias { if (!isset($this->aliasDefinitions[$id])) { throw new InvalidArgumentException(sprintf('The service alias "%s" does not exist.', $id)); @@ -851,7 +851,7 @@ public function getAlias(string $id) * * @return Definition */ - public function register(string $id, string $class = null) + public function register(string $id, string $class = null): Definition { return $this->setDefinition($id, new Definition($class)); } @@ -864,7 +864,7 @@ public function register(string $id, string $class = null) * * @return Definition The created definition */ - public function autowire(string $id, string $class = null) + public function autowire(string $id, string $class = null): Definition { return $this->setDefinition($id, (new Definition($class))->setAutowired(true)); } @@ -897,7 +897,7 @@ public function setDefinitions(array $definitions) * * @return Definition[] */ - public function getDefinitions() + public function getDefinitions(): array { return $this->definitions; } @@ -909,7 +909,7 @@ public function getDefinitions() * * @throws BadMethodCallException When this ContainerBuilder is compiled */ - public function setDefinition(string $id, Definition $definition) + public function setDefinition(string $id, Definition $definition): Definition { if ($this->isCompiled()) { throw new BadMethodCallException('Adding definition to a compiled container is not allowed.'); @@ -929,7 +929,7 @@ public function setDefinition(string $id, Definition $definition) * * @return bool true if the service definition exists, false otherwise */ - public function hasDefinition(string $id) + public function hasDefinition(string $id): bool { return isset($this->definitions[$id]); } @@ -941,7 +941,7 @@ public function hasDefinition(string $id) * * @throws ServiceNotFoundException if the service definition does not exist */ - public function getDefinition(string $id) + public function getDefinition(string $id): Definition { if (!isset($this->definitions[$id])) { throw new ServiceNotFoundException($id); @@ -959,7 +959,7 @@ public function getDefinition(string $id) * * @throws ServiceNotFoundException if the service definition does not exist */ - public function findDefinition(string $id) + public function findDefinition(string $id): Definition { $seen = []; while (isset($this->aliasDefinitions[$id])) { @@ -1111,7 +1111,7 @@ private function createService(Definition $definition, array &$inlineServices, b * @return mixed The same value with all service references replaced by * the real service instances and all expressions evaluated */ - public function resolveServices(mixed $value) + public function resolveServices(mixed $value): mixed { return $this->doResolveServices($value); } @@ -1202,7 +1202,7 @@ private function doResolveServices(mixed $value, array &$inlineServices = [], bo * * @return array An array of tags with the tagged service as key, holding a list of attribute arrays */ - public function findTaggedServiceIds(string $name, bool $throwOnAbstract = false) + public function findTaggedServiceIds(string $name, bool $throwOnAbstract = false): array { $this->usedTags[] = $name; $tags = []; @@ -1223,7 +1223,7 @@ public function findTaggedServiceIds(string $name, bool $throwOnAbstract = false * * @return array An array of tags */ - public function findTags() + public function findTags(): array { $tags = []; foreach ($this->getDefinitions() as $id => $definition) { @@ -1238,7 +1238,7 @@ public function findTags() * * @return string[] An array of tags */ - public function findUnusedTags() + public function findUnusedTags(): array { return array_values(array_diff($this->findTags(), $this->usedTags)); } @@ -1251,7 +1251,7 @@ public function addExpressionLanguageProvider(ExpressionFunctionProviderInterfac /** * @return ExpressionFunctionProviderInterface[] */ - public function getExpressionLanguageProviders() + public function getExpressionLanguageProviders(): array { return $this->expressionLanguageProviders; } @@ -1261,7 +1261,7 @@ public function getExpressionLanguageProviders() * * @return ChildDefinition */ - public function registerForAutoconfiguration(string $interface) + public function registerForAutoconfiguration(string $interface): ChildDefinition { if (!isset($this->autoconfiguredInstanceof[$interface])) { $this->autoconfiguredInstanceof[$interface] = new ChildDefinition(''); @@ -1304,7 +1304,7 @@ public function registerAliasForArgument(string $id, string $type, string $name * * @return ChildDefinition[] */ - public function getAutoconfiguredInstanceof() + public function getAutoconfiguredInstanceof(): array { return $this->autoconfiguredInstanceof; } @@ -1327,7 +1327,7 @@ public function getAutoconfiguredAttributes(): array * * @return mixed The value with env parameters resolved if a string or an array is passed */ - public function resolveEnvPlaceholders(mixed $value, string|bool $format = null, array &$usedEnvs = null) + public function resolveEnvPlaceholders(mixed $value, string|bool $format = null, array &$usedEnvs = null): mixed { if (null === $format) { $format = '%%env(%s)%%'; @@ -1392,7 +1392,7 @@ public function resolveEnvPlaceholders(mixed $value, string|bool $format = null, * * @return int[] The number of time each env vars has been resolved */ - public function getEnvCounters() + public function getEnvCounters(): array { $bag = $this->getParameterBag(); $envPlaceholders = $bag instanceof EnvPlaceholderParameterBag ? $bag->getEnvPlaceholders() : $this->envPlaceholders; @@ -1513,7 +1513,7 @@ public static function getInitializedConditionals(mixed $value): array * * @return string */ - public static function hash(mixed $value) + public static function hash(mixed $value): string { $hash = substr(base64_encode(hash('sha256', serialize($value), true)), 0, 7); @@ -1523,7 +1523,7 @@ public static function hash(mixed $value) /** * {@inheritdoc} */ - protected function getEnv(string $name) + protected function getEnv(string $name): mixed { $value = parent::getEnv($name); $bag = $this->getParameterBag(); diff --git a/src/Symfony/Component/DependencyInjection/ContainerInterface.php b/src/Symfony/Component/DependencyInjection/ContainerInterface.php index d4a2f21be2c9a..a720453aaa461 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerInterface.php +++ b/src/Symfony/Component/DependencyInjection/ContainerInterface.php @@ -40,7 +40,7 @@ public function set(string $id, ?object $service); * * @see Reference */ - public function get(string $id, int $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE); + public function get(string $id, int $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE): ?object; /** * @return bool true if the service is defined, false otherwise @@ -52,7 +52,7 @@ public function has(string $id): bool; * * @return bool true if the service has been initialized, false otherwise */ - public function initialized(string $id); + public function initialized(string $id): bool; /** * @return array|bool|string|int|float|null @@ -64,7 +64,7 @@ public function getParameter(string $name); /** * @return bool */ - public function hasParameter(string $name); + public function hasParameter(string $name): bool; public function setParameter(string $name, array|bool|string|int|float|null $value); } diff --git a/src/Symfony/Component/DependencyInjection/Definition.php b/src/Symfony/Component/DependencyInjection/Definition.php index e975e70555c65..75815f0698e5b 100644 --- a/src/Symfony/Component/DependencyInjection/Definition.php +++ b/src/Symfony/Component/DependencyInjection/Definition.php @@ -74,7 +74,7 @@ public function __construct(string $class = null, array $arguments = []) * * @return array An array of changes for this Definition */ - public function getChanges() + public function getChanges(): array { return $this->changes; } @@ -86,7 +86,7 @@ public function getChanges() * * @return $this */ - public function setChanges(array $changes) + public function setChanges(array $changes): static { $this->changes = $changes; @@ -100,7 +100,7 @@ public function setChanges(array $changes) * * @return $this */ - public function setFactory(string|array|Reference|null $factory) + public function setFactory(string|array|Reference|null $factory): static { $this->changes['factory'] = true; @@ -120,7 +120,7 @@ public function setFactory(string|array|Reference|null $factory) * * @return string|array|null The PHP function or an array containing a class/Reference and a method to call */ - public function getFactory() + public function getFactory(): string|array|null { return $this->factory; } @@ -135,7 +135,7 @@ public function getFactory() * * @throws InvalidArgumentException in case the decorated service id and the new decorated service id are equals */ - public function setDecoratedService(?string $id, string $renamedId = null, int $priority = 0, int $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE) + public function setDecoratedService(?string $id, string $renamedId = null, int $priority = 0, int $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE): static { if ($renamedId && $id === $renamedId) { throw new InvalidArgumentException(sprintf('The decorated service inner name for "%s" must be different than the service name itself.', $id)); @@ -161,7 +161,7 @@ public function setDecoratedService(?string $id, string $renamedId = null, int $ * * @return array|null An array composed of the decorated service id, the new id for it and the priority of decoration, null if no service is decorated */ - public function getDecoratedService() + public function getDecoratedService(): ?array { return $this->decoratedService; } @@ -171,7 +171,7 @@ public function getDecoratedService() * * @return $this */ - public function setClass(?string $class) + public function setClass(?string $class): static { $this->changes['class'] = true; @@ -185,7 +185,7 @@ public function setClass(?string $class) * * @return string|null The service class */ - public function getClass() + public function getClass(): ?string { return $this->class; } @@ -195,7 +195,7 @@ public function getClass() * * @return $this */ - public function setArguments(array $arguments) + public function setArguments(array $arguments): static { $this->arguments = $arguments; @@ -207,7 +207,7 @@ public function setArguments(array $arguments) * * @return $this */ - public function setProperties(array $properties) + public function setProperties(array $properties): static { $this->properties = $properties; @@ -219,7 +219,7 @@ public function setProperties(array $properties) * * @return array */ - public function getProperties() + public function getProperties(): array { return $this->properties; } @@ -229,7 +229,7 @@ public function getProperties() * * @return $this */ - public function setProperty(string $name, mixed $value) + public function setProperty(string $name, mixed $value): static { $this->properties[$name] = $value; @@ -241,7 +241,7 @@ public function setProperty(string $name, mixed $value) * * @return $this */ - public function addArgument(mixed $argument) + public function addArgument(mixed $argument): static { $this->arguments[] = $argument; @@ -255,7 +255,7 @@ public function addArgument(mixed $argument) * * @throws OutOfBoundsException When the replaced argument does not exist */ - public function replaceArgument(int|string $index, mixed $argument) + public function replaceArgument(int|string $index, mixed $argument): static { if (0 === \count($this->arguments)) { throw new OutOfBoundsException('Cannot replace arguments if none have been configured yet.'); @@ -279,7 +279,7 @@ public function replaceArgument(int|string $index, mixed $argument) * * @return $this */ - public function setArgument(int|string $key, mixed $value) + public function setArgument(int|string $key, mixed $value): static { $this->arguments[$key] = $value; @@ -291,7 +291,7 @@ public function setArgument(int|string $key, mixed $value) * * @return array The array of arguments */ - public function getArguments() + public function getArguments(): array { return $this->arguments; } @@ -303,7 +303,7 @@ public function getArguments() * * @throws OutOfBoundsException When the argument does not exist */ - public function getArgument(int|string $index) + public function getArgument(int|string $index): mixed { if (!\array_key_exists($index, $this->arguments)) { throw new OutOfBoundsException(sprintf('The argument "%s" doesn\'t exist.', $index)); @@ -317,7 +317,7 @@ public function getArgument(int|string $index) * * @return $this */ - public function setMethodCalls(array $calls = []) + public function setMethodCalls(array $calls = []): static { $this->calls = []; foreach ($calls as $call) { @@ -338,7 +338,7 @@ public function setMethodCalls(array $calls = []) * * @throws InvalidArgumentException on empty $method param */ - public function addMethodCall(string $method, array $arguments = [], bool $returnsClone = false) + public function addMethodCall(string $method, array $arguments = [], bool $returnsClone = false): static { if (empty($method)) { throw new InvalidArgumentException('Method name cannot be empty.'); @@ -353,7 +353,7 @@ public function addMethodCall(string $method, array $arguments = [], bool $retur * * @return $this */ - public function removeMethodCall(string $method) + public function removeMethodCall(string $method): static { foreach ($this->calls as $i => $call) { if ($call[0] === $method) { @@ -369,7 +369,7 @@ public function removeMethodCall(string $method) * * @return bool */ - public function hasMethodCall(string $method) + public function hasMethodCall(string $method): bool { foreach ($this->calls as $call) { if ($call[0] === $method) { @@ -385,7 +385,7 @@ public function hasMethodCall(string $method) * * @return array An array of method calls */ - public function getMethodCalls() + public function getMethodCalls(): array { return $this->calls; } @@ -397,7 +397,7 @@ public function getMethodCalls() * * @return $this */ - public function setInstanceofConditionals(array $instanceof) + public function setInstanceofConditionals(array $instanceof): static { $this->instanceof = $instanceof; @@ -409,7 +409,7 @@ public function setInstanceofConditionals(array $instanceof) * * @return ChildDefinition[] */ - public function getInstanceofConditionals() + public function getInstanceofConditionals(): array { return $this->instanceof; } @@ -419,7 +419,7 @@ public function getInstanceofConditionals() * * @return $this */ - public function setAutoconfigured(bool $autoconfigured) + public function setAutoconfigured(bool $autoconfigured): static { $this->changes['autoconfigured'] = true; @@ -431,7 +431,7 @@ public function setAutoconfigured(bool $autoconfigured) /** * @return bool */ - public function isAutoconfigured() + public function isAutoconfigured(): bool { return $this->autoconfigured; } @@ -441,7 +441,7 @@ public function isAutoconfigured() * * @return $this */ - public function setTags(array $tags) + public function setTags(array $tags): static { $this->tags = $tags; @@ -453,7 +453,7 @@ public function setTags(array $tags) * * @return array An array of tags */ - public function getTags() + public function getTags(): array { return $this->tags; } @@ -463,7 +463,7 @@ public function getTags() * * @return array An array of attributes */ - public function getTag(string $name) + public function getTag(string $name): array { return $this->tags[$name] ?? []; } @@ -473,7 +473,7 @@ public function getTag(string $name) * * @return $this */ - public function addTag(string $name, array $attributes = []) + public function addTag(string $name, array $attributes = []): static { $this->tags[$name][] = $attributes; @@ -485,7 +485,7 @@ public function addTag(string $name, array $attributes = []) * * @return bool */ - public function hasTag(string $name) + public function hasTag(string $name): bool { return isset($this->tags[$name]); } @@ -495,7 +495,7 @@ public function hasTag(string $name) * * @return $this */ - public function clearTag(string $name) + public function clearTag(string $name): static { unset($this->tags[$name]); @@ -507,7 +507,7 @@ public function clearTag(string $name) * * @return $this */ - public function clearTags() + public function clearTags(): static { $this->tags = []; @@ -519,7 +519,7 @@ public function clearTags() * * @return $this */ - public function setFile(?string $file) + public function setFile(?string $file): static { $this->changes['file'] = true; @@ -533,7 +533,7 @@ public function setFile(?string $file) * * @return string|null The full pathname to include */ - public function getFile() + public function getFile(): ?string { return $this->file; } @@ -543,7 +543,7 @@ public function getFile() * * @return $this */ - public function setShared(bool $shared) + public function setShared(bool $shared): static { $this->changes['shared'] = true; @@ -557,7 +557,7 @@ public function setShared(bool $shared) * * @return bool */ - public function isShared() + public function isShared(): bool { return $this->shared; } @@ -567,7 +567,7 @@ public function isShared() * * @return $this */ - public function setPublic(bool $boolean) + public function setPublic(bool $boolean): static { $this->changes['public'] = true; @@ -581,7 +581,7 @@ public function setPublic(bool $boolean) * * @return bool */ - public function isPublic() + public function isPublic(): bool { return $this->public; } @@ -591,7 +591,7 @@ public function isPublic() * * @return bool */ - public function isPrivate() + public function isPrivate(): bool { return !$this->public; } @@ -601,7 +601,7 @@ public function isPrivate() * * @return $this */ - public function setLazy(bool $lazy) + public function setLazy(bool $lazy): static { $this->changes['lazy'] = true; @@ -615,7 +615,7 @@ public function setLazy(bool $lazy) * * @return bool */ - public function isLazy() + public function isLazy(): bool { return $this->lazy; } @@ -626,7 +626,7 @@ public function isLazy() * * @return $this */ - public function setSynthetic(bool $boolean) + public function setSynthetic(bool $boolean): static { $this->synthetic = $boolean; @@ -643,7 +643,7 @@ public function setSynthetic(bool $boolean) * * @return bool */ - public function isSynthetic() + public function isSynthetic(): bool { return $this->synthetic; } @@ -654,7 +654,7 @@ public function isSynthetic() * * @return $this */ - public function setAbstract(bool $boolean) + public function setAbstract(bool $boolean): static { $this->abstract = $boolean; @@ -667,7 +667,7 @@ public function setAbstract(bool $boolean) * * @return bool */ - public function isAbstract() + public function isAbstract(): bool { return $this->abstract; } @@ -684,7 +684,7 @@ public function isAbstract() * * @throws InvalidArgumentException when the message template is invalid */ - public function setDeprecated(string $package, string $version, string $message) + public function setDeprecated(string $package, string $version, string $message): static { if ('' !== $message) { if (preg_match('#[\r\n]|\*/#', $message)) { @@ -708,7 +708,7 @@ public function setDeprecated(string $package, string $version, string $message) * * @return bool */ - public function isDeprecated() + public function isDeprecated(): bool { return (bool) $this->deprecation; } @@ -732,7 +732,7 @@ public function getDeprecation(string $id): array * * @return $this */ - public function setConfigurator(string|array|Reference|null $configurator) + public function setConfigurator(string|array|Reference|null $configurator): static { $this->changes['configurator'] = true; @@ -752,7 +752,7 @@ public function setConfigurator(string|array|Reference|null $configurator) * * @return string|array|null */ - public function getConfigurator() + public function getConfigurator(): string|array|null { return $this->configurator; } @@ -762,7 +762,7 @@ public function getConfigurator() * * @return bool */ - public function isAutowired() + public function isAutowired(): bool { return $this->autowired; } @@ -772,7 +772,7 @@ public function isAutowired() * * @return $this */ - public function setAutowired(bool $autowired) + public function setAutowired(bool $autowired): static { $this->changes['autowired'] = true; @@ -786,7 +786,7 @@ public function setAutowired(bool $autowired) * * @return array|BoundArgument[] */ - public function getBindings() + public function getBindings(): array { return $this->bindings; } @@ -800,7 +800,7 @@ public function getBindings() * * @return $this */ - public function setBindings(array $bindings) + public function setBindings(array $bindings): static { foreach ($bindings as $key => $binding) { if (0 < strpos($key, '$') && $key !== $k = preg_replace('/[ \t]*\$/', ' $', $key)) { @@ -822,7 +822,7 @@ public function setBindings(array $bindings) * * @return $this */ - public function addError(string|\Closure|Definition $error) + public function addError(string|\Closure|Definition $error): static { if ($error instanceof self) { $this->errors = array_merge($this->errors, $error->errors); @@ -838,7 +838,7 @@ public function addError(string|\Closure|Definition $error) * * @return array */ - public function getErrors() + public function getErrors(): array { foreach ($this->errors as $i => $error) { if ($error instanceof \Closure) { diff --git a/src/Symfony/Component/DependencyInjection/Dumper/DumperInterface.php b/src/Symfony/Component/DependencyInjection/Dumper/DumperInterface.php index 8abc19250f70b..7951e1bacb5ff 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/DumperInterface.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/DumperInterface.php @@ -23,5 +23,5 @@ interface DumperInterface * * @return string|array The representation of the service container */ - public function dump(array $options = []); + public function dump(array $options = []): string|array; } diff --git a/src/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php index 119aec18ecaf6..31c1e9c72bfa6 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php @@ -56,7 +56,7 @@ class GraphvizDumper extends Dumper * * @return string The dot representation of the service container */ - public function dump(array $options = []) + public function dump(array $options = []): string { foreach (['graph', 'node', 'edge', 'node.instance', 'node.definition', 'node.missing'] as $key) { if (isset($options[$key])) { diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php index 4dd495d047c88..d64be14cd1025 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php @@ -125,7 +125,7 @@ public function setProxyDumper(ProxyDumper $proxyDumper) * * @throws EnvParameterException When an env var exists but has not been dumped */ - public function dump(array $options = []) + public function dump(array $options = []): string|array { $this->locatedIds = []; $this->targetDirRegex = null; @@ -1499,10 +1499,7 @@ private function addDefaultParametersMethod(): string $code = <<<'EOF' - /** - * @return array|bool|float|int|string|null - */ - public function getParameter(string $name) + public function getParameter(string $name): array|string|int|float|bool|null { if (isset($this->buildParameters[$name])) { return $this->buildParameters[$name]; diff --git a/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php index 90a7c8116b5bd..388b5b07a9cd6 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php @@ -39,7 +39,7 @@ class XmlDumper extends Dumper * * @return string An xml string representing of the service container */ - public function dump(array $options = []) + public function dump(array $options = []): string { $this->document = new \DOMDocument('1.0', 'utf-8'); $this->document->formatOutput = true; diff --git a/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php index 0d09c2ea5f630..6a6601b507088 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php @@ -44,7 +44,7 @@ class YamlDumper extends Dumper * * @return string A YAML string representing of the service container */ - public function dump(array $options = []) + public function dump(array $options = []): string { if (!class_exists(YmlDumper::class)) { throw new LogicException('Unable to dump the container as the Symfony Yaml Component is not installed.'); diff --git a/src/Symfony/Component/DependencyInjection/EnvVarProcessor.php b/src/Symfony/Component/DependencyInjection/EnvVarProcessor.php index cba80cf172d9e..1e54ad9a8d29e 100644 --- a/src/Symfony/Component/DependencyInjection/EnvVarProcessor.php +++ b/src/Symfony/Component/DependencyInjection/EnvVarProcessor.php @@ -36,7 +36,7 @@ public function __construct(ContainerInterface $container, \Traversable $loaders /** * {@inheritdoc} */ - public static function getProvidedTypes() + public static function getProvidedTypes(): array { return [ 'base64' => 'string', @@ -62,7 +62,7 @@ public static function getProvidedTypes() /** * {@inheritdoc} */ - public function getEnv(string $prefix, string $name, \Closure $getEnv) + public function getEnv(string $prefix, string $name, \Closure $getEnv): mixed { $i = strpos($name, ':'); diff --git a/src/Symfony/Component/DependencyInjection/EnvVarProcessorInterface.php b/src/Symfony/Component/DependencyInjection/EnvVarProcessorInterface.php index d3275fe290e36..8253dbfce00a5 100644 --- a/src/Symfony/Component/DependencyInjection/EnvVarProcessorInterface.php +++ b/src/Symfony/Component/DependencyInjection/EnvVarProcessorInterface.php @@ -31,10 +31,10 @@ interface EnvVarProcessorInterface * * @throws RuntimeException on error */ - public function getEnv(string $prefix, string $name, \Closure $getEnv); + public function getEnv(string $prefix, string $name, \Closure $getEnv): mixed; /** * @return string[] The PHP-types managed by getEnv(), keyed by prefixes */ - public static function getProvidedTypes(); + public static function getProvidedTypes(): array; } diff --git a/src/Symfony/Component/DependencyInjection/ExpressionLanguageProvider.php b/src/Symfony/Component/DependencyInjection/ExpressionLanguageProvider.php index 6c5551b6db563..d0e7ae54d5a65 100644 --- a/src/Symfony/Component/DependencyInjection/ExpressionLanguageProvider.php +++ b/src/Symfony/Component/DependencyInjection/ExpressionLanguageProvider.php @@ -31,7 +31,7 @@ public function __construct(callable $serviceCompiler = null) $this->serviceCompiler = $serviceCompiler !== null && !$serviceCompiler instanceof \Closure ? \Closure::fromCallable($serviceCompiler) : $serviceCompiler; } - public function getFunctions() + public function getFunctions(): array { return [ new ExpressionFunction('service', $this->serviceCompiler ?? function ($arg) { diff --git a/src/Symfony/Component/DependencyInjection/Extension/Extension.php b/src/Symfony/Component/DependencyInjection/Extension/Extension.php index 2c0ed13e5c899..a8fb35353cfa4 100644 --- a/src/Symfony/Component/DependencyInjection/Extension/Extension.php +++ b/src/Symfony/Component/DependencyInjection/Extension/Extension.php @@ -64,7 +64,7 @@ public function getNamespace() * * @throws BadMethodCallException When the extension name does not follow conventions */ - public function getAlias() + public function getAlias(): string { $className = static::class; if (!str_ends_with($className, 'Extension')) { @@ -128,7 +128,7 @@ final public function getProcessedConfigs(): array * * @throws InvalidArgumentException When the config is not enableable */ - protected function isConfigEnabled(ContainerBuilder $container, array $config) + protected function isConfigEnabled(ContainerBuilder $container, array $config): bool { if (!\array_key_exists('enabled', $config)) { throw new InvalidArgumentException("The config array has no 'enabled' key."); diff --git a/src/Symfony/Component/DependencyInjection/Extension/ExtensionInterface.php b/src/Symfony/Component/DependencyInjection/Extension/ExtensionInterface.php index 6a7a2cf023819..ee72297e45095 100644 --- a/src/Symfony/Component/DependencyInjection/Extension/ExtensionInterface.php +++ b/src/Symfony/Component/DependencyInjection/Extension/ExtensionInterface.php @@ -48,5 +48,5 @@ public function getXsdValidationBasePath(); * * @return string The alias */ - public function getAlias(); + public function getAlias(): string; } diff --git a/src/Symfony/Component/DependencyInjection/LazyProxy/Instantiator/RealServiceInstantiator.php b/src/Symfony/Component/DependencyInjection/LazyProxy/Instantiator/RealServiceInstantiator.php index 1696e7a90482f..38ccca525b1ef 100644 --- a/src/Symfony/Component/DependencyInjection/LazyProxy/Instantiator/RealServiceInstantiator.php +++ b/src/Symfony/Component/DependencyInjection/LazyProxy/Instantiator/RealServiceInstantiator.php @@ -26,7 +26,7 @@ class RealServiceInstantiator implements InstantiatorInterface /** * {@inheritdoc} */ - public function instantiateProxy(ContainerInterface $container, Definition $definition, string $id, callable $realInstantiator) + public function instantiateProxy(ContainerInterface $container, Definition $definition, string $id, callable $realInstantiator): object { return $realInstantiator(); } diff --git a/src/Symfony/Component/DependencyInjection/LazyProxy/PhpDumper/DumperInterface.php b/src/Symfony/Component/DependencyInjection/LazyProxy/PhpDumper/DumperInterface.php index 351560d2926ad..406b23a6652c6 100644 --- a/src/Symfony/Component/DependencyInjection/LazyProxy/PhpDumper/DumperInterface.php +++ b/src/Symfony/Component/DependencyInjection/LazyProxy/PhpDumper/DumperInterface.php @@ -25,19 +25,19 @@ interface DumperInterface * * @return bool */ - public function isProxyCandidate(Definition $definition); + public function isProxyCandidate(Definition $definition): bool; /** * Generates the code to be used to instantiate a proxy in the dumped factory code. * * @return string */ - public function getProxyFactoryCode(Definition $definition, string $id, string $factoryCode); + public function getProxyFactoryCode(Definition $definition, string $id, string $factoryCode): string; /** * Generates the code for the lazy proxy. * * @return string */ - public function getProxyCode(Definition $definition); + public function getProxyCode(Definition $definition): string; } diff --git a/src/Symfony/Component/DependencyInjection/Loader/ClosureLoader.php b/src/Symfony/Component/DependencyInjection/Loader/ClosureLoader.php index 87907bc113a1a..d84563603e012 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/ClosureLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/ClosureLoader.php @@ -34,7 +34,7 @@ public function __construct(ContainerBuilder $container, string $env = null) /** * {@inheritdoc} */ - public function load(mixed $resource, string $type = null) + public function load(mixed $resource, string $type = null): mixed { return $resource($this->container, $this->env); } @@ -42,7 +42,7 @@ public function load(mixed $resource, string $type = null) /** * {@inheritdoc} */ - public function supports(mixed $resource, string $type = null) + public function supports(mixed $resource, string $type = null): bool { return $resource instanceof \Closure; } diff --git a/src/Symfony/Component/DependencyInjection/Loader/Configurator/AbstractConfigurator.php b/src/Symfony/Component/DependencyInjection/Loader/Configurator/AbstractConfigurator.php index d188180ac199c..e996c1d699ba5 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/Configurator/AbstractConfigurator.php +++ b/src/Symfony/Component/DependencyInjection/Loader/Configurator/AbstractConfigurator.php @@ -44,7 +44,7 @@ public function __call(string $method, array $args) /** * @return array */ - public function __sleep() + public function __sleep(): array { throw new \BadMethodCallException('Cannot serialize '.__CLASS__); } @@ -61,7 +61,7 @@ public function __wakeup() * * @return mixed the value, optionally cast to a Definition/Reference */ - public static function processValue(mixed $value, bool $allowServices = false) + public static function processValue(mixed $value, bool $allowServices = false): mixed { if (\is_array($value)) { foreach ($value as $k => $v) { diff --git a/src/Symfony/Component/DependencyInjection/Loader/Configurator/EnvConfigurator.php b/src/Symfony/Component/DependencyInjection/Loader/Configurator/EnvConfigurator.php index 8957224f9c82a..c7ee82328e0f9 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/Configurator/EnvConfigurator.php +++ b/src/Symfony/Component/DependencyInjection/Loader/Configurator/EnvConfigurator.php @@ -33,7 +33,7 @@ public function __toString(): string /** * @return $this */ - public function __call(string $name, array $arguments): self + public function __call(string $name, array $arguments): static { $processor = strtolower(preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'], '\1_\2', $name)); @@ -45,7 +45,7 @@ public function __call(string $name, array $arguments): self /** * @return $this */ - public function custom(string $processor, ...$args): self + public function custom(string $processor, ...$args): static { array_unshift($this->stack, $processor, ...$args); @@ -55,7 +55,7 @@ public function custom(string $processor, ...$args): self /** * @return $this */ - public function base64(): self + public function base64(): static { array_unshift($this->stack, 'base64'); @@ -65,7 +65,7 @@ public function base64(): self /** * @return $this */ - public function bool(): self + public function bool(): static { array_unshift($this->stack, 'bool'); @@ -75,7 +75,7 @@ public function bool(): self /** * @return $this */ - public function not(): self + public function not(): static { array_unshift($this->stack, 'not'); @@ -85,7 +85,7 @@ public function not(): self /** * @return $this */ - public function const(): self + public function const(): static { array_unshift($this->stack, 'const'); @@ -95,7 +95,7 @@ public function const(): self /** * @return $this */ - public function csv(): self + public function csv(): static { array_unshift($this->stack, 'csv'); @@ -105,7 +105,7 @@ public function csv(): self /** * @return $this */ - public function file(): self + public function file(): static { array_unshift($this->stack, 'file'); @@ -115,7 +115,7 @@ public function file(): self /** * @return $this */ - public function float(): self + public function float(): static { array_unshift($this->stack, 'float'); @@ -125,7 +125,7 @@ public function float(): self /** * @return $this */ - public function int(): self + public function int(): static { array_unshift($this->stack, 'int'); @@ -135,7 +135,7 @@ public function int(): self /** * @return $this */ - public function json(): self + public function json(): static { array_unshift($this->stack, 'json'); @@ -145,7 +145,7 @@ public function json(): self /** * @return $this */ - public function key(string $key): self + public function key(string $key): static { array_unshift($this->stack, 'key', $key); @@ -155,7 +155,7 @@ public function key(string $key): self /** * @return $this */ - public function url(): self + public function url(): static { array_unshift($this->stack, 'url'); @@ -165,7 +165,7 @@ public function url(): self /** * @return $this */ - public function queryString(): self + public function queryString(): static { array_unshift($this->stack, 'query_string'); @@ -175,7 +175,7 @@ public function queryString(): self /** * @return $this */ - public function resolve(): self + public function resolve(): static { array_unshift($this->stack, 'resolve'); @@ -185,7 +185,7 @@ public function resolve(): self /** * @return $this */ - public function default(string $fallbackParam): self + public function default(string $fallbackParam): static { array_unshift($this->stack, 'default', $fallbackParam); @@ -195,7 +195,7 @@ public function default(string $fallbackParam): self /** * @return $this */ - public function string(): self + public function string(): static { array_unshift($this->stack, 'string'); @@ -205,7 +205,7 @@ public function string(): self /** * @return $this */ - public function trim(): self + public function trim(): static { array_unshift($this->stack, 'trim'); @@ -215,7 +215,7 @@ public function trim(): self /** * @return $this */ - public function require(): self + public function require(): static { array_unshift($this->stack, 'require'); diff --git a/src/Symfony/Component/DependencyInjection/Loader/DirectoryLoader.php b/src/Symfony/Component/DependencyInjection/Loader/DirectoryLoader.php index 82edb04ca9c97..1247e0413ac8e 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/DirectoryLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/DirectoryLoader.php @@ -21,7 +21,7 @@ class DirectoryLoader extends FileLoader /** * {@inheritdoc} */ - public function load(mixed $file, string $type = null) + public function load(mixed $file, string $type = null): mixed { $file = rtrim($file, '/'); $path = $this->locator->locate($file); @@ -45,7 +45,7 @@ public function load(mixed $file, string $type = null) /** * {@inheritdoc} */ - public function supports(mixed $resource, string $type = null) + public function supports(mixed $resource, string $type = null): bool { if ('directory' === $type) { return true; diff --git a/src/Symfony/Component/DependencyInjection/Loader/FileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/FileLoader.php index 86895f0625fab..ffe933777df43 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/FileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/FileLoader.php @@ -52,7 +52,7 @@ public function __construct(ContainerBuilder $container, FileLocatorInterface $l * * @param bool|string $ignoreErrors Whether errors should be ignored; pass "not_found" to ignore only when the loaded resource is not found */ - public function import(mixed $resource, string $type = null, bool|string $ignoreErrors = false, string $sourceResource = null, $exclude = null) + public function import(mixed $resource, string $type = null, bool|string $ignoreErrors = false, string $sourceResource = null, $exclude = null): mixed { $args = \func_get_args(); diff --git a/src/Symfony/Component/DependencyInjection/Loader/GlobFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/GlobFileLoader.php index 51e1b9c19939e..e232af5f706c4 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/GlobFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/GlobFileLoader.php @@ -21,7 +21,7 @@ class GlobFileLoader extends FileLoader /** * {@inheritdoc} */ - public function load(mixed $resource, string $type = null) + public function load(mixed $resource, string $type = null): mixed { foreach ($this->glob($resource, false, $globResource) as $path => $info) { $this->import($path); @@ -35,7 +35,7 @@ public function load(mixed $resource, string $type = null) /** * {@inheritdoc} */ - public function supports(mixed $resource, string $type = null) + public function supports(mixed $resource, string $type = null): bool { return 'glob' === $type; } diff --git a/src/Symfony/Component/DependencyInjection/Loader/IniFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/IniFileLoader.php index 2f0824c8f9244..b150b4ac69a10 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/IniFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/IniFileLoader.php @@ -24,7 +24,7 @@ class IniFileLoader extends FileLoader /** * {@inheritdoc} */ - public function load(mixed $resource, string $type = null) + public function load(mixed $resource, string $type = null): mixed { $path = $this->locator->locate($resource); @@ -57,7 +57,7 @@ public function load(mixed $resource, string $type = null) /** * {@inheritdoc} */ - public function supports(mixed $resource, string $type = null) + public function supports(mixed $resource, string $type = null): bool { if (!\is_string($resource)) { return false; diff --git a/src/Symfony/Component/DependencyInjection/Loader/PhpFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/PhpFileLoader.php index fd4fb768b8ef5..86da211310b7a 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/PhpFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/PhpFileLoader.php @@ -45,7 +45,7 @@ public function __construct(ContainerBuilder $container, FileLocatorInterface $l /** * {@inheritdoc} */ - public function load(mixed $resource, string $type = null) + public function load(mixed $resource, string $type = null): mixed { // the container and loader variables are exposed to the included file below $container = $this->container; @@ -77,7 +77,7 @@ public function load(mixed $resource, string $type = null) /** * {@inheritdoc} */ - public function supports(mixed $resource, string $type = null) + public function supports(mixed $resource, string $type = null): bool { if (!\is_string($resource)) { return false; diff --git a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php index 0196f7af27d51..abd01ae978039 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php @@ -43,7 +43,7 @@ class XmlFileLoader extends FileLoader /** * {@inheritdoc} */ - public function load(mixed $resource, string $type = null) + public function load(mixed $resource, string $type = null): mixed { $path = $this->locator->locate($resource); @@ -98,7 +98,7 @@ private function loadXml(\DOMDocument $xml, string $path, \DOMNode $root = null) /** * {@inheritdoc} */ - public function supports(mixed $resource, string $type = null) + public function supports(mixed $resource, string $type = null): bool { if (!\is_string($resource)) { return false; @@ -594,7 +594,7 @@ private function getChildren(\DOMNode $node, string $name): array * * @throws RuntimeException When extension references a non-existent XSD file */ - public function validateSchema(\DOMDocument $dom) + public function validateSchema(\DOMDocument $dom): bool { $schemaLocations = ['http://symfony.com/schema/dic/services' => str_replace('\\', '/', __DIR__.'/schema/dic/services/services-1.0.xsd')]; @@ -770,7 +770,7 @@ private function loadFromExtensions(\DOMDocument $xml) * * @return mixed */ - public static function convertDomElementToArray(\DOMElement $element) + public static function convertDomElementToArray(\DOMElement $element): mixed { return XmlUtils::convertDomElementToArray($element); } diff --git a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php index 174d762df3ff0..59499bf12b2fb 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php @@ -116,7 +116,7 @@ class YamlFileLoader extends FileLoader /** * {@inheritdoc} */ - public function load(mixed $resource, string $type = null) + public function load(mixed $resource, string $type = null): mixed { $path = $this->locator->locate($resource); @@ -183,7 +183,7 @@ private function loadContent(array $content, string $path) /** * {@inheritdoc} */ - public function supports(mixed $resource, string $type = null) + public function supports(mixed $resource, string $type = null): bool { if (!\is_string($resource)) { return false; @@ -737,7 +737,7 @@ private function parseCallable(mixed $callable, string $parameter, string $id, s * * @throws InvalidArgumentException when the given file is not a local file or when it does not exist */ - protected function loadFile(string $file) + protected function loadFile(string $file): array { if (!class_exists(\Symfony\Component\Yaml\Parser::class)) { throw new RuntimeException('Unable to load YAML config files as the Symfony Yaml Component is not installed.'); diff --git a/src/Symfony/Component/DependencyInjection/ParameterBag/ContainerBag.php b/src/Symfony/Component/DependencyInjection/ParameterBag/ContainerBag.php index 47b58c16525d4..b3f23302155b6 100644 --- a/src/Symfony/Component/DependencyInjection/ParameterBag/ContainerBag.php +++ b/src/Symfony/Component/DependencyInjection/ParameterBag/ContainerBag.php @@ -28,7 +28,7 @@ public function __construct(Container $container) /** * {@inheritdoc} */ - public function all() + public function all(): array { return $this->container->getParameterBag()->all(); } @@ -38,7 +38,7 @@ public function all() * * @return array|bool|string|int|float|null */ - public function get(string $name) + public function get(string $name): array|bool|string|int|float|null { return $this->container->getParameter($name); } diff --git a/src/Symfony/Component/DependencyInjection/ParameterBag/ContainerBagInterface.php b/src/Symfony/Component/DependencyInjection/ParameterBag/ContainerBagInterface.php index f0b4c73c183e4..05b2f71ba81d6 100644 --- a/src/Symfony/Component/DependencyInjection/ParameterBag/ContainerBagInterface.php +++ b/src/Symfony/Component/DependencyInjection/ParameterBag/ContainerBagInterface.php @@ -26,7 +26,7 @@ interface ContainerBagInterface extends ContainerInterface * * @return array An array of parameters */ - public function all(); + public function all(): array; /** * Replaces parameter placeholders (%name%) by their values. @@ -40,12 +40,12 @@ public function resolveValue(mixed $value); * * @return mixed */ - public function escapeValue(mixed $value); + public function escapeValue(mixed $value): mixed; /** * Unescape parameter placeholders %. * * @return mixed */ - public function unescapeValue(mixed $value); + public function unescapeValue(mixed $value): mixed; } diff --git a/src/Symfony/Component/DependencyInjection/ParameterBag/EnvPlaceholderParameterBag.php b/src/Symfony/Component/DependencyInjection/ParameterBag/EnvPlaceholderParameterBag.php index e4964c27ec61b..0b6f082aaeb94 100644 --- a/src/Symfony/Component/DependencyInjection/ParameterBag/EnvPlaceholderParameterBag.php +++ b/src/Symfony/Component/DependencyInjection/ParameterBag/EnvPlaceholderParameterBag.php @@ -29,7 +29,7 @@ class EnvPlaceholderParameterBag extends ParameterBag /** * {@inheritdoc} */ - public function get(string $name) + public function get(string $name): array|bool|string|int|float|null { if (str_starts_with($name, 'env(') && str_ends_with($name, ')') && 'env()' !== $name) { $env = substr($name, 4, -1); @@ -80,7 +80,7 @@ public function getEnvPlaceholderUniquePrefix(): string * * @return string[][] A map of env var names to their placeholders */ - public function getEnvPlaceholders() + public function getEnvPlaceholders(): array { return $this->envPlaceholders; } @@ -130,7 +130,7 @@ public function setProvidedTypes(array $providedTypes) * * @return string[][] */ - public function getProvidedTypes() + public function getProvidedTypes(): array { return $this->providedTypes; } diff --git a/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php b/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php index 7b30ff9156260..fc67205b94a62 100644 --- a/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php +++ b/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php @@ -51,7 +51,7 @@ public function add(array $parameters) /** * {@inheritdoc} */ - public function all() + public function all(): array { return $this->parameters; } @@ -59,7 +59,7 @@ public function all() /** * {@inheritdoc} */ - public function get(string $name) + public function get(string $name): array|bool|string|int|float|null { if (!\array_key_exists($name, $this->parameters)) { if (!$name) { @@ -107,7 +107,7 @@ public function set(string $name, array|bool|string|int|float|null $value) /** * {@inheritdoc} */ - public function has(string $name) + public function has(string $name): bool { return \array_key_exists((string) $name, $this->parameters); } @@ -156,7 +156,7 @@ public function resolve() * @throws ParameterCircularReferenceException if a circular reference if detected * @throws RuntimeException when a given parameter has a type problem */ - public function resolveValue(mixed $value, array $resolving = []) + public function resolveValue(mixed $value, array $resolving = []): mixed { if (\is_array($value)) { $args = []; @@ -185,7 +185,7 @@ public function resolveValue(mixed $value, array $resolving = []) * @throws ParameterCircularReferenceException if a circular reference if detected * @throws RuntimeException when a given parameter has a type problem */ - public function resolveString(string $value, array $resolving = []) + public function resolveString(string $value, array $resolving = []): mixed { // we do this to deal with non string values (Boolean, integer, ...) // as the preg_replace_callback throw an exception when trying @@ -234,7 +234,7 @@ public function isResolved() /** * {@inheritdoc} */ - public function escapeValue(mixed $value) + public function escapeValue(mixed $value): mixed { if (\is_string($value)) { return str_replace('%', '%%', $value); @@ -255,7 +255,7 @@ public function escapeValue(mixed $value) /** * {@inheritdoc} */ - public function unescapeValue(mixed $value) + public function unescapeValue(mixed $value): mixed { if (\is_string($value)) { return str_replace('%%', '%', $value); diff --git a/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBagInterface.php b/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBagInterface.php index 1f36bb77bf083..83e8e430c01e9 100644 --- a/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBagInterface.php +++ b/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBagInterface.php @@ -40,7 +40,7 @@ public function add(array $parameters); * * @return array An array of parameters */ - public function all(); + public function all(): array; /** * Gets a service container parameter. @@ -49,7 +49,7 @@ public function all(); * * @throws ParameterNotFoundException if the parameter is not defined */ - public function get(string $name); + public function get(string $name): array|bool|string|int|float|null; /** * Removes a parameter. @@ -68,7 +68,7 @@ public function set(string $name, array|bool|string|int|float|null $value); * * @return bool true if the parameter name is defined, false otherwise */ - public function has(string $name); + public function has(string $name): bool; /** * Replaces parameter placeholders (%name%) by their values for all parameters. @@ -87,12 +87,12 @@ public function resolveValue(mixed $value); * * @return mixed */ - public function escapeValue(mixed $value); + public function escapeValue(mixed $value): mixed; /** * Unescape parameter placeholders %. * * @return mixed */ - public function unescapeValue(mixed $value); + public function unescapeValue(mixed $value): mixed; } diff --git a/src/Symfony/Component/DependencyInjection/Reference.php b/src/Symfony/Component/DependencyInjection/Reference.php index d8010850c19d7..522ca925a1a3d 100644 --- a/src/Symfony/Component/DependencyInjection/Reference.php +++ b/src/Symfony/Component/DependencyInjection/Reference.php @@ -37,7 +37,7 @@ public function __toString(): string * * @return int */ - public function getInvalidBehavior() + public function getInvalidBehavior(): int { return $this->invalidBehavior; } diff --git a/src/Symfony/Component/DependencyInjection/ServiceLocator.php b/src/Symfony/Component/DependencyInjection/ServiceLocator.php index 6c4fe136f7605..643b76cf5ae6d 100644 --- a/src/Symfony/Component/DependencyInjection/ServiceLocator.php +++ b/src/Symfony/Component/DependencyInjection/ServiceLocator.php @@ -38,7 +38,7 @@ class ServiceLocator implements ServiceProviderInterface * * @return mixed */ - public function get(string $id) + public function get(string $id): mixed { if (!$this->externalId) { return $this->doGet($id); diff --git a/src/Symfony/Component/DependencyInjection/TaggedContainerInterface.php b/src/Symfony/Component/DependencyInjection/TaggedContainerInterface.php index 2e32cd5977a38..dadaed1f43e70 100644 --- a/src/Symfony/Component/DependencyInjection/TaggedContainerInterface.php +++ b/src/Symfony/Component/DependencyInjection/TaggedContainerInterface.php @@ -25,5 +25,5 @@ interface TaggedContainerInterface extends ContainerInterface * * @return array An array of tags */ - public function findTaggedServiceIds(string $name); + public function findTaggedServiceIds(string $name): array; } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php index dc482590b0d83..c0d747a7a1286 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php @@ -48,10 +48,7 @@ protected function getTestService() return $this->services['test'] = new \stdClass(['only dot' => '.', 'concatenation as value' => '.\'\'.', 'concatenation from the start value' => '\'\'.', '.' => 'dot as a key', '.\'\'.' => 'concatenation as a key', '\'\'.' => 'concatenation from the start key', 'optimize concatenation' => 'string1-string2', 'optimize concatenation with empty string' => 'string1string2', 'optimize concatenation from the start' => 'start', 'optimize concatenation at the end' => 'end', 'new line' => 'string with '."\n".'new line']); } - /** - * @return array|bool|float|int|string|null - */ - public function getParameter(string $name) + public function getParameter(string $name): array|string|int|float|bool|null { if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php index ba6a1102e041e..ffa52cb3cfa3a 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php @@ -48,10 +48,7 @@ protected function getTestService() return $this->services['test'] = new \stdClass(('file://'.\dirname(__DIR__, 1)), [('file://'.\dirname(__DIR__, 1)) => (\dirname(__DIR__, 2).'/')]); } - /** - * @return array|bool|float|int|string|null - */ - public function getParameter(string $name) + public function getParameter(string $name): array|string|int|float|bool|null { if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services19.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services19.php index f69eada9dc68e..0c6fb392d8f04 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services19.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services19.php @@ -63,10 +63,7 @@ protected function getServiceWithMethodCallAndFactoryService() return $instance; } - /** - * @return array|bool|float|int|string|null - */ - public function getParameter(string $name) + public function getParameter(string $name): array|string|int|float|bool|null { if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services26.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services26.php index 871f0400a0fb6..3e98b35078608 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services26.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services26.php @@ -59,10 +59,7 @@ protected function getTestService() return $this->services['test'] = new ${($_ = $this->getEnv('FOO')) && false ?: "_"}($this->getEnv('Bar'), 'foo'.$this->getEnv('string:FOO').'baz', $this->getEnv('int:Baz')); } - /** - * @return array|bool|float|int|string|null - */ - public function getParameter(string $name) + public function getParameter(string $name): array|string|int|float|bool|null { if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php index 3c1218d6ac3d2..1946a9e52ab6b 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php @@ -35,10 +35,7 @@ public function isCompiled(): bool return true; } - /** - * @return array|bool|float|int|string|null - */ - public function getParameter(string $name) + public function getParameter(string $name): array|string|int|float|bool|null { if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_as_files.txt b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_as_files.txt index bcfe8b71db859..55af52b557e39 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_as_files.txt +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_as_files.txt @@ -821,10 +821,7 @@ class ProjectServiceContainer extends Container return $instance; } - /** - * @return array|bool|float|int|string|null - */ - public function getParameter(string $name) + public function getParameter(string $name): array|string|int|float|bool|null { if (isset($this->buildParameters[$name])) { return $this->buildParameters[$name]; diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php index 113f70fef523d..3ec66320cc776 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php @@ -419,10 +419,7 @@ protected function getFactorySimpleService() return new \SimpleFactoryClass('foo'); } - /** - * @return array|bool|float|int|string|null - */ - public function getParameter(string $name) + public function getParameter(string $name): array|string|int|float|bool|null { if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_inlined_factories.txt b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_inlined_factories.txt index 268032c5d497d..52dc1c4f732da 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_inlined_factories.txt +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_inlined_factories.txt @@ -474,10 +474,7 @@ class ProjectServiceContainer extends Container return new \SimpleFactoryClass('foo'); } - /** - * @return array|bool|float|int|string|null - */ - public function getParameter(string $name) + public function getParameter(string $name): array|string|int|float|bool|null { if (isset($this->buildParameters[$name])) { return $this->buildParameters[$name]; diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_lazy_inlined_factories.txt b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_lazy_inlined_factories.txt index f4ef32b0d3aaa..668b310c102e1 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_lazy_inlined_factories.txt +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_lazy_inlined_factories.txt @@ -77,10 +77,7 @@ class ProjectServiceContainer extends Container return new \Bar\FooClass(new \Bar\FooLazyClass()); } - /** - * @return array|bool|float|int|string|null - */ - public function getParameter(string $name) + public function getParameter(string $name): array|string|int|float|bool|null { if (isset($this->buildParameters[$name])) { return $this->buildParameters[$name]; diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_array_params.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_array_params.php index c9231b1567ce4..8bab13be99d9a 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_array_params.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_array_params.php @@ -52,10 +52,7 @@ protected function getBarService() return $instance; } - /** - * @return array|bool|float|int|string|null - */ - public function getParameter(string $name) + public function getParameter(string $name): array|string|int|float|bool|null { if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_base64_env.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_base64_env.php index c673b608ebfbc..c5e3f258a11bb 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_base64_env.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_base64_env.php @@ -35,10 +35,7 @@ public function isCompiled(): bool return true; } - /** - * @return array|bool|float|int|string|null - */ - public function getParameter(string $name) + public function getParameter(string $name): array|string|int|float|bool|null { if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_csv_env.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_csv_env.php index 405fbdca98164..11d11c8d6fda3 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_csv_env.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_csv_env.php @@ -35,10 +35,7 @@ public function isCompiled(): bool return true; } - /** - * @return array|bool|float|int|string|null - */ - public function getParameter(string $name) + public function getParameter(string $name): array|string|int|float|bool|null { if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_default_env.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_default_env.php index c92fd754e910e..0448e7b213ee2 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_default_env.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_default_env.php @@ -35,10 +35,7 @@ public function isCompiled(): bool return true; } - /** - * @return array|bool|float|int|string|null - */ - public function getParameter(string $name) + public function getParameter(string $name): array|string|int|float|bool|null { if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_env_in_id.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_env_in_id.php index c434453966d7f..dd4b934999b4f 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_env_in_id.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_env_in_id.php @@ -67,10 +67,7 @@ protected function getFooService() return $this->services['foo'] = new \stdClass(($this->privates['bar_%env(BAR)%'] ?? ($this->privates['bar_%env(BAR)%'] = new \stdClass())), ['baz_'.$this->getEnv('string:BAR') => new \stdClass()]); } - /** - * @return array|bool|float|int|string|null - */ - public function getParameter(string $name) + public function getParameter(string $name): array|string|int|float|bool|null { if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_errored_definition.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_errored_definition.php index a9c6d8cf8f48d..4b21be584582e 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_errored_definition.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_errored_definition.php @@ -419,10 +419,7 @@ protected function getFactorySimpleService() return new \SimpleFactoryClass('foo'); } - /** - * @return array|bool|float|int|string|null - */ - public function getParameter(string $name) + public function getParameter(string $name): array|string|int|float|bool|null { if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_inline_requires.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_inline_requires.php index 65bf567b35d7c..8271065a50277 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_inline_requires.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_inline_requires.php @@ -87,10 +87,7 @@ protected function getC2Service() return $this->services['Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\includes\\HotPath\\C2'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C2(new \Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C3()); } - /** - * @return array|bool|float|int|string|null - */ - public function getParameter(string $name) + public function getParameter(string $name): array|string|int|float|bool|null { if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_json_env.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_json_env.php index 1e74f10e38b94..82057518ea06b 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_json_env.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_json_env.php @@ -35,10 +35,7 @@ public function isCompiled(): bool return true; } - /** - * @return array|bool|float|int|string|null - */ - public function getParameter(string $name) + public function getParameter(string $name): array|string|int|float|bool|null { if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_query_string_env.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_query_string_env.php index b1af92c5f35f9..83e8d7bc60956 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_query_string_env.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_query_string_env.php @@ -35,10 +35,7 @@ public function isCompiled(): bool return true; } - /** - * @return array|bool|float|int|string|null - */ - public function getParameter(string $name) + public function getParameter(string $name): array|string|int|float|bool|null { if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_rot13_env.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_rot13_env.php index 5d9a6f4cf8a7a..27c2a5795e624 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_rot13_env.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_rot13_env.php @@ -72,10 +72,7 @@ protected function getContainer_EnvVarProcessorsLocatorService() ]); } - /** - * @return array|bool|float|int|string|null - */ - public function getParameter(string $name) + public function getParameter(string $name): array|string|int|float|bool|null { if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_unsupported_characters.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_unsupported_characters.php index 88a0b92825dfe..68d442f63630d 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_unsupported_characters.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_unsupported_characters.php @@ -70,10 +70,7 @@ protected function getFooohnoService() return $this->services['foo*/oh-no'] = new \FooClass(); } - /** - * @return array|bool|float|int|string|null - */ - public function getParameter(string $name) + public function getParameter(string $name): array|string|int|float|bool|null { if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_url_env.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_url_env.php index 160d4ef5f6a29..ff5fd5ccfb69f 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_url_env.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_url_env.php @@ -35,10 +35,7 @@ public function isCompiled(): bool return true; } - /** - * @return array|bool|float|int|string|null - */ - public function getParameter(string $name) + public function getParameter(string $name): array|string|int|float|bool|null { if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name));