Skip to content

Commit 44f4f37

Browse files
authored
Merge pull request #632 from dunglas/quality_again
More quality fixes
2 parents 399ef55 + 4fe00f5 commit 44f4f37

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

src/Action/ExceptionAction.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ public function __construct(SerializerInterface $serializer, array $errorFormats
4646
/**
4747
* Converts a an exception to a JSON response.
4848
*
49-
* @param \Exception|FlattenException $exception
50-
* @param Request $request
49+
* @param FlattenException $exception
50+
* @param Request $request
5151
*
5252
* @return Response
5353
*/
54-
public function __invoke($exception, Request $request) : Response
54+
public function __invoke(FlattenException $exception, Request $request) : Response
5555
{
5656
$exceptionClass = $exception->getClass();
5757
foreach ($this->exceptionToStatus as $class => $status) {

src/Bridge/Doctrine/Orm/Filter/AbstractFilter.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,6 @@ protected function extractProperties(Request $request) : array
192192
protected function addJoinsForNestedProperty(string $property, string $rootAlias, QueryBuilder $queryBuilder) : array
193193
{
194194
$propertyParts = $this->splitPropertyParts($property);
195-
196-
if (0 === count($propertyParts['associations'])) {
197-
throw new InvalidArgumentException(sprintf('Cannot add joins for property "%s" - property is not nested.', $property));
198-
}
199-
200195
$parentAlias = $rootAlias;
201196

202197
foreach ($propertyParts['associations'] as $association) {
@@ -205,8 +200,10 @@ protected function addJoinsForNestedProperty(string $property, string $rootAlias
205200
$parentAlias = $alias;
206201
}
207202

208-
$field = $propertyParts['field'];
203+
if (!isset($alias)) {
204+
throw new InvalidArgumentException(sprintf('Cannot add joins for property "%s" - property is not nested.', $property));
205+
}
209206

210-
return [$alias, $field];
207+
return [$alias, $propertyParts['field']];
211208
}
212209
}

src/Hal/Serializer/ItemNormalizer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function supportsNormalization($data, $format = null)
5656
*/
5757
public function normalize($object, $format = null, array $context = [])
5858
{
59-
$context['cache_key'] = $this->getCacheKey($format, $context);
59+
$context['cache_key'] = $this->getHalCacheKey($format, $context);
6060

6161
$rawData = parent::normalize($object, $format, $context);
6262
if (!is_array($rawData)) {
@@ -217,7 +217,7 @@ private function getRelationIri($rel) : string
217217
*
218218
* @return bool|string
219219
*/
220-
private function getCacheKey(string $format = null, array $context)
220+
private function getHalCacheKey(string $format = null, array $context)
221221
{
222222
try {
223223
return md5($format.serialize($context));

0 commit comments

Comments
 (0)