public static function withExpectedType(
        $target,
        string $method,
        int $argument,
        string $expectedType,
        $value
    ): self {
        if ('object' === $type = gettype($value)) {
            $type = get_class($value);
        }

        return new self(sprintf(
            'Method %s::%s() expects argument %d to be %s, %s given.',
            get_class($target),
            $method,
            $argument,
            $expectedType,
            $type
        ));
    }
public static function withExpectedType(
        $target,
        string $method,
        int $argument,
        string $expectedType,
        $value
    ): self {
        if ('object' === $type = gettype($value)) {
            $type = get_class($value);
        }

        return new self(sprintf(
            'Method %s::%s() expects argument %d to be %s, %s given.',
            get_class($target),
            $method,
            $argument,
            $expectedType,
            $type
        ));
    }
public static function withExpectedType ( $ target , string $ method , int $ argument , string $ expectedType , $ value ) : self { if ( 'object' === $ type = gettype ( $ value ) ) { $ type = get_class ( $ value ) ; } return new self ( sprintf ( 'Method %s::%s() expects argument %d to be %s, %s given.' , get_class ( $ target ) , $ method , $ argument , $ expectedType , $ type ) ) ; }
Creates an instance for an invalid argument in a method call.

@param object $target
@param string $method
@param int    $argument
@param string $expectedType
@param mixed  $value

@return self
Creates an instance for an invalid argument in a method call .