Skip to content

Improve support Symfony 7 #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions examples/ExampleCommand.php
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ protected function initialize(InputInterface $input, OutputInterface $output)
}

// Execute will be called in a endless loop
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
// Tell the user what we're going to do.
// This will be silenced by Symfony if the user doesn't want any output at all,
@@ -52,21 +52,23 @@ protected function execute(InputInterface $input, OutputInterface $output)
// Tell the user we're done
$output->writeln('done');
}

return self::SUCCESS;
}

/**
* Called after each iteration
* @param InputInterface $input
* @param OutputInterface $output
*/
protected function finishIteration(InputInterface $input, OutputInterface $output)
protected function finishIteration(InputInterface $input, OutputInterface $output): void
{
// Do some cleanup/memory management here, don't forget to call the parent implementation!
parent::finishIteration($input, $output);
}

// Called once on shutdown after the last iteration finished
protected function finalize(InputInterface $input, OutputInterface $output)
protected function finalize(InputInterface $input, OutputInterface $output): void
{
// Do some cleanup here, don't forget to call the parent implementation!
parent::finalize($input, $output);
2 changes: 1 addition & 1 deletion src/Wrep/Daemonizable/Command/EndlessCommand.php
Original file line number Diff line number Diff line change
@@ -244,7 +244,7 @@ public function setCode(callable $code): static
* @throws LogicException When this abstract method is not implemented
* @see setCode()
*/
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
return parent::execute($input, $output);
}
4 changes: 3 additions & 1 deletion tests/Wrep/Daemonizable/Command/EndlessCommandTest.php
Original file line number Diff line number Diff line change
@@ -110,8 +110,10 @@ public function testInterruptSigtermFromDifferentContext(): void
*/
class EndlessSelfTerminatingCommand extends EndlessCommand
{
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
posix_kill(posix_getpid(), SIGTERM);

return self::SUCCESS;
}
}