Avoid more $this refs on long-life closures

This commit is contained in:
Dylan K. Taylor
2021-05-06 14:27:56 +01:00
parent c356abb917
commit 7b2c6c5ceb
4 changed files with 11 additions and 8 deletions

View File

@ -49,8 +49,10 @@ class CraftingManager{
public function __construct(){
$this->recipeRegisteredCallbacks = new ObjectSet();
$this->furnaceRecipeManager = new FurnaceRecipeManager();
$this->furnaceRecipeManager->getRecipeRegisteredCallbacks()->add(function(FurnaceRecipe $recipe) : void{
foreach($this->recipeRegisteredCallbacks as $callback){
$recipeRegisteredCallbacks = $this->recipeRegisteredCallbacks;
$this->furnaceRecipeManager->getRecipeRegisteredCallbacks()->add(static function(FurnaceRecipe $recipe) use ($recipeRegisteredCallbacks) : void{
foreach($recipeRegisteredCallbacks as $callback){
$callback();
}
});