diff --git a/src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php b/src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php index 15e285056ac23..c6ddb921f1e21 100644 --- a/src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php +++ b/src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php @@ -121,7 +121,7 @@ public function upgradePassword(PasswordAuthenticatedUserInterface $user, string } $repository = $this->getRepository(); - if ($user instanceof PasswordAuthenticatedUserInterface && $repository instanceof PasswordUpgraderInterface) { + if ($repository instanceof PasswordUpgraderInterface) { $repository->upgradePassword($user, $newHashedPassword); } } diff --git a/src/Symfony/Bridge/Twig/Command/DebugCommand.php b/src/Symfony/Bridge/Twig/Command/DebugCommand.php index d0aded57bf20b..1c2c1619d220c 100644 --- a/src/Symfony/Bridge/Twig/Command/DebugCommand.php +++ b/src/Symfony/Bridge/Twig/Command/DebugCommand.php @@ -412,7 +412,6 @@ private function findWrongBundleOverrides(): array } if ($notFoundBundles = array_diff_key($bundleNames, $this->bundlesMetadata)) { - $alternatives = []; foreach ($notFoundBundles as $notFoundBundle => $path) { $alternatives[$path] = $this->findAlternatives($notFoundBundle, array_keys($this->bundlesMetadata)); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php index 6ee8b04a16b95..5efaab496bb94 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php @@ -172,7 +172,7 @@ protected function describeContainerService(object $service, array $options = [] $options['output']->table( ['Service ID', 'Class'], [ - [$options['id'] ?? '-', $service::class], + [$options['id'], $service::class], ] ); } @@ -333,7 +333,7 @@ protected function describeContainerDefinition(Definition $definition, array $op $tableRows[] = ['Autoconfigured', $definition->isAutoconfigured() ? 'yes' : 'no']; if ($definition->getFile()) { - $tableRows[] = ['Required File', $definition->getFile() ?: '-']; + $tableRows[] = ['Required File', $definition->getFile()]; } if ($factory = $definition->getFactory()) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/XliffLintCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/XliffLintCommandTest.php index db32bc19cb359..d5495ada92e00 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/XliffLintCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/XliffLintCommandTest.php @@ -64,9 +64,7 @@ private function createCommandTester($application = null): CommandTester $command = $application->find('lint:xliff'); - if ($application) { - $command->setApplication($application); - } + $command->setApplication($application); return new CommandTester($command); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/YamlLintCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/YamlLintCommandTest.php index 08f4a75265abf..ec2093119511c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/YamlLintCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/YamlLintCommandTest.php @@ -112,9 +112,7 @@ private function createCommandTester($application = null): CommandTester $command = $application->find('lint:yaml'); - if ($application) { - $command->setApplication($application); - } + $command->setApplication($application); return new CommandTester($command); } diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Compiler/ReplaceDecoratedRememberMeHandlerPass.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Compiler/ReplaceDecoratedRememberMeHandlerPass.php index 742d3c08bad13..371617bd4e693 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Compiler/ReplaceDecoratedRememberMeHandlerPass.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Compiler/ReplaceDecoratedRememberMeHandlerPass.php @@ -37,9 +37,6 @@ public function process(ContainerBuilder $container): void // get the actual custom remember me handler definition (passed to the decorator) $realRememberMeHandler = $container->findDefinition((string) $definition->getArgument(0)); - if (null === $realRememberMeHandler) { - throw new \LogicException(\sprintf('Invalid service definition for custom remember me handler; no service found with ID "%s".', (string) $definition->getArgument(0))); - } foreach ($rememberMeHandlerTags as $rememberMeHandlerTag) { // some custom handlers may be used on multiple firewalls in the same application diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/SecuredPageBundle/Security/Core/User/ArrayUserProvider.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/SecuredPageBundle/Security/Core/User/ArrayUserProvider.php index 784a032777936..553cff3855091 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/SecuredPageBundle/Security/Core/User/ArrayUserProvider.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/SecuredPageBundle/Security/Core/User/ArrayUserProvider.php @@ -12,7 +12,6 @@ namespace Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\SecuredPageBundle\Security\Core\User; use Symfony\Bundle\SecurityBundle\Tests\Functional\UserWithoutEquatable; -use Symfony\Component\Security\Core\Exception\UnsupportedUserException; use Symfony\Component\Security\Core\Exception\UserNotFoundException; use Symfony\Component\Security\Core\User\InMemoryUser; use Symfony\Component\Security\Core\User\UserInterface; @@ -59,10 +58,6 @@ public function loadUserByIdentifier(string $identifier): UserInterface public function refreshUser(UserInterface $user): UserInterface { - if (!$user instanceof UserInterface) { - throw new UnsupportedUserException(\sprintf('Instances of "%s" are not supported.', get_debug_type($user))); - } - $storedUser = $this->getUser($user->getUserIdentifier()); $class = $storedUser::class; diff --git a/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php b/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php index 34082db1f22d6..53c989047ff63 100644 --- a/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php @@ -207,12 +207,10 @@ public function clear(string $prefix = ''): bool unset($this->deferred[$key]); } } - } else { - $this->deferred = []; - } - if ($this->pool instanceof AdapterInterface) { return $this->pool->clear($prefix); + } else { + $this->deferred = []; } return $this->pool->clear(); diff --git a/src/Symfony/Component/Cache/Traits/FilesystemCommonTrait.php b/src/Symfony/Component/Cache/Traits/FilesystemCommonTrait.php index 98658a71bffbd..98e0d3ec504f5 100644 --- a/src/Symfony/Component/Cache/Traits/FilesystemCommonTrait.php +++ b/src/Symfony/Component/Cache/Traits/FilesystemCommonTrait.php @@ -108,7 +108,6 @@ private function write(string $file, string $data, ?int $expiresAt = null): bool if ('\\' === \DIRECTORY_SEPARATOR) { $success = copy($tmp, $file); - $unlink = true; } else { $success = rename($tmp, $file); $unlink = !$success; diff --git a/src/Symfony/Component/Cache/Traits/RedisTrait.php b/src/Symfony/Component/Cache/Traits/RedisTrait.php index 75a2f36e57fac..d885c0973b96d 100644 --- a/src/Symfony/Component/Cache/Traits/RedisTrait.php +++ b/src/Symfony/Component/Cache/Traits/RedisTrait.php @@ -199,7 +199,7 @@ public static function createConnection(#[\SensitiveParameter] string $dsn, arra \extension_loaded('relay') => Relay::class, default => \Predis\Client::class, }, - 1 < \count($hosts) && \extension_loaded('redis') => 1 < \count($hosts) ? \RedisArray::class : \Redis::class, + 1 < \count($hosts) && \extension_loaded('redis') => \RedisArray::class, \extension_loaded('redis') => \Redis::class, \extension_loaded('relay') => Relay::class, default => \Predis\Client::class, @@ -614,7 +614,7 @@ private function pipeline(\Closure $generator, ?object $redis = null): \Generato } }); } elseif ($redis instanceof \RedisArray) { - $connections = $results = $ids = []; + $connections = $results = []; foreach ($generator() as $command => $args) { $id = 'eval' === $command ? $args[1][0] : $args[0]; if (!isset($connections[$h = $redis->_target($id)])) { diff --git a/src/Symfony/Component/Config/Definition/ArrayNode.php b/src/Symfony/Component/Config/Definition/ArrayNode.php index 2d7369b00d7ce..5301b7243b792 100644 --- a/src/Symfony/Component/Config/Definition/ArrayNode.php +++ b/src/Symfony/Component/Config/Definition/ArrayNode.php @@ -198,7 +198,7 @@ public function addChild(NodeInterface $node): void 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))); + throw new UnsetKeyException(\sprintf('Unsetting key for path "%s", value: false.', $this->getPath())); } foreach ($this->children as $name => $child) { diff --git a/src/Symfony/Component/Config/Definition/PrototypedArrayNode.php b/src/Symfony/Component/Config/Definition/PrototypedArrayNode.php index eed95d2005ebc..a901dab78d796 100644 --- a/src/Symfony/Component/Config/Definition/PrototypedArrayNode.php +++ b/src/Symfony/Component/Config/Definition/PrototypedArrayNode.php @@ -156,7 +156,7 @@ public function addChild(NodeInterface $node): never 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))); + throw new UnsetKeyException(\sprintf('Unsetting key for path "%s", value: false.', $this->getPath())); } foreach ($value as $k => $v) { @@ -218,7 +218,7 @@ protected function normalizeValue(mixed $value): mixed $valuePrototype->parent = $this; $originalClosures = $this->prototype->normalizationClosures; $valuePrototypeClosures = $valuePrototype->normalizationClosures; - $valuePrototype->normalizationClosures = \is_array($valuePrototypeClosures) ? array_merge($originalClosures, $valuePrototypeClosures) : $originalClosures; + $valuePrototype->normalizationClosures = array_merge($originalClosures, $valuePrototypeClosures); $this->valuePrototypes[$k] = $valuePrototype; } } diff --git a/src/Symfony/Component/Config/Tests/Resource/GlobResourceTest.php b/src/Symfony/Component/Config/Tests/Resource/GlobResourceTest.php index 4d1eb4f1f03ff..c2698b033bd63 100644 --- a/src/Symfony/Component/Config/Tests/Resource/GlobResourceTest.php +++ b/src/Symfony/Component/Config/Tests/Resource/GlobResourceTest.php @@ -41,7 +41,6 @@ public function testIterator() $paths = iterator_to_array($resource); - $file = $dir.'/Resource'.\DIRECTORY_SEPARATOR.'ConditionalClass.php'; $this->assertEquals([$file => $file], $paths); $this->assertInstanceOf(\SplFileInfo::class, current($paths)); $this->assertSame($dir, $resource->getPrefix()); diff --git a/src/Symfony/Component/Console/DependencyInjection/AddConsoleCommandPass.php b/src/Symfony/Component/Console/DependencyInjection/AddConsoleCommandPass.php index 642247e3f34e4..f1521602a8e1b 100644 --- a/src/Symfony/Component/Console/DependencyInjection/AddConsoleCommandPass.php +++ b/src/Symfony/Component/Console/DependencyInjection/AddConsoleCommandPass.php @@ -53,7 +53,7 @@ public function process(ContainerBuilder $container): void $aliases = str_replace('%', '%%', $class::getDefaultName() ?? ''); } - $aliases = explode('|', $aliases ?? ''); + $aliases = explode('|', $aliases); $commandName = array_shift($aliases); if ($isHidden = '' === $commandName) { diff --git a/src/Symfony/Component/Console/SingleCommandApplication.php b/src/Symfony/Component/Console/SingleCommandApplication.php index ff1c17247fc4f..2b54fb870d244 100644 --- a/src/Symfony/Component/Console/SingleCommandApplication.php +++ b/src/Symfony/Component/Console/SingleCommandApplication.php @@ -67,6 +67,6 @@ public function run(?InputInterface $input = null, ?OutputInterface $output = nu $this->running = false; } - return $ret ?? 1; + return $ret; } } diff --git a/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php b/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php index ebde21bcdc0ce..06e3981f77bfb 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php @@ -193,7 +193,7 @@ public function resolveEnvPlaceholders(mixed $value, string|bool|null $format = $value = $bag->resolveValue($value); if (!$bag instanceof EnvPlaceholderParameterBag) { - return parent::resolveEnvPlaceholders($value, $format, $usedEnvs); + return parent::resolveEnvPlaceholders($value, true, $usedEnvs); } foreach ($bag->getEnvPlaceholders() as $env => $placeholders) { @@ -207,6 +207,6 @@ public function resolveEnvPlaceholders(mixed $value, string|bool|null $format = } } - return parent::resolveEnvPlaceholders($value, $format, $usedEnvs); + return parent::resolveEnvPlaceholders($value, true, $usedEnvs); } } diff --git a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php index 62a3f64a5f976..43908e120643c 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php +++ b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php @@ -446,7 +446,7 @@ public function fileExists(string $path, bool|string $trackContents = true): boo if (!$exists) { $this->addResource(new FileExistenceResource($path)); - return $exists; + return false; } if (is_dir($path)) { @@ -459,7 +459,7 @@ public function fileExists(string $path, bool|string $trackContents = true): boo $this->addResource(new FileResource($path)); } - return $exists; + return true; } /** diff --git a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php index e3f07b50b755b..a4a93f63a415f 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php @@ -448,7 +448,7 @@ private function parseDefinition(string $id, array|string|null $service, string throw new InvalidArgumentException(\sprintf('Missing attribute "version" of the "deprecated" option in "%s".', $file)); } - $alias->setDeprecated($deprecation['package'] ?? '', $deprecation['version'] ?? '', $deprecation['message'] ?? ''); + $alias->setDeprecated($deprecation['package'], $deprecation['version'], $deprecation['message'] ?? ''); } } @@ -520,7 +520,7 @@ private function parseDefinition(string $id, array|string|null $service, string throw new InvalidArgumentException(\sprintf('Missing attribute "version" of the "deprecated" option in "%s".', $file)); } - $definition->setDeprecated($deprecation['package'] ?? '', $deprecation['version'] ?? '', $deprecation['message'] ?? ''); + $definition->setDeprecated($deprecation['package'], $deprecation['version'], $deprecation['message'] ?? ''); } if (isset($service['factory'])) { diff --git a/src/Symfony/Component/Finder/Finder.php b/src/Symfony/Component/Finder/Finder.php index 80bf6a793f2ae..78673af66a9bd 100644 --- a/src/Symfony/Component/Finder/Finder.php +++ b/src/Symfony/Component/Finder/Finder.php @@ -699,8 +699,6 @@ public function getIterator(): \Iterator * The set can be another Finder, an Iterator, an IteratorAggregate, or even a plain array. * * @return $this - * - * @throws \InvalidArgumentException when the given argument is not iterable */ public function append(iterable $iterator): static { @@ -708,15 +706,13 @@ public function append(iterable $iterator): static $this->iterators[] = $iterator->getIterator(); } elseif ($iterator instanceof \Iterator) { $this->iterators[] = $iterator; - } elseif (is_iterable($iterator)) { + } else { $it = new \ArrayIterator(); foreach ($iterator as $file) { $file = $file instanceof \SplFileInfo ? $file : new \SplFileInfo($file); $it[$file->getPathname()] = $file; } $this->iterators[] = $it; - } else { - throw new \InvalidArgumentException('Finder::append() method wrong argument type.'); } return $this; diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToArrayTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToArrayTransformer.php index 18679a910321d..8591db19100c0 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToArrayTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToArrayTransformer.php @@ -139,7 +139,7 @@ public function reverseTransform(mixed $value): ?\DateInterval 'P%sY%sM%sWT%sH%sM%sS', empty($value['years']) ? '0' : $value['years'], empty($value['months']) ? '0' : $value['months'], - empty($value['weeks']) ? '0' : $value['weeks'], + $value['weeks'], empty($value['hours']) ? '0' : $value['hours'], empty($value['minutes']) ? '0' : $value['minutes'], empty($value['seconds']) ? '0' : $value['seconds'] diff --git a/src/Symfony/Component/Form/Extension/Core/Type/DateType.php b/src/Symfony/Component/Form/Extension/Core/Type/DateType.php index 54f24b89a0818..e4aee6e8dee8e 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/DateType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/DateType.php @@ -249,10 +249,8 @@ public function configureOptions(OptionsResolver $resolver): void $choiceTranslationDomainNormalizer = static function (Options $options, $choiceTranslationDomain) { if (\is_array($choiceTranslationDomain)) { - $default = false; - return array_replace( - ['year' => $default, 'month' => $default, 'day' => $default], + ['year' => false, 'month' => false, 'day' => false], $choiceTranslationDomain ); } diff --git a/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php b/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php index 35549b0419e7a..92cf42d963e74 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php @@ -274,10 +274,8 @@ public function configureOptions(OptionsResolver $resolver): void $choiceTranslationDomainNormalizer = static function (Options $options, $choiceTranslationDomain) { if (\is_array($choiceTranslationDomain)) { - $default = false; - return array_replace( - ['hour' => $default, 'minute' => $default, 'second' => $default], + ['hour' => false, 'minute' => false, 'second' => false], $choiceTranslationDomain ); } diff --git a/src/Symfony/Component/Form/Extension/Core/Type/WeekType.php b/src/Symfony/Component/Form/Extension/Core/Type/WeekType.php index ec5cc930378bb..aea4a6c564889 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/WeekType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/WeekType.php @@ -113,10 +113,8 @@ public function configureOptions(OptionsResolver $resolver): void $choiceTranslationDomainNormalizer = static function (Options $options, $choiceTranslationDomain) { if (\is_array($choiceTranslationDomain)) { - $default = false; - return array_replace( - ['year' => $default, 'week' => $default], + ['year' => false, 'week' => false], $choiceTranslationDomain ); } diff --git a/src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php b/src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php index 703bac1484328..8f4ec60f24a86 100644 --- a/src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php +++ b/src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php @@ -56,7 +56,7 @@ public function validate(mixed $form, Constraint $formConstraint): void // Validate the data against its own constraints $validateDataGraph = $form->isRoot() && (\is_object($data) || \is_array($data)) - && (($groups && \is_array($groups)) || ($groups instanceof GroupSequence && $groups->groups)) + && (\is_array($groups) || ($groups instanceof GroupSequence && $groups->groups)) ; // Validate the data against the constraints defined in the form diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index 114010609c981..e80bfa61fae2b 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -1536,7 +1536,7 @@ public function getPreferredLanguage(?array $locales = null): ?string return $preferredLanguages[0] ?? null; } - $locales = array_map($this->formatLocale(...), $locales ?? []); + $locales = array_map($this->formatLocale(...), $locales); if (!$preferredLanguages) { return $locales[0]; } diff --git a/src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php index ecf638fde8650..428d6762408eb 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php @@ -191,7 +191,7 @@ private function getContainerDeprecationLogs(): array $log['priorityName'] = 'DEBUG'; $log['channel'] = null; $log['scream'] = false; - unset($log['type'], $log['file'], $log['line'], $log['trace'], $log['trace'], $log['count']); + unset($log['type'], $log['file'], $log['line'], $log['trace'], $log['count']); $logs[] = $log; } diff --git a/src/Symfony/Component/Messenger/Bridge/Redis/Transport/Connection.php b/src/Symfony/Component/Messenger/Bridge/Redis/Transport/Connection.php index 909f60b366ea6..c81deced41984 100644 --- a/src/Symfony/Component/Messenger/Bridge/Redis/Transport/Connection.php +++ b/src/Symfony/Component/Messenger/Bridge/Redis/Transport/Connection.php @@ -293,7 +293,7 @@ public static function fromDsn(#[\SensitiveParameter] string $dsn, array $option } if (isset($params['host'])) { - $options['host'] = $params['host'] ?? $options['host']; + $options['host'] = $params['host']; $options['port'] = $params['port'] ?? $options['port']; $pathParts = explode('/', rtrim($params['path'] ?? '', '/')); diff --git a/src/Symfony/Component/Notifier/Bridge/ContactEveryone/ContactEveryoneTransport.php b/src/Symfony/Component/Notifier/Bridge/ContactEveryone/ContactEveryoneTransport.php index 377a1f902d15a..e2f9e0ac533d0 100644 --- a/src/Symfony/Component/Notifier/Bridge/ContactEveryone/ContactEveryoneTransport.php +++ b/src/Symfony/Component/Notifier/Bridge/ContactEveryone/ContactEveryoneTransport.php @@ -96,7 +96,7 @@ protected function doSend(MessageInterface $message): SentMessage $result = $response->getContent(false); $sentMessage = new SentMessage($message, (string) $this); - $sentMessage->setMessageId($result ?? ''); + $sentMessage->setMessageId($result); return $sentMessage; } diff --git a/src/Symfony/Component/Security/Http/EventListener/SessionStrategyListener.php b/src/Symfony/Component/Security/Http/EventListener/SessionStrategyListener.php index a0eef125d8cb6..8267e036006b0 100644 --- a/src/Symfony/Component/Security/Http/EventListener/SessionStrategyListener.php +++ b/src/Symfony/Component/Security/Http/EventListener/SessionStrategyListener.php @@ -45,7 +45,7 @@ public function onSuccessfulLogin(LoginSuccessEvent $event): void $user = $token->getUserIdentifier(); $previousUser = $previousToken->getUserIdentifier(); - if ('' !== ($user ?? '') && $user === $previousUser && $token::class === $previousToken::class) { + if ('' !== $user && $user === $previousUser && $token::class === $previousToken::class) { return; } } diff --git a/src/Symfony/Component/String/Tests/Inflector/SpanishInflectorTest.php b/src/Symfony/Component/String/Tests/Inflector/SpanishInflectorTest.php index f0b8e4201684d..b10509a6529f3 100644 --- a/src/Symfony/Component/String/Tests/Inflector/SpanishInflectorTest.php +++ b/src/Symfony/Component/String/Tests/Inflector/SpanishInflectorTest.php @@ -151,7 +151,7 @@ public function testPluralize(string $singular, $plural) public function testUninflected(string $word) { $this->assertSame( - \is_array($word) ? $word : [$word], + [$word], (new SpanishInflector())->pluralize($word) ); } diff --git a/src/Symfony/Component/String/UnicodeString.php b/src/Symfony/Component/String/UnicodeString.php index 4b16caf9fc97e..b458de0c5a7fd 100644 --- a/src/Symfony/Component/String/UnicodeString.php +++ b/src/Symfony/Component/String/UnicodeString.php @@ -286,7 +286,7 @@ public function splice(string $replacement, int $start = 0, ?int $length = null) $str = clone $this; $start = $start ? \strlen(grapheme_substr($this->string, 0, $start)) : 0; - $length = $length ? \strlen(grapheme_substr($this->string, $start, $length ?? 2147483647)) : $length; + $length = $length ? \strlen(grapheme_substr($this->string, $start, $length)) : $length; $str->string = substr_replace($this->string, $replacement, $start, $length ?? 2147483647); if (normalizer_is_normalized($str->string)) { diff --git a/src/Symfony/Component/Translation/Tests/Command/XliffLintCommandTest.php b/src/Symfony/Component/Translation/Tests/Command/XliffLintCommandTest.php index 19374f69eb88f..7b9fd1ae35b9d 100644 --- a/src/Symfony/Component/Translation/Tests/Command/XliffLintCommandTest.php +++ b/src/Symfony/Component/Translation/Tests/Command/XliffLintCommandTest.php @@ -215,9 +215,7 @@ private function createCommand($requireStrictFileNames = true, $application = nu $command = $application->find('lint:xliff'); - if ($application) { - $command->setApplication($application); - } + $command->setApplication($application); return $command; } diff --git a/src/Symfony/Component/Validator/Tests/Constraints/CallbackValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/CallbackValidatorTest.php index e888baa7a6596..ef92d307258fd 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/CallbackValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/CallbackValidatorTest.php @@ -246,7 +246,6 @@ public function testPayloadIsPassedToCallback() $constraint = new Callback(callback: $callback, payload: 'Hello world!'); $this->validator->validate($object, $constraint); $this->assertEquals('Hello world!', $payloadCopy); - $payloadCopy = 'Replace me!'; $payloadCopy = 'Replace me!'; $constraint = new Callback([ diff --git a/src/Symfony/Component/Yaml/Parser.php b/src/Symfony/Component/Yaml/Parser.php index 1fade4ac62cbd..f82f2b5708bac 100644 --- a/src/Symfony/Component/Yaml/Parser.php +++ b/src/Symfony/Component/Yaml/Parser.php @@ -874,7 +874,7 @@ private function parseBlockScalar(string $style, string $chomping = '', int $ind if ($notEOF) { $blockLines[] = ''; $this->moveToPreviousLine(); - } elseif (!$notEOF && !$this->isCurrentLineLastLineInDocument()) { + } elseif (!$this->isCurrentLineLastLineInDocument()) { $blockLines[] = ''; }