From 407aabee5c827c72cfcc10bf4ae39fc16c167248 Mon Sep 17 00:00:00 2001 From: Michael Sievenpiper Date: Fri, 15 May 2026 14:51:07 +0100 Subject: [PATCH] - php 8.4 deprecations and warnings --- composer.json | 2 +- phpunit.xml | 2 +- src/Console/Commands/BuiltInWebServer.php | 4 ++-- src/Console/Console.php | 4 ++-- src/Console/ConsoleCommand.php | 6 +++--- src/I18n/TranslationUpdater.php | 2 +- src/ViewModel/ArrayModel.php | 2 +- tests/Supporting/Console/TestExecuteConsoleCommand.php | 5 +++-- 8 files changed, 14 insertions(+), 13 deletions(-) diff --git a/composer.json b/composer.json index 73a987f..b40784f 100644 --- a/composer.json +++ b/composer.json @@ -32,7 +32,7 @@ "packaged/ui": "~1.0", "packaged/docblock": "~1.1", "packaged/i18n": "~1.2", - "symfony/console": "~4.2||~5.0", + "symfony/console": "~4.2||~5.0||~6.0||~7.0", "psr/log": "~1.1||^2.0||^3.0" }, "suggest": { diff --git a/phpunit.xml b/phpunit.xml index fdc0257..e38b9cc 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,5 +1,5 @@ - + src diff --git a/src/Console/Commands/BuiltInWebServer.php b/src/Console/Commands/BuiltInWebServer.php index 6b616f3..4bcf349 100644 --- a/src/Console/Commands/BuiltInWebServer.php +++ b/src/Console/Commands/BuiltInWebServer.php @@ -92,9 +92,9 @@ protected function configure() * @param InputInterface $input * @param OutputInterface $output * - * @return int|mixed|null + * @return int */ - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { if(empty($this->host)) { diff --git a/src/Console/Console.php b/src/Console/Console.php index 531d4a3..a2c4685 100644 --- a/src/Console/Console.php +++ b/src/Console/Console.php @@ -36,7 +36,7 @@ class Console extends Application implements ContextAware * @return integer 0 if everything went fine, or an error code * @throws \Throwable */ - public function doRun(InputInterface $input, OutputInterface $output) + public function doRun(InputInterface $input, OutputInterface $output): int { $this->configure($this->getContext()->config()); return parent::doRun($input, $output); @@ -145,7 +145,7 @@ protected function _prepareCommand(Command $command): Command * @return Command * @throws \Throwable */ - public function find($name) + public function find($name): Command { try { diff --git a/src/Console/ConsoleCommand.php b/src/Console/ConsoleCommand.php index 1b2c471..fdf5ced 100644 --- a/src/Console/ConsoleCommand.php +++ b/src/Console/ConsoleCommand.php @@ -214,9 +214,9 @@ protected function initialize(InputInterface $input, OutputInterface $output) * @param InputInterface $input * @param OutputInterface $output * - * @return int|mixed|null + * @return int */ - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $this->_input = $input; $this->_output = $output; @@ -241,7 +241,7 @@ protected function execute(InputInterface $input, OutputInterface $output) return $this->_execute($input, $output) ?? 0; } - protected function _execute(InputInterface $input, OutputInterface $output) + protected function _execute(InputInterface $input, OutputInterface $output): int { throw new \RuntimeException( "Your command must contain one of the following methods:\n" diff --git a/src/I18n/TranslationUpdater.php b/src/I18n/TranslationUpdater.php index bfbbe34..fdc6e2e 100644 --- a/src/I18n/TranslationUpdater.php +++ b/src/I18n/TranslationUpdater.php @@ -22,7 +22,7 @@ class TranslationUpdater implements CubexAware protected $_file; protected $_lang; - public function __construct(Cubex $cubex, MessageCatalog $catalog, $file, $lang, TranslationLogger $translationLogger = null) + public function __construct(Cubex $cubex, MessageCatalog $catalog, $file, $lang, ?TranslationLogger $translationLogger = null) { $this->_catalog = $catalog; $this->_file = $file; diff --git a/src/ViewModel/ArrayModel.php b/src/ViewModel/ArrayModel.php index d4cfa6c..6950bb7 100644 --- a/src/ViewModel/ArrayModel.php +++ b/src/ViewModel/ArrayModel.php @@ -17,7 +17,7 @@ public function set(array $data = []) return $this; } - public function addItem($value, string $key = null) + public function addItem($value, ?string $key = null) { if($key === null) { diff --git a/tests/Supporting/Console/TestExecuteConsoleCommand.php b/tests/Supporting/Console/TestExecuteConsoleCommand.php index da4c279..1def49b 100644 --- a/tests/Supporting/Console/TestExecuteConsoleCommand.php +++ b/tests/Supporting/Console/TestExecuteConsoleCommand.php @@ -33,9 +33,10 @@ class TestExecuteConsoleCommand extends ConsoleCommand * @param InputInterface $input * @param OutputInterface $output * - * @return void + * @return int */ - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { + return 0; } }