-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
Description
Summary of a problem or a feature request
Result of || is always false is wrongly reported for a parameter validation.
Code snippet that reproduces the problem
/**
* @param SerializerInterface&ArrayTransformerInterface $originalSerializer must implement both SerializerInterface and ArrayTransformerInterface interfaces
*/
public function __construct(
$originalSerializer,
) {
if (!$originalSerializer instanceof SerializerInterface
|| !$originalSerializer instanceof ArrayTransformerInterface
) {
throw new \InvalidArgumentException(sprintf(
'Original serializer must implement both ArrayTransformerInterface and SerializerInterface, but is %s',
\get_class($originalSerializer)
));
}Expected output
This code seems fine correct to me. The check is needed because there is no PHP parameter declaration.
For context, this happens in liip/serializer-jms-adapter#1 - our workaround was to ignore the warning about || always being false.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels