public function addCasters(array $casters)
    {
        foreach ($casters as $type => $callback) {
            $closure = &$this->casters[$type][];
            $closure = $callback instanceof \Closure ? $callback : static function (...$args) use ($callback, &$closure) {
                return ($closure = \Closure::fromCallable($callback))(...$args);
            };
        }
    }
public function addCasters(array $casters)
    {
        foreach ($casters as $type => $callback) {
            $closure = &$this->casters[$type][];
            $closure = $callback instanceof \Closure ? $callback : static function (...$args) use ($callback, &$closure) {
                return ($closure = \Closure::fromCallable($callback))(...$args);
            };
        }
    }
public function addCasters ( array $ casters ) { foreach ( $ casters as $ type => $ callback ) { $ closure = & $ this -> casters [ $ type ] [ ] ; $ closure = $ callback instanceof \ Closure ? $ callback : static function ( ... $ args ) use ( $ callback , & $ closure ) { return ( $ closure = \ Closure :: fromCallable ( $ callback ) ) ( ... $ args ) ; } ; } }
Adds casters for resources and objects.

Maps resources or objects types to a callback.
Types are in the key, with a callable caster for value.
Resource types are to be prefixed with a `:`,
see e.g. static::$defaultCasters.

@param callable[] $casters A map of casters
Adds casters for resources and objects .