Replace Closure::fromCallable() usages with first-class callables

PHP 8.1 <3
This commit is contained in:
Dylan K. Taylor
2023-07-19 13:34:42 +01:00
parent fba51e3bf9
commit 537721fe7d
7 changed files with 16 additions and 19 deletions

View File

@ -1610,7 +1610,7 @@ class World implements ChunkManager{
* the current weather and time of day.
*/
public function getHighestAdjacentFullLightAt(int $x, int $y, int $z) : int{
return $this->getHighestAdjacentLight($x, $y, $z, \Closure::fromCallable([$this, 'getFullLightAt']));
return $this->getHighestAdjacentLight($x, $y, $z, $this->getFullLightAt(...));
}
/**
@ -1706,7 +1706,7 @@ class World implements ChunkManager{
* Returns the highest potential level of sky light in the positions adjacent to the specified block coordinates.
*/
public function getHighestAdjacentPotentialBlockSkyLight(int $x, int $y, int $z) : int{
return $this->getHighestAdjacentLight($x, $y, $z, \Closure::fromCallable([$this, 'getPotentialBlockSkyLightAt']));
return $this->getHighestAdjacentLight($x, $y, $z, $this->getPotentialBlockSkyLightAt(...));
}
/**
@ -1721,7 +1721,7 @@ class World implements ChunkManager{
* Returns the highest block light level available in the positions adjacent to the specified block coordinates.
*/
public function getHighestAdjacentBlockLight(int $x, int $y, int $z) : int{
return $this->getHighestAdjacentLight($x, $y, $z, \Closure::fromCallable([$this, 'getBlockLightAt']));
return $this->getHighestAdjacentLight($x, $y, $z, $this->getBlockLightAt(...));
}
private function executeQueuedLightUpdates() : void{