src/Container.php
public function eachMarked(callable $callback, $result = null)
    {
        $ref = new \ReflectionFunction($callback);
        $params = $ref->getParameters();
        
        if (\count($params) < 2) {
            throw new \InvalidArgumentException(\sprintf('Callback for marker processing must declare at least 2 arguments (object and marker)'));
        }
        
        try {
            $markerType = $params[1]->getClass();
        } catch (\ReflectionException $e) {
            throw new \InvalidArgumentException(\sprintf('Marker class not found: %s', $params[1]->getType()), 0, $e);
        }
        
        if ($markerType === null) {
            throw new \InvalidArgumentException(\sprintf('Argument #2 of marker callback needs to declare a type-hint for the marker'));
        }
        
        $marker = $markerType->getName();
        
        if (!$markerType->isSubclassOf(Marker::class)) {
            throw new \InvalidArgumentException(\sprintf('Marker implementation %s must extend %s', $marker, Marker::class));
        }
        
        if (!isset($this->marked[$marker])) {
            $this->cacheMarkers($marker);
        }
        
        foreach ($this->marked[$marker] as list ($definition, $registration)) {
            $result = $callback($this->shared[$definition->typeName] ?? $this->get($definition->typeName), clone $registration, $result);
        }
        
        return $result;
    }
public function eachMarked(callable $callback, $result = null)
    {
        $ref = new \ReflectionFunction($callback);
        $params = $ref->getParameters();
        
        if (\count($params) < 2) {
            throw new \InvalidArgumentException(\sprintf('Callback for marker processing must declare at least 2 arguments (object and marker)'));
        }
        
        try {
            $markerType = $params[1]->getClass();
        } catch (\ReflectionException $e) {
            throw new \InvalidArgumentException(\sprintf('Marker class not found: %s', $params[1]->getType()), 0, $e);
        }
        
        if ($markerType === null) {
            throw new \InvalidArgumentException(\sprintf('Argument #2 of marker callback needs to declare a type-hint for the marker'));
        }
        
        $marker = $markerType->getName();
        
        if (!$markerType->isSubclassOf(Marker::class)) {
            throw new \InvalidArgumentException(\sprintf('Marker implementation %s must extend %s', $marker, Marker::class));
        }
        
        if (!isset($this->marked[$marker])) {
            $this->cacheMarkers($marker);
        }
        
        foreach ($this->marked[$marker] as list ($definition, $registration)) {
            $result = $callback($this->shared[$definition->typeName] ?? $this->get($definition->typeName), clone $registration, $result);
        }
        
        return $result;
    }
Invoke the given closure for each registered marker of the matching type.

The callback needs to declare at least 2 arguments
<ol>
<li>The fully-qualified name of the bound type.</li>
<li>A type-hint that determines the marker.</li>
<li>The input value (will be replaced with the value returned by the selector).</li>
</ol>

@param callable $callback Selection callback.
@param mixed $input Initial input value.
@return mixed The result as transformed by the callback

@throws \InvalidArgumentException