From f61c0486773ee1e882e55a5bb76ec4aaf794bc2e Mon Sep 17 00:00:00 2001 From: markhuot Date: Tue, 8 Oct 2024 15:36:15 -0400 Subject: [PATCH] fixing some messy recursion and phpstan issues --- src/factories/MatrixField.php | 2 +- src/factories/MatrixFieldBlocks.php | 7 ++++++- src/factories/MatrixFieldEntries.php | 7 ++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/factories/MatrixField.php b/src/factories/MatrixField.php index 75083b7..d0fb3c4 100644 --- a/src/factories/MatrixField.php +++ b/src/factories/MatrixField.php @@ -19,6 +19,6 @@ public static function factory(): static return MatrixFieldBlocks::factory(); } - throw new \RuntimeException('bad version'); + throw new \RuntimeException('Craft Pest is not compatible with this version of Craft CMS.'); } } diff --git a/src/factories/MatrixFieldBlocks.php b/src/factories/MatrixFieldBlocks.php index 3c44d46..a578d87 100644 --- a/src/factories/MatrixFieldBlocks.php +++ b/src/factories/MatrixFieldBlocks.php @@ -7,10 +7,15 @@ use function markhuot\craftpest\helpers\base\version_greater_than_or_equal_to; -class MatrixFieldBlocks extends Field +class MatrixFieldBlocks extends MatrixField { protected $blockTypes = []; + public static function factory(): static + { + return new static; + } + public function blockTypes(...$blockTypes) { if (is_array($blockTypes[0])) { diff --git a/src/factories/MatrixFieldEntries.php b/src/factories/MatrixFieldEntries.php index f7377e2..dcc4812 100644 --- a/src/factories/MatrixFieldEntries.php +++ b/src/factories/MatrixFieldEntries.php @@ -4,13 +4,18 @@ use craft\fields\Matrix; -class MatrixFieldEntries extends Field +class MatrixFieldEntries extends MatrixField { /** * @var EntryType[] */ protected $entryTypes = []; + public static function factory(): static + { + return new static; + } + public function entryTypes(...$entryTypes) { if (is_array($entryTypes[0])) {