@@ -35,6 +35,7 @@ public function register(string $location, string $defaultPosition, string $bloc
3535 $ this ->blocksByLocationAndPosition [$ location ][$ defaultPosition ] = [];
3636 }
3737
38+ // @phpstan-ignore-next-line
3839 if (!is_a ($ blockClass , ViewBlockInterface::class, true )) {
3940 throw new \InvalidArgumentException ('When registering a view block, the block class must implement ViewBlockInterface ' );
4041 }
@@ -81,7 +82,7 @@ protected function blocksToInstances(array $blocks): array
8182 */
8283 protected function getForLocation (string $ location ): array
8384 {
84- $ defaults = ViewBlockDefaults::getForLocation ($ location ) ?? [] ;
85+ $ defaults = ViewBlockDefaults::getForLocation ($ location );
8586 $ registered = $ this ->blocksByLocationAndPosition [$ location ] ?? [];
8687 return array_merge_recursive ($ defaults , $ registered );
8788 }
@@ -90,7 +91,7 @@ protected function getForLocation(string $location): array
9091 * Get all blocks registered for a given location, as sets of arrays
9192 * keyed by position, for the current user.
9293 * Same as above but with user-specific preferences applied.
93- * @return array<string, class-string<ViewBlockInterface>[] >
94+ * @return array<string, list< class-string<ViewBlockInterface>> >
9495 * @throws BindingResolutionException
9596 */
9697 public function getForLocationForCurrentUser (string $ location ): array
@@ -113,7 +114,7 @@ public function getForLocationForCurrentUser(string $location): array
113114 $ results [$ position ] = [];
114115 foreach ($ userBlockIds as $ blockId ) {
115116 $ block = $ blocksById [$ blockId ] ?? null ;
116- if ($ block && isset ( $ blocksById [ $ blockId ]) ) {
117+ if ($ block ) {
117118 $ results [$ position ][] = $ block ;
118119 unset($ blocksById [$ blockId ]);
119120 }
@@ -182,7 +183,7 @@ public function clearLocalCache(): void
182183 /**
183184 * Convert a blocksByPosition array into a map of block IDs to blocks.
184185 * @param array<string, class-string<ViewBlockInterface>[]> $blocksByPosition
185- * @return array<string, ViewBlockInterface>
186+ * @return array<string, class-string< ViewBlockInterface> >
186187 */
187188 protected function blocksByPositionToIdMap (array $ blocksByPosition ): array
188189 {
0 commit comments