Skip to content

Commit 3bc38f1

Browse files
committed
Bump PHPStan analysis to level 6
1 parent ffc4fcc commit 3bc38f1

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/Bridge/Symfony/Bundle/Command/SwaggerCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,14 @@ protected function execute(InputInterface $input, OutputInterface $output)
6767
{
6868
$documentation = new Documentation($this->resourceNameCollectionFactory->create(), $this->apiTitle, $this->apiDescription, $this->apiVersion, $this->apiFormats);
6969
$data = $this->documentationNormalizer->normalize($documentation);
70-
$content = $input->getOption('yaml') ? Yaml::dump($data, 6, 4, Yaml::DUMP_OBJECT_AS_MAP) : json_encode($data, JSON_PRETTY_PRINT);
70+
$content = $input->getOption('yaml') ? Yaml::dump($data, 6, 4, Yaml::DUMP_OBJECT_AS_MAP) : (json_encode($data, JSON_PRETTY_PRINT) ?: '');
7171
if (!empty($filename = $input->getOption('output')) && \is_string($filename)) {
7272
file_put_contents($filename, $content);
7373
$output->writeln(
7474
sprintf('Data written to %s', $filename)
7575
);
7676
} else {
77-
$output->writeln((string) $content);
77+
$output->writeln($content);
7878
}
7979
}
8080
}

src/Bridge/Symfony/Routing/IriConverter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public function getItemFromIri(string $iri, array $context = [])
9696
}
9797

9898
if (isset($attributes['subresource_operation_name'])) {
99-
if ($item = $this->getSubresourceData($identifiers, $attributes, $context)) {
99+
if (($item = $this->getSubresourceData($identifiers, $attributes, $context)) && !\is_array($item)) {
100100
return $item;
101101
}
102102

src/Filter/QueryParameterValidateListener.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,19 +86,19 @@ private function isRequiredFilterValid(string $name, Request $request): bool
8686
return false;
8787
}
8888

89-
$rootName = array_keys($matches)[0] ?? '';
89+
$rootName = (string) (array_keys($matches)[0] ?? null);
9090
if (!$rootName) {
9191
return false;
9292
}
9393

9494
if (\is_array($matches[$rootName])) {
9595
$keyName = array_keys($matches[$rootName])[0];
9696

97-
$queryParameter = $request->query->get((string) $rootName);
97+
$queryParameter = $request->query->get($rootName);
9898

9999
return \is_array($queryParameter) && isset($queryParameter[$keyName]);
100100
}
101101

102-
return null !== $request->query->get((string) $rootName);
102+
return null !== $request->query->get($rootName);
103103
}
104104
}

0 commit comments

Comments
 (0)