Skip to content

Commit

Permalink
minor #50121 Add remaining missing return types to safe methods (wout…
Browse files Browse the repository at this point in the history
…erj)

This PR was merged into the 6.3 branch.

Discussion
----------

Add remaining missing return types to safe methods

| Q             | A
| ------------- | ---
| Branch?       | 6.3
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | Ref #47551
| License       | MIT
| Doc PR        | -

This adds return types to remaining methods that are safe to receive a return type (final, internal or private ones), except from methods of `DataCollector` classes (which are missing quite a lot of types). I couldn't figure out whether they all return `Data`, the actual value or a union of both, so I've left them out for now.

Asides from these, we're missing 121 more return types on "non-safe" methods. If I have time, I'll create some smaller PRs for them to allow easier reviews.

<details>
<summary>Full list</summary>

```120 missing return types on interfaces

Symfony\Bridge\Doctrine\DependencyInjection\CompilerPass\RegisterEventListenersAndSubscribersPass::process
Symfony\Bridge\Doctrine\Form\DoctrineOrmTypeGuesser::getMetadata
Symfony\Bridge\Monolog\Handler\ConsoleHandler::setOutput
Symfony\Bridge\Monolog\Handler\ConsoleHandler::onCommand
Symfony\Bridge\Monolog\Handler\ConsoleHandler::onTerminate
Symfony\Bridge\Monolog\Handler\ServerLogHandler::createSocket
Symfony\Bundle\FrameworkBundle\Command\AbstractConfigCommand::listBundles
Symfony\Bundle\FrameworkBundle\Command\AbstractConfigCommand::validateConfiguration
Symfony\Bundle\FrameworkBundle\DependencyInjection\Configuration::addHttpClientRetrySection
Symfony\Bundle\FrameworkBundle\DependencyInjection\Configuration::addRemoteEventSection
Symfony\Bundle\FrameworkBundle\DependencyInjection\FrameworkExtension::registerWebhookConfiguration
Symfony\Bundle\FrameworkBundle\DependencyInjection\FrameworkExtension::registerRemoteEventConfiguration
Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension::createContextListener
Symfony\Component\BrowserKit\AbstractBrowser::getScript
Symfony\Component\Cache\Adapter\ArrayAdapter::freeze
Symfony\Component\Cache\Adapter\ArrayAdapter::unfreeze
Symfony\Component\Cache\Adapter\MemcachedAdapter::checkResultCode
Symfony\Component\Cache\DependencyInjection\CachePoolPass::process
Symfony\Component\Config\Definition\BaseNode::validateType
Symfony\Component\Config\Definition\PrototypedArrayNode::addChild
Symfony\Component\Config\FileLocator::locate
Symfony\Component\Config\Loader\FileLoader::setCurrentDir
Symfony\Component\Config\Loader\FileLoader::import
Symfony\Component\Config\Loader\FileLoader::doImport
Symfony\Component\Config\ResourceCheckerConfigCache::safelyUnserialize
Symfony\Component\Console\Command\LockableTrait::release
Symfony\Component\Console\Formatter\OutputFormatter::formatAndWrap
Symfony\Component\Console\Helper\Helper::formatTime
Symfony\Component\Console\Helper\Table::setStyleDefinition
Symfony\Component\Console\Helper\Table::render
Symfony\Component\Console\Helper\Table::renderRowSeparator
Symfony\Component\Console\Helper\Table::renderRow
Symfony\Component\Console\Helper\Table::calculateNumberOfColumns
Symfony\Component\Console\Helper\Table::calculateColumnsWidth
Symfony\Component\Console\Helper\Table::cleanup
Symfony\Component\Console\Input\Input::parse
Symfony\Component\Console\Input\Input::getStream
Symfony\Component\Console\Output\Output::doWrite
Symfony\Component\DependencyInjection\Argument\ReferenceSetArgumentTrait::setValues
Symfony\Component\DependencyInjection\Container::make
Symfony\Component\DependencyInjection\Container::load
Symfony\Component\DependencyInjection\Extension\Extension::getXsdValidationBasePath
Symfony\Component\DependencyInjection\Extension\Extension::getNamespace
Symfony\Component\DependencyInjection\Extension\Extension::getConfiguration
Symfony\Component\DependencyInjection\Loader\YamlFileLoader::parseDefinition
Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag::clear
Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag::add
Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag::set
Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag::deprecate
Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag::remove
Symfony\Component\DependencyInjection\ParameterBag\ParameterBag::isResolved
Symfony\Component\DomCrawler\AbstractUriElement::setNode
Symfony\Component\DomCrawler\Field\FormField::initialize
Symfony\Component\ExpressionLanguage\Compiler::getFunction
Symfony\Component\ExpressionLanguage\Node\Node::toArray
Symfony\Component\ExpressionLanguage\Parser::parseExpression
Symfony\Component\ExpressionLanguage\Parser::getPrimary
Symfony\Component\ExpressionLanguage\SerializedParsedExpression::getNodes
Symfony\Component\Filesystem\Filesystem::linkException
Symfony\Component\Form\AbstractType::getBlockPrefix
Symfony\Component\Form\AbstractType::getParent
Symfony\Component\Form\ButtonBuilder::setFormFactory
Symfony\Component\Form\Extension\Core\DataAccessor\PropertyPathAccessor::getPropertyValue
Symfony\Component\Form\Extension\Core\Type\ChoiceType::buildForm
Symfony\Component\Form\Extension\Core\Type\ChoiceType::buildView
Symfony\Component\Form\Extension\Core\Type\ChoiceType::finishView
Symfony\Component\Form\Extension\Core\Type\ChoiceType::configureOptions
Symfony\Component\Form\Extension\Core\Type\ChoiceType::addSubForms
Symfony\Component\Form\Extension\Core\Type\ChoiceType::addSubForm
Symfony\Component\Form\Extension\Core\Type\DateType::buildForm
Symfony\Component\Form\Extension\Core\Type\DateType::finishView
Symfony\Component\Form\Extension\Core\Type\DateType::configureOptions
Symfony\Component\Form\Extension\Core\Type\FileType::buildForm
Symfony\Component\Form\Extension\Core\Type\FileType::buildView
Symfony\Component\Form\Extension\Core\Type\FileType::finishView
Symfony\Component\Form\Extension\Core\Type\FileType::configureOptions
Symfony\Component\Form\Extension\Core\Type\MoneyType::getPattern
Symfony\Component\Form\Extension\Validator\ViolationMapper\ViolationPathIterator::mapsForm
Symfony\Component\HttpClient\Response\StreamWrapper::stream_cast
Symfony\Component\HttpFoundation\Request::prepareRequestUri
Symfony\Component\HttpKernel\DependencyInjection\ConfigurableExtension::loadInternal
Symfony\Component\Ldap\Security\LdapUserProvider::getAttributeValue
Symfony\Component\Mailer\Bridge\Mailjet\Transport\MailjetApiTransport::castCustomHeader
Symfony\Component\Mime\Email::ensureValidity
Symfony\Component\Process\Exception\ProcessFailedException::getProcess
Symfony\Component\Process\Exception\ProcessTimedOutException::getProcess
Symfony\Component\Process\Exception\ProcessTimedOutException::getExceededTimeout
Symfony\Component\Process\Process::start
Symfony\Component\Process\Process::checkTimeout
Symfony\Component\Process\Process::setOptions
Symfony\Component\Process\Process::updateStatus
Symfony\Component\Process\Process::readPipesForOutput
Symfony\Component\Process\Process::readPipes
Symfony\Component\Process\Process::resetProcessData
Symfony\Component\Process\Process::requireProcessIsStarted
Symfony\Component\Process\Process::requireProcessIsTerminated
Symfony\Component\Routing\Loader\AnnotationClassLoader::configureRoute
Symfony\Component\Routing\Matcher\UrlMatcher::getExpressionLanguage
Symfony\Component\Routing\Router::getRouteCollection
Symfony\Component\Security\Core\User\InMemoryUserProvider::createUser
Symfony\Component\Security\Http\Firewall::getSubscribedEvents
Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer::supportsNormalization
Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer::normalize
Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer::instantiateObject
Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer::supportsDenormalization
Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer::denormalize
Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer::setAttributeValue
Symfony\Component\Translation\Catalogue\AbstractOperation::processDomain
Symfony\Component\Translation\Command\XliffLintCommand::display
Symfony\Component\Translation\Command\XliffLintCommand::displayJson
Symfony\Component\Translation\Command\XliffLintCommand::getDirectoryIterator
Symfony\Component\Translation\Command\XliffLintCommand::isReadable
Symfony\Component\Translation\Extractor\PhpExtractor::seekToNextRelevantToken
Symfony\Component\Translation\Extractor\PhpExtractor::skipMethodArgument
Symfony\Component\Translation\Extractor\PhpExtractor::parseTokens
Symfony\Component\Translation\Util\ArrayConverter::getElementByPath
Symfony\Component\Validator\Constraints\IsbnValidator::getMessage
Symfony\Component\Validator\Exception\ValidationFailedException::getValue
Symfony\Component\VarDumper\Test\VarDumperTestTrait::assertDumpEquals
Symfony\Component\VarDumper\Test\VarDumperTestTrait::assertDumpMatchesFormat
```

</details>

Commits
-------

4f80606 Add remaining missing return types to safe methods
  • Loading branch information
nicolas-grekas committed Apr 24, 2023
2 parents 4ee55b0 + 4f80606 commit 73dc02d
Show file tree
Hide file tree
Showing 52 changed files with 125 additions and 155 deletions.
61 changes: 5 additions & 56 deletions .github/expected-missing-return-types.diff
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ index 8bfaa0a22c..745ba6aff3 100644
{
$this->debug = $debug;
diff --git a/src/Symfony/Bridge/Twig/Command/DebugCommand.php b/src/Symfony/Bridge/Twig/Command/DebugCommand.php
index fe581b5987..8109e7c68d 100644
index 43e4d9c9f1..ea0116870b 100644
--- a/src/Symfony/Bridge/Twig/Command/DebugCommand.php
+++ b/src/Symfony/Bridge/Twig/Command/DebugCommand.php
@@ -63,5 +63,5 @@ class DebugCommand extends Command
Expand All @@ -397,7 +397,7 @@ index fe581b5987..8109e7c68d 100644
{
$this
diff --git a/src/Symfony/Bridge/Twig/Command/LintCommand.php b/src/Symfony/Bridge/Twig/Command/LintCommand.php
index fa8effc12a..deced50a90 100644
index e059740a13..e7d6fbdd05 100644
--- a/src/Symfony/Bridge/Twig/Command/LintCommand.php
+++ b/src/Symfony/Bridge/Twig/Command/LintCommand.php
@@ -52,5 +52,5 @@ class LintCommand extends Command
Expand Down Expand Up @@ -1500,7 +1500,7 @@ index 00e912686b..58872ec2bc 100644
{
if (!$container->hasDefinition('console.command.cache_pool_prune')) {
diff --git a/src/Symfony/Component/Cache/Traits/FilesystemCommonTrait.php b/src/Symfony/Component/Cache/Traits/FilesystemCommonTrait.php
index 2ee96e9b37..f49ed24f68 100644
index 200406a564..0bad73fe6a 100644
--- a/src/Symfony/Component/Cache/Traits/FilesystemCommonTrait.php
+++ b/src/Symfony/Component/Cache/Traits/FilesystemCommonTrait.php
@@ -81,5 +81,5 @@ trait FilesystemCommonTrait
Expand Down Expand Up @@ -5038,28 +5038,10 @@ index 9e107401a2..7f92321a2b 100644
+ protected function registerFunctions(): void
{
$this->addFunction(ExpressionFunction::fromPhp('constant'));
diff --git a/src/Symfony/Component/ExpressionLanguage/Node/ConditionalNode.php b/src/Symfony/Component/ExpressionLanguage/Node/ConditionalNode.php
index fec02abaae..7d02544275 100644
--- a/src/Symfony/Component/ExpressionLanguage/Node/ConditionalNode.php
+++ b/src/Symfony/Component/ExpressionLanguage/Node/ConditionalNode.php
@@ -41,5 +41,5 @@ class ConditionalNode extends Node
}

- public function evaluate(array $functions, array $values)
+ public function evaluate(array $functions, array $values): mixed
{
if ($this->nodes['expr1']->evaluate($functions, $values)) {
diff --git a/src/Symfony/Component/ExpressionLanguage/Node/FunctionNode.php b/src/Symfony/Component/ExpressionLanguage/Node/FunctionNode.php
index d4ab3e0922..811fec7e2e 100644
index 33323f388f..811fec7e2e 100644
--- a/src/Symfony/Component/ExpressionLanguage/Node/FunctionNode.php
+++ b/src/Symfony/Component/ExpressionLanguage/Node/FunctionNode.php
@@ -41,5 +41,5 @@ class FunctionNode extends Node
}

- public function evaluate(array $functions, array $values)
+ public function evaluate(array $functions, array $values): mixed
{
$arguments = [$values];
@@ -54,5 +54,5 @@ class FunctionNode extends Node
* @return array
*/
Expand Down Expand Up @@ -5106,17 +5088,6 @@ index f6fff09b1e..4661f7d165 100644
+ protected function isHash(array $value): bool
{
$expectedKey = 0;
diff --git a/src/Symfony/Component/ExpressionLanguage/Node/UnaryNode.php b/src/Symfony/Component/ExpressionLanguage/Node/UnaryNode.php
index 580ee13095..55e2121fcf 100644
--- a/src/Symfony/Component/ExpressionLanguage/Node/UnaryNode.php
+++ b/src/Symfony/Component/ExpressionLanguage/Node/UnaryNode.php
@@ -46,5 +46,5 @@ class UnaryNode extends Node
}

- public function evaluate(array $functions, array $values)
+ public function evaluate(array $functions, array $values): mixed
{
$value = $this->nodes['node']->evaluate($functions, $values);
diff --git a/src/Symfony/Component/ExpressionLanguage/ParsedExpression.php b/src/Symfony/Component/ExpressionLanguage/ParsedExpression.php
index 239624ec2c..3b497d5ccf 100644
--- a/src/Symfony/Component/ExpressionLanguage/ParsedExpression.php
Expand Down Expand Up @@ -10730,7 +10701,7 @@ index cf41e0c507..61f7397734 100644
+ public function createNewToken(PersistentTokenInterface $token): void;
}
diff --git a/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php b/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php
index 4416cda616..0fcf4303e0 100644
index 10cb8f776e..0da1b3330e 100644
--- a/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php
+++ b/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php
@@ -57,5 +57,5 @@ abstract class AbstractToken implements TokenInterface, \Serializable
Expand Down Expand Up @@ -11173,17 +11144,6 @@ index 91271d14a3..100c2fb549 100644
- public function start(Request $request, AuthenticationException $authException = null);
+ public function start(Request $request, AuthenticationException $authException = null): Response;
}
diff --git a/src/Symfony/Component/Security/Http/Event/LazyResponseEvent.php b/src/Symfony/Component/Security/Http/Event/LazyResponseEvent.php
index 46a25eed07..b3e25f1af3 100644
--- a/src/Symfony/Component/Security/Http/Event/LazyResponseEvent.php
+++ b/src/Symfony/Component/Security/Http/Event/LazyResponseEvent.php
@@ -32,5 +32,5 @@ final class LazyResponseEvent extends RequestEvent
}

- public function setResponse(Response $response)
+ public function setResponse(Response $response): void
{
$this->stopPropagation();
diff --git a/src/Symfony/Component/Security/Http/Event/LoginFailureEvent.php b/src/Symfony/Component/Security/Http/Event/LoginFailureEvent.php
index 3b7c5086f2..97fb99f0b5 100644
--- a/src/Symfony/Component/Security/Http/Event/LoginFailureEvent.php
Expand Down Expand Up @@ -11238,17 +11198,6 @@ index fc56733efa..8538f5f821 100644
+ protected function callListeners(RequestEvent $event, iterable $listeners): void
{
foreach ($listeners as $listener) {
diff --git a/src/Symfony/Component/Security/Http/Firewall/AccessListener.php b/src/Symfony/Component/Security/Http/Firewall/AccessListener.php
index ad343ef085..9a1a2563c4 100644
--- a/src/Symfony/Component/Security/Http/Firewall/AccessListener.php
+++ b/src/Symfony/Component/Security/Http/Firewall/AccessListener.php
@@ -65,5 +65,5 @@ class AccessListener extends AbstractListener
* @throws AccessDeniedException
*/
- public function authenticate(RequestEvent $event)
+ public function authenticate(RequestEvent $event): void
{
$request = $event->getRequest();
diff --git a/src/Symfony/Component/Security/Http/Firewall/FirewallListenerInterface.php b/src/Symfony/Component/Security/Http/Firewall/FirewallListenerInterface.php
index be200c0d12..69483f8f1d 100644
--- a/src/Symfony/Component/Security/Http/Firewall/FirewallListenerInterface.php
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/Monolog/Handler/NotifierHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private function notify(array $records): void
$this->notifier->send($notification, ...$this->notifier->getAdminRecipients());
}

private function getHighestRecord(array $records)
private function getHighestRecord(array $records): array
{
$highestRecord = null;
foreach ($records as $record) {
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/Monolog/Handler/ServerLogHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ protected function getDefaultFormatter(): FormatterInterface
return new VarDumperFormatter();
}

private static function nullErrorHandler()
private static function nullErrorHandler(): void
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/Twig/Command/DebugCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ private function getLoaderPaths(string $name = null): array
return $loaderPaths;
}

private function getMetadata(string $type, mixed $entity)
private function getMetadata(string $type, mixed $entity): mixed
{
if ('globals' === $type) {
return $entity;
Expand Down
8 changes: 4 additions & 4 deletions src/Symfony/Bridge/Twig/Command/LintCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ private function getFilesInfo(array $filenames): array
return $filesInfo;
}

protected function findFiles(string $filename)
protected function findFiles(string $filename): iterable
{
if (is_file($filename)) {
return [$filename];
Expand Down Expand Up @@ -172,7 +172,7 @@ private function validate(string $template, string $file): array
return ['template' => $template, 'file' => $file, 'valid' => true];
}

private function display(InputInterface $input, OutputInterface $output, SymfonyStyle $io, array $files)
private function display(InputInterface $input, OutputInterface $output, SymfonyStyle $io, array $files): int
{
return match ($this->format) {
'txt' => $this->displayTxt($output, $io, $files),
Expand Down Expand Up @@ -205,7 +205,7 @@ private function displayTxt(OutputInterface $output, SymfonyStyle $io, array $fi
return min($errors, 1);
}

private function displayJson(OutputInterface $output, array $filesInfo)
private function displayJson(OutputInterface $output, array $filesInfo): int
{
$errors = 0;

Expand All @@ -224,7 +224,7 @@ private function displayJson(OutputInterface $output, array $filesInfo)
return min($errors, 1);
}

private function renderException(SymfonyStyle $output, string $template, Error $exception, string $file = null, GithubActionReporter $githubReporter = null)
private function renderException(SymfonyStyle $output, string $template, Error $exception, string $file = null, GithubActionReporter $githubReporter = null): void
{
$line = $exception->getTemplateLine();

Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/Twig/Extension/WorkflowExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function getMarkedPlaces(object $subject, bool $placesNameOnly = true, st
* Use a string (the place name) to get place metadata
* Use a Transition instance to get transition metadata
*/
public function getMetadata(object $subject, string $key, string|Transition $metadataSubject = null, string $name = null)
public function getMetadata(object $subject, string $key, string|Transition $metadataSubject = null, string $name = null): mixed
{
return $this
->workflowRegistry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ private function getAvailableBundles(bool $alias): array
return $availableBundles;
}

private function getConfig(ExtensionInterface $extension, ContainerBuilder $container, bool $resolveEnvs = false)
private function getConfig(ExtensionInterface $extension, ContainerBuilder $container, bool $resolveEnvs = false): mixed
{
return $container->resolveEnvPlaceholders(
$container->getParameterBag()->resolveValue(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ abstract protected function describeContainerEnvVars(array $envs, array $options
* Common options are:
* * name: name of listened event
*/
abstract protected function describeEventDispatcherListeners(EventDispatcherInterface $eventDispatcher, array $options = []);
abstract protected function describeEventDispatcherListeners(EventDispatcherInterface $eventDispatcher, array $options = []): void;

abstract protected function describeCallable(mixed $callable, array $options = []);
abstract protected function describeCallable(mixed $callable, array $options = []): void;

protected function formatValue(mixed $value): string
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ protected function describeEventDispatcherListeners(EventDispatcherInterface $ev
}
}

protected function describeCallable(mixed $callable, array $options = [])
protected function describeCallable(mixed $callable, array $options = []): void
{
$string = '';

Expand All @@ -359,7 +359,9 @@ protected function describeCallable(mixed $callable, array $options = [])
}
}

return $this->write($string."\n");
$this->write($string."\n");

return;
}

if (\is_string($callable)) {
Expand All @@ -375,15 +377,19 @@ protected function describeCallable(mixed $callable, array $options = [])
$string .= "\n- Static: yes";
}

return $this->write($string."\n");
$this->write($string."\n");

return;
}

if ($callable instanceof \Closure) {
$string .= "\n- Type: `closure`";

$r = new \ReflectionFunction($callable);
if (str_contains($r->name, '{closure}')) {
return $this->write($string."\n");
$this->write($string."\n");

return;
}
$string .= "\n".sprintf('- Name: `%s`', $r->name);

Expand All @@ -394,14 +400,18 @@ protected function describeCallable(mixed $callable, array $options = [])
}
}

return $this->write($string."\n");
$this->write($string."\n");

return;
}

if (method_exists($callable, '__invoke')) {
$string .= "\n- Type: `object`";
$string .= "\n".sprintf('- Name: `%s`', $callable::class);

return $this->write($string."\n");
$this->write($string."\n");

return;
}

throw new \InvalidArgumentException('Callable is not describable.');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ trait TraceableListenerTrait
/**
* Proxies all method calls to the original listener.
*/
public function __call(string $method, array $arguments)
public function __call(string $method, array $arguments): mixed
{
return $this->listener->{$method}(...$arguments);
}

public function getWrappedListener()
public function getWrappedListener(): mixed
{
return $this->listener;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ private function hasHashOrNonce(array $directives): bool
return false;
}

private function getDirectiveFallback(array $directiveSet, string $type)
private function getDirectiveFallback(array $directiveSet, string $type): ?array
{
if (\in_array($type, ['script-src-elem', 'style-src-elem'], true) || !isset($directiveSet['default-src'])) {
// Let the browser fallback on it's own
Expand Down
5 changes: 4 additions & 1 deletion src/Symfony/Component/Cache/LockRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public static function setFiles(array $files): array
return $previousFiles;
}

public static function compute(callable $callback, ItemInterface $item, bool &$save, CacheInterface $pool, \Closure $setMetadata = null, LoggerInterface $logger = null)
public static function compute(callable $callback, ItemInterface $item, bool &$save, CacheInterface $pool, \Closure $setMetadata = null, LoggerInterface $logger = null): mixed
{
if ('\\' === \DIRECTORY_SEPARATOR && null === self::$lockedFiles) {
// disable locking on Windows by default
Expand Down Expand Up @@ -146,6 +146,9 @@ public static function compute(callable $callback, ItemInterface $item, bool &$s
return null;
}

/**
* @return resource|false
*/
private static function open(int $key)
{
if (null !== $h = self::$openedFiles[$key] ?? null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function unmarshall(string $value): mixed
/**
* @internal
*/
public static function handleUnserializeCallback(string $class)
public static function handleUnserializeCallback(string $class): never
{
throw new \DomainException('Class not found: '.$class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ protected function getId(mixed $key): string
/**
* @internal
*/
public static function handleUnserializeCallback(string $class)
public static function handleUnserializeCallback(string $class): never
{
throw new \DomainException('Class not found: '.$class);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Cache/Traits/ContractsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function setCallbackWrapper(?callable $callbackWrapper): callable
return $previousWrapper;
}

private function doGet(AdapterInterface $pool, string $key, callable $callback, ?float $beta, array &$metadata = null)
private function doGet(AdapterInterface $pool, string $key, callable $callback, ?float $beta, array &$metadata = null): mixed
{
if (0 > $beta ??= 1.0) {
throw new InvalidArgumentException(sprintf('Argument "$beta" provided to "%s::get()" must be a positive number, %f given.', static::class, $beta));
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Cache/Traits/FilesystemCommonTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ trait FilesystemCommonTrait
private string $directory;
private string $tmpSuffix;

private function init(string $namespace, ?string $directory)
private function init(string $namespace, ?string $directory): void
{
if (!isset($directory[0])) {
$directory = sys_get_temp_dir().\DIRECTORY_SEPARATOR.'symfony-cache';
Expand Down Expand Up @@ -161,7 +161,7 @@ private function scanHashDir(string $directory): \Generator
/**
* @internal
*/
public static function throwError(int $type, string $message, string $file, int $line)
public static function throwError(int $type, string $message, string $file, int $line): never
{
throw new \ErrorException($message, 0, $type, $file, $line);
}
Expand Down
10 changes: 5 additions & 5 deletions src/Symfony/Component/Console/Descriptor/Descriptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,25 +50,25 @@ protected function write(string $content, bool $decorated = false): void
/**
* Describes an InputArgument instance.
*/
abstract protected function describeInputArgument(InputArgument $argument, array $options = []);
abstract protected function describeInputArgument(InputArgument $argument, array $options = []): void;

/**
* Describes an InputOption instance.
*/
abstract protected function describeInputOption(InputOption $option, array $options = []);
abstract protected function describeInputOption(InputOption $option, array $options = []): void;

/**
* Describes an InputDefinition instance.
*/
abstract protected function describeInputDefinition(InputDefinition $definition, array $options = []);
abstract protected function describeInputDefinition(InputDefinition $definition, array $options = []): void;

/**
* Describes a Command instance.
*/
abstract protected function describeCommand(Command $command, array $options = []);
abstract protected function describeCommand(Command $command, array $options = []): void;

/**
* Describes an Application instance.
*/
abstract protected function describeApplication(Application $application, array $options = []);
abstract protected function describeApplication(Application $application, array $options = []): void;
}
Loading

0 comments on commit 73dc02d

Please sign in to comment.