Skip to content

Commit

Permalink
Remove no longer used event and fix feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
pyrech committed Apr 2, 2024
1 parent 1f77443 commit c39567d
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 23 deletions.
4 changes: 0 additions & 4 deletions doc/going-further/extending-castor/events.md
Expand Up @@ -30,10 +30,6 @@ function my_event_listener(AfterApplicationInitializationEvent|AfterExecuteTaskE

Here is the built-in events triggered by Castor:

* `Castor\Event\BeforeApplicationInitializationEvent`: This event is triggered
before the application has been initialized and before the task and context
has been looked at. It provides access to the `Application` instance;

* `Castor\Event\AfterApplicationInitializationEvent`: This event is triggered
after the application has been initialized. It provides access to the
`Application` instance and an array of `TaskDescriptor` objects;
Expand Down
4 changes: 0 additions & 4 deletions src/Console/Application.php
Expand Up @@ -15,7 +15,6 @@
use Castor\Descriptor\TaskDescriptor;
use Castor\Descriptor\TaskDescriptorCollection;
use Castor\Event\AfterApplicationInitializationEvent;
use Castor\Event\BeforeApplicationInitializationEvent;
use Castor\EventDispatcher;
use Castor\ExpressionLanguage;
use Castor\Fingerprint\FingerprintHelper;
Expand Down Expand Up @@ -134,9 +133,6 @@ public function doRun(InputInterface $input, OutputInterface $output): int
$this->symfonyStyle = new SymfonyStyle($input, $output);
$this->logger->pushHandler(new ConsoleHandler($output));

$event = new BeforeApplicationInitializationEvent($this);
$this->eventDispatcher->dispatch($event);

$descriptors = $this->initializeApplication($input);

// Must be done after the initializeApplication() call, to ensure all
Expand Down
13 changes: 0 additions & 13 deletions src/Event/BeforeApplicationInitializationEvent.php

This file was deleted.

1 change: 0 additions & 1 deletion src/functions-internal.php
Expand Up @@ -31,7 +31,6 @@ function fix_exception(\Exception $exception, int $depth = 0): \Exception
continue;
}
$r = new \ReflectionProperty(\Exception::class, $key);
$r->setAccessible(true);
$r->setValue($exception, $lastFrame[$key]);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Helper/OutputCleaner.php
Expand Up @@ -18,7 +18,7 @@ public static function cleanOutput(string $string): string
$string = preg_replace('{^\d\d:\d\d:\d\d }m', 'hh:mm:ss ', $string);

// Clean the warning on tasks when remote imports are disabled
$string = preg_replace('{\d{2}:\d{2}:\d{2} WARNING \[castor\] Could not import "[\w:/\.-]*" in "[\w:/\.-]*" on line \d+. Reason: Remote imports are disabled\.}m', '', $string);
$string = preg_replace('{hh:mm:ss WARNING \[castor\] Could not import "[\w:/\.-]*" in "[\w:/\.-]*" on line \d+. Reason: Remote imports are disabled\.}m', '', $string);

// Avoid spacing issues
$string = ltrim($string, "\n"); // Trim output start to avoid empty lines
Expand Down

0 comments on commit c39567d

Please sign in to comment.