Skip to content

Commit be6c210

Browse files
committed
Since dependencies must be arrays, ensure they are if not a callable.
In set_dependencies, if the first argument is not a callable, cast it to an array when we assign it to the class property. In get_dependencies, cast the return value to an array. Issue: #37
1 parent 8e09adf commit be6c210

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Assets/Asset.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,7 @@ public function get_dependencies(): array {
878878
);
879879
}
880880

881-
return $dependencies;
881+
return (array) $dependencies;
882882
}
883883

884884
/**
@@ -1791,7 +1791,7 @@ public function set_dependencies( ...$dependencies ) {
17911791
if ( $dependencies[0] && is_callable( $dependencies[0] ) ) {
17921792
$this->dependencies = $dependencies[0];
17931793
} else {
1794-
$this->dependencies = $dependencies;
1794+
$this->dependencies = (array) $dependencies;
17951795
}
17961796

17971797
return $this;

0 commit comments

Comments
 (0)