10.0 | New Extension Architecture
To allows dependencies reduction (#217) and load only what final User have really needed, we must have a new Extension system.
With current versions 9.x we have officially 4 extensions :
- OutputFormat to handle how results are rendered to Users
- ProgressBar to display a progress bar (Symfony Console Helper)
- ProgressIndicator to display a progress indicator Symfony Console Helper
- ProgressPrinter to display progression with dots (telling us if file is in error/warning or syntaxically correct); Same kind of display we can have with PHPUnit.
With version 10.0, I will introduces :
- only two extensions : one to handle all kinds of progress bars and another one to handle all kinds of result reporters
- add a new extension to handle cache system (currently with Symfony Cache Component
The new Extension system will be in charge (for each extension) to :
- define new console arguments and options to add on fly to the
lintcommand - define additional new console commands (something like Composer do with Command Provider feature)
Base of new Extension architecture was introduced by commit https://github.com/overtrue/phplint/commit/a8f7beffcdf096470d31de6be0cc2f52e72c4dd8
Learn more with documentation at https://github.com/overtrue/phplint/blob/10.0/docs/architecture/extension.md
Base code of new Extension Architecture (with previous commit https://github.com/overtrue/phplint/commit/a8f7beffcdf096470d31de6be0cc2f52e72c4dd8) was not enough to solve all situations.
Particulary if developer missed to add default command but used it.
Look deeply into binary launcher code, and if we forget this line
https://github.com/overtrue/phplint/blob/a8f7beffcdf096470d31de6be0cc2f52e72c4dd8/phplint.php#L56
Then, you'll have following Fatal error raised
Fatal error: Uncaught Symfony\Component\Console\Exception\CommandNotFoundException: Command "lint" is not defined.
Did you mean this?
list in /shared/backups/github/phplint-10.x/vendor/symfony/console/Application.php on line 737
Symfony\Component\Console\Exception\CommandNotFoundException: Command "lint" is not defined.
Did you mean this?
list in /shared/backups/github/phplint-10.x/vendor/symfony/console/Application.php on line 737
Call Stack:
0.0007 937336 1. {main}() /shared/backups/github/phplint-10.x/bin/phplint:0
0.0059 1468688 2. require_once('/shared/backups/github/phplint-10.x/phplint.php') /shared/backups/github/phplint-10.x/bin/phplint:16
0.1131 4544856 3. Overtrue\PHPLint\Console\Application->addExtensions($extensions = [0 => class Overtrue\PHPLint\Extension\OutputManager { private array $handlers = [...] }, 1 => class Overtrue\PHPLint\Extension\ProgressManager { protected bool $hasProcessHelper = *uninitialized*; protected Overtrue\PHPLint\Output\ConsoleOutputInterface $output = *uninitialized* }]) /shared/backups/github/phplint-10.x/phplint.php:29
0.1131 4544856 4. Overtrue\PHPLint\Console\Application->getDefaultCommand() /shared/backups/github/phplint-10.x/src/Console/Application.php:77
0.1131 4544856 5. Symfony\Component\Console\Application->find($name = 'lint') /shared/backups/github/phplint-10.x/src/Console/Application.php:120
After applying commit https://github.com/overtrue/phplint/commit/cbce982caa2012f0a3c0a94d54c0b7b833538899 we have same behaviour as if we did in PHPLint 9.x context (not affected by this issue)
If we run (binary launcher phplint) on interactive mode (default), we will have :
And if we run (binary launcher phplint -n) on non interactive mode, we will have :