public function _normalizeCallable($callable)
    {
        // Closure remains as such
        if ($callable instanceof Closure) {
            return $callable;
        }

        // Invocable objects take precedence over stringable ones
        if (!(is_object($callable) && is_callable($callable))) {
            try {
                // Strings that don't identify methods get normalized and returned
                $callable = $this->_normalizeString($callable);
                if (strpos($callable, '::', 1) === false) {
                    return $callable;
                }
            } catch (InvalidArgumentException $e) {
                // Continue
            }
        }

        // Everything else is a method
        return $this->_normalizeMethodCallable($callable);
    }
public function _normalizeCallable($callable)
    {
        // Closure remains as such
        if ($callable instanceof Closure) {
            return $callable;
        }

        // Invocable objects take precedence over stringable ones
        if (!(is_object($callable) && is_callable($callable))) {
            try {
                // Strings that don't identify methods get normalized and returned
                $callable = $this->_normalizeString($callable);
                if (strpos($callable, '::', 1) === false) {
                    return $callable;
                }
            } catch (InvalidArgumentException $e) {
                // Continue
            }
        }

        // Everything else is a method
        return $this->_normalizeMethodCallable($callable);
    }
public function _normalizeCallable ( $ callable ) { // Closure remains as such if ( $ callable instanceof Closure ) { return $ callable ; } // Invocable objects take precedence over stringable ones if ( ! ( is_object ( $ callable ) && is_callable ( $ callable ) ) ) { try { // Strings that don't identify methods get normalized and returned $ callable = $ this -> _normalizeString ( $ callable ) ; if ( strpos ( $ callable , '::' , 1 ) === false ) { return $ callable ; } } catch ( InvalidArgumentException $ e ) { // Continue } } // Everything else is a method return $ this -> _normalizeMethodCallable ( $ callable ) ; }
Normalizes a callable, such that it is possible to distinguish between function and method formats.

- 'MyClass:myMethod' -> ['MyClass', 'myMethod'].
- Closures remain closures.
- Invocable object -> [$object, '__invoke']
- An object that is both stringable and invocable will be treated as invocable.
- Arrays remain arrays, with normalization.

@param array|Stringable|string|object|Closure.

@since [*next-version*]

@throws InvalidArgumentException If the type of callable is wrong.
@throws OutOfRangeException      If the format of the callable is wrong.

@return array|Closure|string The normalized callable.
Normalizes a callable such that it is possible to distinguish between function and method formats .