From f934948559b7a446dd3275ecaa1705d115070509 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Wed, 25 Aug 2021 01:42:16 +0100 Subject: [PATCH] Revert "Ensure a talk has a title" This reverts commit 3ea01ec8112cf4f899994b6d81a23bffe75d5b92. --- src/TwigExtension/TalkExtension.php | 13 +------------ tests/TalkExtensionTest.php | 2 +- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/src/TwigExtension/TalkExtension.php b/src/TwigExtension/TalkExtension.php index e02bb062..aef6094e 100644 --- a/src/TwigExtension/TalkExtension.php +++ b/src/TwigExtension/TalkExtension.php @@ -7,7 +7,6 @@ namespace App\TwigExtension; use Illuminate\Support\Collection; use Twig\Extension\AbstractExtension; use Twig\TwigFunction; -use Webmozart\Assert\Assert; final class TalkExtension extends AbstractExtension { @@ -28,16 +27,6 @@ final class TalkExtension extends AbstractExtension $talkCollection = new Collection($talks); return $talkCollection - ->map(fn($talk): array => (array) $talk['events']) - ->filter(function (array $event): bool { - try { - Assert::keyExists($event, 'title'); - - return true; - } - catch (\RuntimeException $e) { - return false; - } - }); + ->flatMap(fn($talk): array => (array) $talk['events']); } } diff --git a/tests/TalkExtensionTest.php b/tests/TalkExtensionTest.php index faa0ecf4..7b1bc4c5 100644 --- a/tests/TalkExtensionTest.php +++ b/tests/TalkExtensionTest.php @@ -27,7 +27,7 @@ final class TalkExtensionTest extends TestCase [ 'title' => 'Building static sites with Sculpin', 'events' => [ - 'title' => 'Building static websites with Sculpin', + '', ] ], ];