-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix error in command in symfony application
- Loading branch information
1 parent
1385aec
commit dee8fbc
Showing
5 changed files
with
82 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,6 +43,6 @@ | |
"psr-4": { "IQ2i\\DataImporter\\Tests\\": "tests" } | ||
}, | ||
"bin": [ | ||
"bin/dataimporter" | ||
"dataimporter" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
error_reporting(E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED); | ||
set_error_handler(static function ($severity, $message, $file, $line) { | ||
if ($severity & error_reporting()) { | ||
throw new ErrorException($message, 0, $severity, $file, $line); | ||
} | ||
}); | ||
|
||
// check environment requirements | ||
(function () { | ||
if (\PHP_VERSION_ID < 80100 || \PHP_VERSION_ID >= 80400) { | ||
fwrite(STDERR, "PHP needs to be a minimum version of PHP 7.4.0 and maximum version of PHP 8.3.*.\n"); | ||
fwrite(STDERR, 'Current PHP version: '.PHP_VERSION.".\n"); | ||
|
||
exit(1); | ||
} | ||
|
||
if (!ini_get('date.timezone')) { | ||
ini_set('date.timezone', 'UTC'); | ||
} | ||
})(); | ||
|
||
// load dependencies | ||
(function () { | ||
$possibleFiles = [__DIR__.'/../../autoload.php', __DIR__.'/../autoload.php', __DIR__.'/vendor/autoload.php']; | ||
$file = null; | ||
foreach ($possibleFiles as $possibleFile) { | ||
if (file_exists($possibleFile)) { | ||
$file = $possibleFile; | ||
|
||
break; | ||
} | ||
} | ||
|
||
if (null === $file) { | ||
throw new RuntimeException('Unable to locate autoload.php file.'); | ||
} | ||
|
||
require_once $file; | ||
})(); | ||
|
||
use IQ2i\DataImporter\Bundle\Console\Application; | ||
|
||
$application = new Application(); | ||
$application->run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the DataImporter package. | ||
* | ||
* (c) Loïc Sapone <loic@sapone.fr> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace IQ2i\DataImporter\Bundle\Console; | ||
|
||
use IQ2i\DataImporter\Command\GenerateDtoCommand; | ||
use Symfony\Component\Console\Application as BaseApplication; | ||
|
||
class Application extends BaseApplication | ||
{ | ||
public function __construct() | ||
{ | ||
parent::__construct('DataImporter'); | ||
|
||
$generateDtoCommand = new GenerateDtoCommand(); | ||
|
||
$this->add($generateDtoCommand); | ||
$this->setDefaultCommand($generateDtoCommand->getName(), true); | ||
} | ||
} |