Centralize deprecated check

This commit is contained in:
Philipp 2025-01-05 23:12:22 +01:00
parent 77c9f54f5c
commit b9dde78466
No known key found for this signature in database
GPG key ID: 24A7501396EB5432
4 changed files with 15 additions and 9 deletions

View file

@ -23,4 +23,16 @@ abstract class AbstractConsole extends Console
* @var string
*/
public const LOG_CHANNEL = LogChannel::CONSOLE;
/**
* Checks, if the Console command was executed outside of`bin/console.php` and prints the correct execution
*
* @param string $command the current command
*/
protected function checkDeprecated(string $command): void
{
if (substr($this->executable, -strlen('bin/console.php')) !== 'bin/console.php') {
$this->out(sprintf("'%s' is deprecated and will removed. Please use 'bin/console.php %s' instead", $this->executable, $command));
}
}
}