Skip to content

Commit aa22f7b

Browse files
Girgiasnicolas-grekas
authored andcommitted
Remove some implicit bool type juggling
1 parent 8150927 commit aa22f7b

File tree

38 files changed

+106
-105
lines changed

38 files changed

+106
-105
lines changed

src/Symfony/Bridge/Twig/Tests/Extension/AbstractBootstrap3LayoutTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2141,7 +2141,7 @@ public function testMoney()
21412141
public function testMoneyWithoutCurrency()
21422142
{
21432143
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\MoneyType', 1234.56, [
2144-
'currency' => false,
2144+
'currency' => null,
21452145
]);
21462146

21472147
$this->assertWidgetMatchesXpath($form->createView(), ['id' => 'my&id', 'attr' => ['class' => 'my&class']],

src/Symfony/Bridge/Twig/Tests/Extension/SecurityExtensionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ public static function provideObjectFieldAclCases()
9494
return [
9595
[null, null, null],
9696
['object', null, 'object'],
97-
['object', false, new FieldVote('object', false)],
98-
['object', 0, new FieldVote('object', 0)],
97+
['object', '', new FieldVote('object', false)],
98+
['object', '0', new FieldVote('object', 0)],
9999
['object', '', new FieldVote('object', '')],
100100
['object', 'field', new FieldVote('object', 'field')],
101101
];

src/Symfony/Bundle/FrameworkBundle/Command/DebugAutowiringCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ private function getFileLink(string $class): string
184184
return '';
185185
}
186186

187-
return (string) $this->fileLinkFormatter->format($r->getFileName(), $r->getStartLine());
187+
return $r->getFileName() ? ($this->fileLinkFormatter->format($r->getFileName(), $r->getStartLine()) ?: '') : '';
188188
}
189189

190190
public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void

src/Symfony/Bundle/TwigBundle/Tests/Functional/AttributeExtensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function registerContainerConfiguration(LoaderInterface $loader): void
5151
$container->register(StaticExtensionWithAttributes::class, StaticExtensionWithAttributes::class)
5252
->setAutoconfigured(true);
5353
$container->register(RuntimeExtensionWithAttributes::class, RuntimeExtensionWithAttributes::class)
54-
->setArguments(['prefix_'])
54+
->setArguments([true])
5555
->setAutoconfigured(true);
5656

5757
$container->setAlias('twig_test', 'twig')->setPublic(true);

src/Symfony/Bundle/WebProfilerBundle/Profiler/CodeExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function formatArgs(array $args): string
9494
$formattedValue = '<em>'.strtolower(htmlspecialchars(var_export($item[1], true), \ENT_COMPAT | \ENT_SUBSTITUTE, $this->charset)).'</em>';
9595
} elseif ('resource' === $item[0]) {
9696
$formattedValue = '<em>resource</em>';
97-
} elseif (preg_match('/[^\x07-\x0D\x1B\x20-\xFF]/', $item[1])) {
97+
} elseif (\is_string($item[1]) && preg_match('/[^\x07-\x0D\x1B\x20-\xFF]/', $item[1])) {
9898
$formattedValue = '<em>binary string</em>';
9999
} else {
100100
$formattedValue = str_replace("\n", '', htmlspecialchars(var_export($item[1], true), \ENT_COMPAT | \ENT_SUBSTITUTE, $this->charset));

src/Symfony/Component/AssetMapper/AssetMapperDevServerSubscriber.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public function onKernelRequest(RequestEvent $event): void
146146
if ($mediaType = $this->getMediaType($asset->publicPath)) {
147147
$response->headers->set('Content-Type', $mediaType);
148148
}
149-
$response->headers->set('X-Assets-Dev', true);
149+
$response->headers->set('X-Assets-Dev', '1');
150150

151151
$event->setResponse($response);
152152
$event->stopPropagation();

src/Symfony/Component/BrowserKit/AbstractBrowser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ private function updateServerFromUri(array $server, string $uri): array
686686

687687
private function extractHost(string $uri): ?string
688688
{
689-
$host = parse_url($uri, \PHP_URL_HOST);
689+
$host = parse_url($uri, \PHP_URL_HOST) ?: null;
690690

691691
if ($port = parse_url($uri, \PHP_URL_PORT)) {
692692
return $host.':'.$port;

src/Symfony/Component/Cache/Tests/Traits/RedisTraitTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function testUrlDecodeParameters()
5757

5858
public static function provideCreateConnection(): array
5959
{
60-
$hosts = array_map(fn ($host) => \sprintf('host[%s]', $host), explode(' ', getenv('REDIS_CLUSTER_HOSTS')));
60+
$hosts = array_map(fn ($host) => \sprintf('host[%s]', $host), explode(' ', getenv('REDIS_CLUSTER_HOSTS') ?: ''));
6161

6262
return [
6363
[

src/Symfony/Component/DependencyInjection/Tests/AliasTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ public static function invalidDeprecationMessageProvider(): array
8888
"With \ns" => ["invalid \n message %alias_id%"],
8989
'With */s' => ['invalid */ message %alias_id%'],
9090
'message not containing required %alias_id% variable' => ['this is deprecated'],
91-
'template not containing required %alias_id% variable' => [true],
9291
];
9392
}
9493
}

src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,6 @@ public static function invalidDeprecationMessageProvider(): array
205205
"With \ns" => ["invalid \n message %service_id%"],
206206
'With */s' => ['invalid */ message %service_id%'],
207207
'message not containing require %service_id% variable' => ['this is deprecated'],
208-
'template not containing require %service_id% variable' => [true],
209208
];
210209
}
211210

0 commit comments

Comments
 (0)