Skip to content

Commit

Permalink
🎨 add type hints to assets method
Browse files Browse the repository at this point in the history
  • Loading branch information
codepuncher committed Feb 28, 2024
1 parent 21f654d commit 700a8b2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand All @@ -254,7 +254,7 @@ public function enqueue()
* @param array $block
* @return void
*/
public function assets($block)
public function assets(array $block): void
{
//
}
Expand Down
7 changes: 4 additions & 3 deletions src/Console/UpgradeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]})",
];

Expand Down
2 changes: 1 addition & 1 deletion src/Console/stubs/block.construct.stub
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ class DummyClass extends Block
* @param array $block
* @return void
*/
public function assets($block)
public function assets(array $block): void
{
//
}
Expand Down
2 changes: 1 addition & 1 deletion src/Console/stubs/block.stub
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ class DummyClass extends Block
* @param array $block
* @return void
*/
public function assets($block)
public function assets(array $block): void
{
//
}
Expand Down

0 comments on commit 700a8b2

Please sign in to comment.