Skip to content

Add void (PHPdoc) return types #49347

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10,373 changes: 10,176 additions & 197 deletions .github/expected-missing-return-types.diff

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public function removeEventSubscriber(EventSubscriber $subscriber): void
parent::removeEventSubscriber($subscriber);
}

private function initializeListeners(string $eventName)
private function initializeListeners(string $eventName): void
{
$this->initialized[$eventName] = true;
foreach ($this->listeners[$eventName] as $hash => $listener) {
Expand All @@ -179,7 +179,7 @@ private function initializeListeners(string $eventName)
}
}

private function initializeSubscribers()
private function initializeSubscribers(): void
{
$this->initializedSubscribers = true;
foreach ($this->subscribers as $subscriber) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,17 @@ public function __construct(

/**
* Adds the stack logger for a connection.
*
* @return void
*/
public function addLogger(string $name, DebugStack $logger)
{
$this->loggers[$name] = $logger;
}

/**
* @return void
*/
public function collect(Request $request, Response $response, \Throwable $exception = null)
{
$this->data = [
Expand Down Expand Up @@ -81,6 +86,9 @@ private function collectQueries(): array
return $queries;
}

/**
* @return void
*/
public function reset()
{
$this->data = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ public function __construct(ContainerInterface $container)
$this->container = $container;
}

/**
* @return void
*/
public function addFixture(FixtureInterface $fixture)
{
if ($fixture instanceof ContainerAwareInterface) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ abstract class AbstractDoctrineExtension extends Extension
/**
* @param array $objectManager A configured object manager
*
* @return void
*
* @throws \InvalidArgumentException
*/
protected function loadMappingInformation(array $objectManager, ContainerBuilder $container)
Expand Down Expand Up @@ -105,6 +107,8 @@ protected function loadMappingInformation(array $objectManager, ContainerBuilder
* Register the alias for this mapping driver.
*
* Aliases can be used in the Query languages of all the Doctrine object managers to simplify writing tasks.
*
* @return void
*/
protected function setMappingDriverAlias(array $mappingConfig, string $mappingName)
{
Expand All @@ -118,6 +122,8 @@ protected function setMappingDriverAlias(array $mappingConfig, string $mappingNa
/**
* Register the mapping driver configuration for later use with the object managers metadata driver chain.
*
* @return void
*
* @throws \InvalidArgumentException
*/
protected function setMappingDriverConfig(array $mappingConfig, string $mappingName)
Expand Down Expand Up @@ -172,6 +178,8 @@ protected function getMappingDriverBundleConfigDefaults(array $bundleConfig, \Re

/**
* Register all the collected mapping information with the object manager by registering the appropriate mapping drivers.
*
* @return void
*/
protected function registerMappingDrivers(array $objectManager, ContainerBuilder $container)
{
Expand Down Expand Up @@ -227,6 +235,8 @@ protected function registerMappingDrivers(array $objectManager, ContainerBuilder
/**
* Assertion if the specified mapping information is valid.
*
* @return void
*
* @throws \InvalidArgumentException
*/
protected function assertValidMappingConfiguration(array $mappingConfig, string $objectManagerName)
Expand Down Expand Up @@ -315,6 +325,8 @@ private function detectMappingType(string $directory, ContainerBuilder $containe
/**
* Loads a configured object manager metadata, query or result cache driver.
*
* @return void
*
* @throws \InvalidArgumentException in case of unknown driver type
*/
protected function loadObjectManagerCacheDriver(array $objectManager, ContainerBuilder $container, string $cacheName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ public function __construct(string $managerType)
$this->managerType = $managerType;
}

/**
* @return void
*/
public function process(ContainerBuilder $container)
{
$this->updateValidatorMappingFiles($container, 'xml', 'xml');
Expand All @@ -38,7 +41,7 @@ public function process(ContainerBuilder $container)
* Gets the validation mapping files for the format and extends them with
* files matching a doctrine search pattern (Resources/config/validation.orm.xml).
*/
private function updateValidatorMappingFiles(ContainerBuilder $container, string $mapping, string $extension)
private function updateValidatorMappingFiles(ContainerBuilder $container, string $mapping, string $extension): void
{
if (!$container->hasParameter('validator.mapping.loader.'.$mapping.'_files_loader.mapping_files')) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ public function __construct(Definition|Reference $driver, array $namespaces, arr

/**
* Register mappings and alias with the metadata drivers.
*
* @return void
*/
public function process(ContainerBuilder $container)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

final class RegisterUidTypePass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
public function process(ContainerBuilder $container): void
{
if (!class_exists(AbstractUid::class)) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ public function __construct(string $key, string $providerId)
$this->providerId = $providerId;
}

/**
* @return void
*/
public function create(ContainerBuilder $container, string $id, array $config)
{
$container
Expand All @@ -51,6 +54,9 @@ public function getKey()
return $this->key;
}

/**
* @return void
*/
public function addConfiguration(NodeDefinition $node)
{
$node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ public static function getSubscribedEvents(): array
];
}

/**
* @return void
*/
public function onSubmit(FormEvent $event)
{
$collection = $event->getForm()->getData();
Expand Down
9 changes: 9 additions & 0 deletions src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ public function __construct(ManagerRegistry $registry)
$this->registry = $registry;
}

/**
* @return void
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
if ($options['multiple'] && interface_exists(Collection::class)) {
Expand All @@ -107,6 +110,9 @@ public function buildForm(FormBuilderInterface $builder, array $options)
}
}

/**
* @return void
*/
public function configureOptions(OptionsResolver $resolver)
{
$choiceLoader = function (Options $options) {
Expand Down Expand Up @@ -232,6 +238,9 @@ public function getParent(): string
return ChoiceType::class;
}

/**
* @return void
*/
public function reset()
{
$this->idReaders = [];
Expand Down
3 changes: 3 additions & 0 deletions src/Symfony/Bridge/Doctrine/Form/Type/EntityType.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@

class EntityType extends DoctrineType
{
/**
* @return void
*/
public function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);
Expand Down
2 changes: 2 additions & 0 deletions src/Symfony/Bridge/Doctrine/Logger/DbalLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ public function stopQuery(): void

/**
* Logs a message.
*
* @return void
*/
protected function log(string $message, array $params)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,17 @@ public function __construct(ManagerRegistry $managerRegistry)
$this->managerRegistry = $managerRegistry;
}

/**
* @return void
*/
public function onWorkerMessageHandled()
{
$this->clearEntityManagers();
}

/**
* @return void
*/
public function onWorkerMessageFailed()
{
$this->clearEntityManagers();
Expand All @@ -48,7 +54,7 @@ public static function getSubscribedEvents(): array
];
}

private function clearEntityManagers()
private function clearEntityManagers(): void
{
foreach ($this->managerRegistry->getManagers() as $manager) {
$manager->clear();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected function handleForManager(EntityManagerInterface $entityManager, Envel
return $stack->next()->handle($envelope, $stack);
}

private function pingConnection(EntityManagerInterface $entityManager)
private function pingConnection(EntityManagerInterface $entityManager): void
{
$connection = $entityManager->getConnection();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ public function loadTokenBySeries(string $series): PersistentTokenInterface
throw new TokenNotFoundException('No token found.');
}

/**
* @return void
*/
public function deleteTokenBySeries(string $series)
{
$sql = 'DELETE FROM rememberme_token WHERE series=:series';
Expand All @@ -78,6 +81,9 @@ public function deleteTokenBySeries(string $series)
}
}

/**
* @return void
*/
public function updateToken(string $series, #[\SensitiveParameter] string $tokenValue, \DateTime $lastUsed)
{
$sql = 'UPDATE rememberme_token SET value=:value, lastUsed=:lastUsed WHERE series=:series';
Expand All @@ -101,6 +107,9 @@ public function updateToken(string $series, #[\SensitiveParameter] string $token
}
}

/**
* @return void
*/
public function createNewToken(PersistentTokenInterface $token)
{
$sql = 'INSERT INTO rememberme_token (class, username, series, value, lastUsed) VALUES (:class, :username, :series, :value, :lastUsed)';
Expand Down
3 changes: 3 additions & 0 deletions src/Symfony/Bridge/Doctrine/Validator/DoctrineInitializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ public function __construct(ManagerRegistry $registry)
$this->registry = $registry;
}

/**
* @return void
*/
public function initialize(object $object)
{
$this->registry->getManagerForClass($object::class)?->initializeObject($object);
Expand Down
5 changes: 4 additions & 1 deletion src/Symfony/Bridge/Monolog/Command/ServerLogCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ public function isEnabled(): bool
return parent::isEnabled();
}

/**
* @return void
*/
protected function configure()
{
if (!class_exists(ConsoleFormatter::class)) {
Expand Down Expand Up @@ -145,7 +148,7 @@ private function getLogs($socket): iterable
}
}

private function displayLog(OutputInterface $output, int $clientId, array $record)
private function displayLog(OutputInterface $output, int $clientId, array $record): void
{
if (isset($record['log_id'])) {
$clientId = unpack('H*', $record['log_id'])[1];
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/Monolog/Formatter/ConsoleFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ private function doFormat(array|LogRecord $record): mixed
/**
* @internal
*/
public function echoLine(string $line, int $depth, string $indentPad)
public function echoLine(string $line, int $depth, string $indentPad): void
{
if (-1 !== $depth) {
fwrite($this->outputBuffer, $line);
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/Monolog/Handler/ChromePhpHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ChromePhpHandler extends BaseChromePhpHandler
/**
* Adds the headers to the response once it's created.
*/
public function onKernelResponse(ResponseEvent $event)
public function onKernelResponse(ResponseEvent $event): void
{
if (!$event->isMainRequest()) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ protected function getDefaultFormatter(): FormatterInterface
return new LogstashFormatter('application');
}

private function sendToElasticsearch(array $records)
private function sendToElasticsearch(array $records): void
{
$formatter = $this->getFormatter();

Expand Down Expand Up @@ -164,7 +164,7 @@ public function __destruct()
$this->wait(true);
}

private function wait(bool $blocking)
private function wait(bool $blocking): void
{
foreach ($this->client->stream($this->responses, $blocking ? null : 0.0) as $response => $chunk) {
try {
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/Monolog/Handler/FirePHPHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class FirePHPHandler extends BaseFirePHPHandler
/**
* Adds the headers to the response once it's created.
*/
public function onKernelResponse(ResponseEvent $event)
public function onKernelResponse(ResponseEvent $event): void
{
if (!$event->isMainRequest()) {
return;
Expand Down
2 changes: 2 additions & 0 deletions src/Symfony/Bridge/Monolog/Handler/MailerHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ private function doWrite(array|LogRecord $record): void
*
* @param string $content formatted email body to be sent
* @param array $records the array of log records that formed this content
*
* @return void
*/
protected function send(string $content, array $records)
{
Expand Down
6 changes: 6 additions & 0 deletions src/Symfony/Bridge/Monolog/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ public function countErrors(Request $request = null): int
return 0;
}

/**
* @return void
*/
public function clear()
{
if ($logger = $this->getDebugLogger()) {
Expand All @@ -56,6 +59,9 @@ public function reset(): void
}
}

/**
* @return void
*/
public function removeDebugLogger()
{
foreach ($this->processors as $k => $processor) {
Expand Down
Loading