fix: laravel 11 installation

This commit is contained in:
Younes ENNAJI
2024-03-16 15:13:41 +00:00
parent 8b29c02151
commit 176d88511e
4 changed files with 81 additions and 3 deletions
@@ -0,0 +1,28 @@
<?php
/*
* This file is part of the PHPFlasher package.
* (c) Younes KHOUBZA <younes.khoubza@gmail.com>
*/
namespace Flasher\Laravel\Bridge\Command;
use Flasher\Laravel\Support\Laravel;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
$class = Laravel::isVersion('11.0', '>=')
? 'Flasher\Laravel\Bridge\Typed\Command\FlasherCommand'
: 'Flasher\Laravel\Bridge\Legacy\Command\FlasherCommand';
class_alias($class, 'Flasher\Laravel\Bridge\Command\FlasherCommand');
if (false) { /** @phpstan-ignore-line */
abstract class FlasherCommand
{
/**
* @return int
*/
abstract protected function flasherExecute(InputInterface $input, OutputInterface $output);
}
}
@@ -0,0 +1,25 @@
<?php
/*
* This file is part of the PHPFlasher package.
* (c) Younes KHOUBZA <younes.khoubza@gmail.com>
*/
namespace Flasher\Laravel\Bridge\Legacy\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
abstract class FlasherCommand extends Command
{
protected function execute(InputInterface $input, OutputInterface $output)
{
return $this->flasherExecute($input, $output);
}
/**
* @return int
*/
abstract protected function flasherExecute(InputInterface $input, OutputInterface $output);
}
@@ -0,0 +1,25 @@
<?php
/*
* This file is part of the PHPFlasher package.
* (c) Younes KHOUBZA <younes.khoubza@gmail.com>
*/
namespace Flasher\Laravel\Bridge\Typed\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
abstract class FlasherCommand extends Command
{
protected function execute(InputInterface $input, OutputInterface $output): int
{
return $this->flasherExecute($input, $output);
}
/**
* @return int
*/
abstract protected function flasherExecute(InputInterface $input, OutputInterface $output);
}
+3 -3
View File
@@ -9,14 +9,14 @@ namespace Flasher\Laravel\Command;
use Flasher\Laravel\Support\ServiceProvider as FlasherServiceProvider;
use Flasher\Prime\Plugin\PluginInterface;
use Flasher\Symfony\Bridge\Command\FlasherCommand;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\Facades\App;
use Illuminate\Support\ServiceProvider;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class InstallCommand extends Command
class InstallCommand extends FlasherCommand
{
/**
* @return void
@@ -32,7 +32,7 @@ class InstallCommand extends Command
/**
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
protected function flasherExecute(InputInterface $input, OutputInterface $output)
{
$output->writeln('');
$output->writeln('<fg=blue;options=bold>