Skip to content

Commit

Permalink
Merge 22d33c4 into ab2f82c
Browse files Browse the repository at this point in the history
  • Loading branch information
alanpoulain committed Nov 22, 2019
2 parents ab2f82c + 22d33c4 commit fe5b831
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 27 deletions.
19 changes: 0 additions & 19 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -108,27 +108,8 @@ parameters:
- '#Method ApiPlatform\\Core\\PathResolver\\OperationPathResolverInterface::resolveOperationPath\(\) invoked with 4 parameters, 3 required\.#'

# Expected, due to forward compatibility
-
message: '#Class Symfony\\Component\\ErrorHandler\\ErrorRenderer\\ErrorRendererInterface not found\.#'
path: %currentWorkingDirectory%/tests/Fixtures/app/AppKernel.php
- '#Class Symfony\\Component\\ErrorHandler\\Exception\\FlattenException not found\.#'
-
message: '#Class Symfony\\Component\\HttpKernel\\EventListener\\ErrorListener not found\.#'
path: %currentWorkingDirectory%/src/EventListener/ExceptionListener.php
-
message: '#Instantiated class Symfony\\Component\\HttpKernel\\EventListener\\ErrorListener not found\.#'
path: %currentWorkingDirectory%/src/EventListener/ExceptionListener.php
-
message: '#Parameter \$exception of method ApiPlatform\\Core\\Action\\ExceptionAction::__invoke\(\) has invalid typehint type Symfony\\Component\\ErrorHandler\\Exception\\FlattenException\.#'
path: %currentWorkingDirectory%/src/Action/ExceptionAction.php
- '#Call to method get(Class|Headers|StatusCode)\(\) on an unknown class Symfony\\Component\\ErrorHandler\\Exception\\FlattenException\.#'
-
message: "#Call to function method_exists\\(\\) with 'Symfony\\\\\\\\Component.+' and 'getThrowable' will always evaluate to false\\.#"
paths:
- %currentWorkingDirectory%/tests/Bridge/Symfony/Validator/EventListener/ValidationExceptionListenerTest.php
- %currentWorkingDirectory%/tests/EventListener/ExceptionListenerTest.php
-
message: '#Instanceof between bool\|float\|int|null and ArrayObject will always evaluate to false\.#'
paths:
- %currentWorkingDirectory%/src/JsonApi/Serializer/ItemNormalizer.php
- %currentWorkingDirectory%/src/Serializer/AbstractItemNormalizer.php
2 changes: 1 addition & 1 deletion src/Serializer/AbstractItemNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function __construct(PropertyNameCollectionFactoryInterface $propertyName
return $this->iriConverter->getIriFromItem($object);
};
}
if (!interface_exists(AdvancedNameConverterInterface::class)) {
if (!interface_exists(AdvancedNameConverterInterface::class) && method_exists($this, 'setCircularReferenceHandler')) {
$this->setCircularReferenceHandler($defaultContext['circular_reference_handler']);
}

Expand Down
12 changes: 6 additions & 6 deletions tests/JsonApi/Serializer/ItemNormalizerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,17 +191,17 @@ public function testNormalizeCircularReference()
$normalizer->setSerializer($this->prophesize(SerializerInterface::class)->reveal());

$circularReferenceLimit = 2;
if (interface_exists(AdvancedNameConverterInterface::class)) {
if (!interface_exists(AdvancedNameConverterInterface::class) && method_exists($normalizer, 'setCircularReferenceLimit')) {
$normalizer->setCircularReferenceLimit($circularReferenceLimit);

$context = [
'circular_reference_limit' => $circularReferenceLimit,
'circular_reference_limit_counters' => [spl_object_hash($circularReferenceEntity) => 2],
'circular_reference_limit' => [spl_object_hash($circularReferenceEntity) => 2],
'cache_error' => function () {},
];
} else {
$normalizer->setCircularReferenceLimit($circularReferenceLimit);

$context = [
'circular_reference_limit' => [spl_object_hash($circularReferenceEntity) => 2],
'circular_reference_limit' => $circularReferenceLimit,
'circular_reference_limit_counters' => [spl_object_hash($circularReferenceEntity) => 2],
'cache_error' => function () {},
];
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Serializer/AbstractItemNormalizerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public function testNormalize()
]);
$normalizer->setSerializer($serializerProphecy->reveal());

if (!interface_exists(AdvancedNameConverterInterface::class)) {
if (!interface_exists(AdvancedNameConverterInterface::class) && method_exists($normalizer, 'setIgnoredAttributes')) {
$normalizer->setIgnoredAttributes(['alias']);
}

Expand Down

0 comments on commit fe5b831

Please sign in to comment.