From 700a8b2ee78bfae102fd55976fc60979f64b9949 Mon Sep 17 00:00:00 2001 From: codepuncher Date: Wed, 28 Feb 2024 11:35:23 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20add=20type=20hints=20to=20`asset?= =?UTF-8?q?s`=20method?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Block.php | 4 ++-- src/Console/UpgradeCommand.php | 7 ++++--- src/Console/stubs/block.construct.stub | 2 +- src/Console/stubs/block.stub | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Block.php b/src/Block.php index 172f6388..8eeaf635 100644 --- a/src/Block.php +++ b/src/Block.php @@ -241,7 +241,7 @@ abstract class Block extends Composer implements BlockContract * * @return void * - * @deprecated Use `assets($block)` instead. + * @deprecated Use `assets(array $block): void` instead. */ public function enqueue() { @@ -254,7 +254,7 @@ public function enqueue() * @param array $block * @return void */ - public function assets($block) + public function assets(array $block): void { // } diff --git a/src/Console/UpgradeCommand.php b/src/Console/UpgradeCommand.php index a578a93c..d7f26017 100644 --- a/src/Console/UpgradeCommand.php +++ b/src/Console/UpgradeCommand.php @@ -42,9 +42,10 @@ public function handle() $this->replacements = [ 'use StoutLogic\\AcfBuilder\\FieldsBuilder;' => 'use Log1x\\AcfComposer\\Builder;', 'new FieldsBuilder(' => 'Builder::make(', - 'public function enqueue($block)' => 'public function assets($block)', - 'public function enqueue($block = [])' => 'public function assets($block)', - 'public function enqueue()' => 'public function assets($block)', + 'public function assets($block)' => 'public function assets(array $block)', + 'public function enqueue($block)' => 'public function assets(array $block)', + 'public function enqueue($block = [])' => 'public function assets(array $block)', + 'public function enqueue()' => 'public function assets(array $block)', '/->addFields\(\$this->get\((.*?)\)\)/' => fn ($match) => "->addPartial({$match[1]})", ]; diff --git a/src/Console/stubs/block.construct.stub b/src/Console/stubs/block.construct.stub index e3bcaa6c..c9049973 100644 --- a/src/Console/stubs/block.construct.stub +++ b/src/Console/stubs/block.construct.stub @@ -200,7 +200,7 @@ class DummyClass extends Block * @param array $block * @return void */ - public function assets($block) + public function assets(array $block): void { // } diff --git a/src/Console/stubs/block.stub b/src/Console/stubs/block.stub index 15ace2f7..74376405 100644 --- a/src/Console/stubs/block.stub +++ b/src/Console/stubs/block.stub @@ -197,7 +197,7 @@ class DummyClass extends Block * @param array $block * @return void */ - public function assets($block) + public function assets(array $block): void { // }