From b2d49f595b2f3f91de9ad152efeed685103c4fbc Mon Sep 17 00:00:00 2001 From: Scott Wilson Date: Thu, 5 Feb 2026 10:24:48 -0500 Subject: [PATCH] Fix: array @type parsing bug - iterate over $type not $types When @type is an array (e.g., ["Recipe", "NewsArticle"]), the code was incorrectly iterating over $types (empty array) instead of $type (the actual array of types from the JSON). This caused pages like AllRecipes.com to fail parsing because they use array-style @type values. --- src/Reader/JsonLdReader.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Reader/JsonLdReader.php b/src/Reader/JsonLdReader.php index 3f5672b..83d76c1 100644 --- a/src/Reader/JsonLdReader.php +++ b/src/Reader/JsonLdReader.php @@ -161,8 +161,8 @@ private function readItem(stdClass $item, string $url, ?string $vocabulary): Ite $types = [$type]; } elseif (is_array($type)) { $types = array_map( - fn ($type) => is_string($type) ? $this->resolveTerm($type, $vocabulary) : null, - $types, + fn ($t) => is_string($t) ? $this->resolveTerm($t, $vocabulary) : null, + $type, ); $types = array_filter($types);