Skip to content

Commit

Permalink
fix phpstan / cs-fixer returns
Browse files Browse the repository at this point in the history
  • Loading branch information
jdeniau committed Jan 25, 2019
1 parent 8981576 commit ecc55af
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Filter/Validator/ArrayItems.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private function getValue(string $name, array $filterDescription, Request $reque

$collectionFormat = $filterDescription['swagger']['collectionFormat'] ?? 'csv';

return explode(self::getSeparator($collectionFormat), $value);
return explode(self::getSeparator($collectionFormat), $value) ?: [];
}

private static function getSeparator(string $collectionFormat): string
Expand Down
8 changes: 4 additions & 4 deletions src/Filter/Validator/Required.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ private function requestHasQueryParameter(Request $request, string $name): bool
if (\is_array($matches[$rootName])) {
$keyName = \array_keys($matches[$rootName])[0];

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

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

return $request->query->has($rootName);
return $request->query->has((string) $rootName);
}

/**
Expand All @@ -87,7 +87,7 @@ private function requestGetQueryParameter(Request $request, string $name)
if (\is_array($matches[$rootName])) {
$keyName = \array_keys($matches[$rootName])[0];

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

if (\is_array($queryParameter) && isset($queryParameter[$keyName])) {
return $queryParameter[$keyName];
Expand All @@ -96,6 +96,6 @@ private function requestGetQueryParameter(Request $request, string $name)
return null;
}

return $request->query->get($rootName);
return $request->query->get((string) $rootName);
}
}
2 changes: 1 addition & 1 deletion tests/Filter/Validator/PatternTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function testFilterWithNonchingValue()
];

$this->assertEmpty(
$filter->validate('some_filter', $explicitFilterDefinition, new Request(['some_filter' => 'this is a foo '.mt_rand(0, 10).' and it should match']))
$filter->validate('some_filter', $explicitFilterDefinition, new Request(['some_filter' => 'this is a foo '.random_int(0, 10).' and it should match']))
);
}
}

0 comments on commit ecc55af

Please sign in to comment.