-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #298 from jolicode/fix-update
Fix instruction for downloading new castor version as a phar
- Loading branch information
Showing
10 changed files
with
234 additions
and
95 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 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 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 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 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 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 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 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,43 @@ | ||
<?php | ||
|
||
namespace Castor\Listener; | ||
|
||
use Castor\Stub\StubsGenerator; | ||
use Symfony\Component\Console\ConsoleEvents; | ||
use Symfony\Component\Console\Event\ConsoleCommandEvent; | ||
use Symfony\Component\EventDispatcher\EventSubscriberInterface; | ||
|
||
class GenerateStubsListener implements EventSubscriberInterface | ||
{ | ||
public function __construct( | ||
private readonly StubsGenerator $stubsGenerator, | ||
private readonly string $rootDir, | ||
) { | ||
} | ||
|
||
public function generateStubs(ConsoleCommandEvent $event): void | ||
{ | ||
if (class_exists(\RepackedApplication::class)) { | ||
return; | ||
} | ||
|
||
$command = $event->getCommand(); | ||
if (!$command) { | ||
return; | ||
} | ||
if ('_complete' === $command->getName()) { | ||
return; | ||
} | ||
|
||
$this->stubsGenerator->generateStubsIfNeeded($this->rootDir . '/.castor.stub.php'); | ||
} | ||
|
||
public static function getSubscribedEvents(): array | ||
{ | ||
return [ | ||
// Must be before the command is executed, because we have to check | ||
// for many command options | ||
ConsoleEvents::COMMAND => 'generateStubs', | ||
]; | ||
} | ||
} |
Oops, something went wrong.