From c47b59fcff18cd1d730140bc0606b1d3632970e5 Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Sat, 8 Jun 2024 11:17:20 +0200 Subject: [PATCH] Add patch to reject readme files Patch for https://github.com/hydephp/develop/issues/1716 --- app/Extend/DataCollections.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/Extend/DataCollections.php b/app/Extend/DataCollections.php index b4b21ca2..f20d903f 100644 --- a/app/Extend/DataCollections.php +++ b/app/Extend/DataCollections.php @@ -50,11 +50,11 @@ protected static function getTypedYaml(string $name): static protected static function getTypedMarkdown(string $name): static { $className = self::getCallableTypeClassName($name); - - return parent::markdown($name)->map(fn (MarkdownDocument $document) => new $className(array_merge( - $document->matter()->toArray(), - ['markdown' => $document->markdown()->body()] - ))); + return parent::markdown($name)->reject(fn (MarkdownDocument $document, string $key) => basename($key) === 'README.md') // Patch until https://github.com/hydephp/develop/issues/1716 + ->map(fn (MarkdownDocument $document) => new $className(array_merge( + $document->matter()->toArray(), + ['markdown' => $document->markdown()->body()] + ))); } protected static function getTypePath(string $name): string @@ -85,6 +85,8 @@ class_alias($newClassName, $className); protected static function findFiles(string $name, array|string $extensions): Collection { + // Depends on https://github.com/hydephp/develop/issues/1716 + return parent::findFiles($name, $extensions)->reject(fn (string $file) => basename($file) === 'README.md'); } }