Skip to content

Commit 7f681e5

Browse files
committed
amend register_in_wp
1 parent 88338ec commit 7f681e5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Assets/Assets.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ public function register_in_wp( $assets = null ) {
691691
)
692692
) {
693693
// Registering the asset now would trigger a doing_it_wrong notice: queue the assets to be registered later.
694-
if ( $assets === null ) {
694+
if ( $assets === null || empty( $assets ) ) {
695695
return;
696696
}
697697

@@ -711,14 +711,18 @@ public function register_in_wp( $assets = null ) {
711711
return;
712712
}
713713

714-
if ( is_null( $assets ) ) {
714+
if ( null === $assets ) {
715715
$assets = $this->get();
716716
}
717717

718718
if ( ! is_array( $assets ) ) {
719719
$assets = [ $assets ];
720720
}
721721

722+
if ( empty( $assets ) ) {
723+
return;
724+
}
725+
722726
foreach ( $assets as $asset ) {
723727
if ( ! $asset instanceof Asset ) {
724728
throw new InvalidArgumentException( 'Assets in register_in_wp() must be of type Asset' );

0 commit comments

Comments
 (0)