mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-06 01:51:51 +00:00
BaseBanner: remove unnecessary array_filter() usage
This commit is contained in:
parent
a03013d582
commit
944dd7d3e4
@ -34,7 +34,6 @@ use pocketmine\math\AxisAlignedBB;
|
|||||||
use pocketmine\math\Vector3;
|
use pocketmine\math\Vector3;
|
||||||
use pocketmine\player\Player;
|
use pocketmine\player\Player;
|
||||||
use pocketmine\world\BlockTransaction;
|
use pocketmine\world\BlockTransaction;
|
||||||
use function array_filter;
|
|
||||||
use function assert;
|
use function assert;
|
||||||
use function count;
|
use function count;
|
||||||
|
|
||||||
@ -89,11 +88,12 @@ abstract class BaseBanner extends Transparent{
|
|||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setPatterns(array $patterns) : self{
|
public function setPatterns(array $patterns) : self{
|
||||||
$checked = array_filter($patterns, fn($v) => $v instanceof BannerPatternLayer);
|
foreach($patterns as $pattern){
|
||||||
if(count($checked) !== count($patterns)){
|
if(!$pattern instanceof BannerPatternLayer){
|
||||||
throw new \TypeError("Deque must only contain " . BannerPatternLayer::class . " objects");
|
throw new \TypeError("Array must only contain " . BannerPatternLayer::class . " objects");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$this->patterns = $checked;
|
$this->patterns = $patterns;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user