You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -43,14 +45,13 @@ public function __construct(Negotiator $negotiator, /* FormatsProviderInterface
43
45
if (\is_array($formatsProvider)) {
44
46
@trigger_error('Using an array as formats provider is deprecated since API Platform 2.3 and will not be possible anymore in API Platform 3', E_USER_DEPRECATED);
45
47
$this->formats = $formatsProvider;
48
+
} else {
49
+
if (!$formatsProviderinstanceof FormatsProviderInterface) {
50
+
thrownewInvalidArgumentException(sprintf('The "$formatsProvider" argument is expected to be an implementation of the "%s" interface.', FormatsProviderInterface::class));
51
+
}
46
52
47
-
return;
53
+
$this->formatsProvider = $formatsProvider;
48
54
}
49
-
if (!$formatsProviderinstanceof FormatsProviderInterface) {
50
-
thrownewInvalidArgumentException(sprintf('The "$formatsProvider" argument is expected to be an implementation of the "%s" interface.', FormatsProviderInterface::class));
51
-
}
52
-
53
-
$this->formatsProvider = $formatsProvider;
54
55
}
55
56
56
57
/**
@@ -69,6 +70,7 @@ public function onKernelRequest(GetResponseEvent $event)
@@ -45,14 +47,13 @@ public function __construct(SerializerInterface $serializer, SerializerContextBu
45
47
if (\is_array($formatsProvider)) {
46
48
@trigger_error('Using an array as formats provider is deprecated since API Platform 2.3 and will not be possible anymore in API Platform 3', E_USER_DEPRECATED);
47
49
$this->formats = $formatsProvider;
50
+
} else {
51
+
if (!$formatsProviderinstanceof FormatsProviderInterface) {
52
+
thrownewInvalidArgumentException(sprintf('The "$formatsProvider" argument is expected to be an implementation of the "%s" interface.', FormatsProviderInterface::class));
53
+
}
48
54
49
-
return;
55
+
$this->formatsProvider = $formatsProvider;
50
56
}
51
-
if (!$formatsProviderinstanceof FormatsProviderInterface) {
52
-
thrownewInvalidArgumentException(sprintf('The "$formatsProvider" argument is expected to be an implementation of the "%s" interface.', FormatsProviderInterface::class));
53
-
}
54
-
55
-
$this->formatsProvider = $formatsProvider;
56
57
}
57
58
58
59
/**
@@ -78,6 +79,7 @@ public function onKernelRequest(GetResponseEvent $event)
0 commit comments