src/Config/Binding.php
public function decorate(callable $decorator): Binding
    {
        if (empty($this->definition->decorators)) {
            $this->definition->decorators = [];
        }
        
        $this->definition->decorators[] = new Decorator($decorator);
        
        return $this;
    }
public function decorate(callable $decorator): Binding
    {
        if (empty($this->definition->decorators)) {
            $this->definition->decorators = [];
        }
        
        $this->definition->decorators[] = new Decorator($decorator);
        
        return $this;
    }
public function decorate ( callable $ decorator ) : Binding { if ( empty ( $ this -> definition -> decorators ) ) { $ this -> definition -> decorators = [ ] ; } $ this -> definition -> decorators [ ] = new Decorator ( $ decorator ) ; return $ this ; }
Adds a decorator that is applied to the created object instance.

Decorators may return null (or not use return at all) to preserve the decorated object.

@param callable $decorator Decorator receives the object instance as first argument and must return an instance of the same type.
@return Binding
Adds a decorator that is applied to the created object instance .