1 | <?php |
||
20 | class ContentfulSyncController extends Controller |
||
21 | { |
||
22 | |||
23 | protected const TOPIC_CONTENT_MANAGEMENT_ASSET_PUBLISH = 'ContentManagement.Asset.publish'; |
||
24 | protected const TOPIC_CONTENT_MANAGEMENT_ASSET_UNPUBLISH = 'ContentManagement.Asset.unpublish'; |
||
25 | protected const TOPIC_CONTENT_MANAGEMENT_ASSET_DELETE = 'ContentManagement.Asset.delete'; |
||
26 | protected const TOPIC_CONTENT_MANAGEMENT_ENTRY_PUBLISH = 'ContentManagement.Entry.publish'; |
||
27 | protected const TOPIC_CONTENT_MANAGEMENT_ENTRY_UNPUBLISH = 'ContentManagement.Entry.unpublish'; |
||
28 | protected const TOPIC_CONTENT_MANAGEMENT_ENTRY_DELETE = 'ContentManagement.Entry.delete'; |
||
29 | |||
30 | /** |
||
31 | * @var ContentfulServiceContract |
||
32 | */ |
||
33 | private $contentfulService; |
||
34 | |||
35 | /** |
||
36 | * @var ContentfulSyncServiceContract |
||
37 | */ |
||
38 | private $contentfulSyncService; |
||
39 | |||
40 | /** |
||
41 | * ContentfulSyncController constructor. |
||
42 | * |
||
43 | * @param ContentfulServiceContract $contentfulService |
||
44 | * @param ContentfulSyncServiceContract $contentfulSyncService |
||
45 | */ |
||
46 | public function __construct( |
||
53 | |||
54 | /** |
||
55 | * @param Request $request |
||
56 | * |
||
57 | * @return Response |
||
58 | * |
||
59 | * @throws \InvalidArgumentException if the space or environment ID is invalid |
||
60 | * @throws ContentfulSyncException if the webhook cannot be handled |
||
61 | */ |
||
62 | public function handleIncomingWebhook(Request $request): Response |
||
103 | |||
104 | /** |
||
105 | * @param ResourceInterface $resource |
||
106 | * |
||
107 | * @return string |
||
108 | * |
||
109 | * @throws \InvalidArgumentException |
||
110 | */ |
||
111 | private function getResourceContentType(ResourceInterface $resource): string |
||
123 | |||
124 | /** |
||
125 | * @param Request $request |
||
126 | * |
||
127 | * @return string |
||
128 | */ |
||
129 | private function getContentfulTopic(Request $request): string |
||
133 | } |
||
134 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: