Skip to content

Nette\Utils\Strings::startsWith() wrong type argument given #1784

@einenlum

Description

@einenlum
Subject Details
PHP version e.g. PHP 7.3
Full Command docker run -v $(pwd):/project rector/rector:latest process /project/app --level laravel53 --dry-run -vvv

Current Behaviour

Fatal error: Uncaught TypeError: Argument 1 passed to Nette\Utils\Strings::startsWith() must be of the type string, int given, called in /rector/src/DependencyInjection/Loader/RectorServiceParametersShifter.php on line 119 and defined in /rector/vendor/nette/utils/src/Utils/Strings.php:61
Stack trace:
#0 /rector/src/DependencyInjection/Loader/RectorServiceParametersShifter.php(119): Nette\Utils\Strings::startsWith(0, '$')
#1 /rector/src/DependencyInjection/Loader/RectorServiceParametersShifter.php(68): Rector\DependencyInjection\Loader\RectorServiceParametersShifter->resolveRectorConfiguration(Array)
#2 /rector/src/DependencyInjection/Loader/RectorServiceParametersShifter.php(52): Rector\DependencyInjection\Loader\RectorServiceParametersShifter->processServices(Array)
#3 /rector/src/DependencyInjection/Loader/TolerantRectorYamlFileLoader.php(50): Rector\DependencyInjection\Loader\RectorServiceParametersShifter->process(Array)
#4 /rector/vendor/symplify/package-builder/src/Yaml/FileLoader/AbstractParameterMergingYamlFileLo in /rector/vendor/nette/utils/src/Utils/Strings.php on line 61

Minimal PHP Code Causing Issue

Tried with any file, but still the same error. A random example file:

<?php namespace App\Http\Middleware;

use Closure;
use Illuminate\Contracts\Auth\Guard;

class Authenticate
{

    /**
     * The Guard implementation.
     *
     * @var Guard
     */
    protected $auth;

    /**
     * Create a new filter instance.
     *
     * @param  Guard $auth
     *
     * @return void
     */
    public function __construct(Guard $auth)
    {
        $this->auth = $auth;
    }

    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request $request
     * @param  \Closure                 $next
     *
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        if (!\Illuminate\Support\Facades\App::make('foo.backend_user')->isValid()) {
            if ($request->ajax()) {
                return response('Unauthorized.', 401);
            } else {
                return redirect()->guest('/login');
            }
        }

        return $next($request);
    }

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions