<?php

namespace AlgoWeb\PODataLaravel\Kernels;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel;

class ConsoleKernel extends Kernel
{
    /**
     * The bootstrap classes for the application.
     *
     * @var array
     */
    protected $bootstrappers = [
        'Illuminate\Foundation\Bootstrap\DetectEnvironment',
        'Illuminate\Foundation\Bootstrap\HandleExceptions',
        'Illuminate\Foundation\Bootstrap\RegisterFacades',
        'Illuminate\Foundation\Bootstrap\SetRequestForConsole',
        'Illuminate\Foundation\Bootstrap\RegisterProviders',
        'Illuminate\Foundation\Bootstrap\BootProviders',
    ];
}

<?php

namespace AlgoWeb\PODataLaravel\Kernels;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\Events\Dispatcher;

class ConsoleKernel extends Kernel
{
    protected $oldEnv = 'Illuminate\Foundation\Bootstrap\DetectEnvironment';
    protected $newEnv = 'Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables';
    protected $env;

    /**
     * The bootstrap classes for the application.
     *
     * @var array
     */
    protected $bootstrappers = [
        'Illuminate\Foundation\Bootstrap\HandleExceptions',
        'Illuminate\Foundation\Bootstrap\RegisterFacades',
        'Illuminate\Foundation\Bootstrap\SetRequestForConsole',
        'Illuminate\Foundation\Bootstrap\RegisterProviders',
        'Illuminate\Foundation\Bootstrap\BootProviders',
    ];

    /**
     * Create a new console kernel instance.
     *
     * @param  \Illuminate\Contracts\Foundation\Application  $app
     * @param  \Illuminate\Contracts\Events\Dispatcher  $events
     * @return void
     */
    public function __construct(Application $app, Dispatcher $events)
    {
        if (class_exists($this->oldEnv)) {
            $this->env = $this->oldEnv;
        } else {
            $this->env = $this->newEnv;
        }

        array_unshift($this->bootstrappers, $this->env);
        parent::__construct($app, $events);
    }
}

Make test skeleton bootstrappers polyglot across L5.1-5.4
Make test skeleton bootstrappers polyglot across L5.1-5.4
