Skip to content

Commit c44b48f

Browse files
minor #53073 Set strict parameter of in_array to true where possible (alexandre-daubois)
This PR was merged into the 7.1 branch. Discussion ---------- Set `strict` parameter of `in_array` to true where possible | Q | A | ------------- | --- | Branch? | 7.1 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | - | License | MIT This pull request introduces a comprehensive update where the `in_array` function is now consistently invoked with the `strict` parameter set to `true`. This change is implemented across various components of the framework to enhance type safety and reliability. To me, this update is a step towards more explicit and error-resistant code. Commits ------- 442329a50f Set `strict` parameter of `in_array` to true where possible
2 parents 5b24bd1 + 6fd1ada commit c44b48f

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

Command/TranslationDebugCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int
223223
}
224224
}
225225

226-
if (!\in_array(self::MESSAGE_UNUSED, $states) && $input->getOption('only-unused')
227-
|| !\in_array(self::MESSAGE_MISSING, $states) && $input->getOption('only-missing')
226+
if (!\in_array(self::MESSAGE_UNUSED, $states, true) && $input->getOption('only-unused')
227+
|| !\in_array(self::MESSAGE_MISSING, $states, true) && $input->getOption('only-missing')
228228
) {
229229
continue;
230230
}

DependencyInjection/Compiler/UnusedTagsPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public function process(ContainerBuilder $container): void
110110

111111
foreach ($container->findUnusedTags() as $tag) {
112112
// skip known tags
113-
if (\in_array($tag, self::KNOWN_TAGS)) {
113+
if (\in_array($tag, self::KNOWN_TAGS, true)) {
114114
continue;
115115
}
116116

DependencyInjection/Configuration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode): void
435435
if (!\is_string($value)) {
436436
return true;
437437
}
438-
if (class_exists(WorkflowEvents::class) && !\in_array($value, WorkflowEvents::ALIASES)) {
438+
if (class_exists(WorkflowEvents::class) && !\in_array($value, WorkflowEvents::ALIASES, true)) {
439439
return true;
440440
}
441441
}

DependencyInjection/FrameworkExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2179,7 +2179,7 @@ private function registerMessengerConfiguration(array $config, ContainerBuilder
21792179
->setArguments([$transport['dsn'], $transport['options'] + ['transport_name' => $name], new Reference($serializerId)])
21802180
->addTag('messenger.receiver', [
21812181
'alias' => $name,
2182-
'is_failure_transport' => \in_array($name, $failureTransports),
2182+
'is_failure_transport' => \in_array($name, $failureTransports, true),
21832183
]
21842184
)
21852185
;

0 commit comments

Comments
 (0)