From f46ab9429069896004d2e14bf3c67c1954754e75 Mon Sep 17 00:00:00 2001 From: cleeve Date: Thu, 27 Nov 2025 11:09:22 +0000 Subject: [PATCH 1/2] Fix deprecations --- src/Cache/EphemeralCache.php | 4 ++-- src/Console/Events/ConsoleEvent.php | 2 +- src/Console/Events/ConsolePrepareEvent.php | 2 +- src/Context/Events/ConsoleLaunchedEvent.php | 2 +- src/Cubex.php | 8 ++++---- src/Events/Handle/HandlerEvent.php | 2 +- src/Events/Handle/ResponseEvent.php | 2 +- src/ViewModel/TemplatedViewModel.php | 2 +- src/ViewModel/ViewModel.php | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Cache/EphemeralCache.php b/src/Cache/EphemeralCache.php index 9d7a61f..868fa79 100644 --- a/src/Cache/EphemeralCache.php +++ b/src/Cache/EphemeralCache.php @@ -25,7 +25,7 @@ public static function instance(): self * * @return mixed */ - public function retrieve($key, callable $producer, int $ttl = null) + public function retrieve($key, callable $producer, ?int $ttl = null) { if(!$this->has($key)) { @@ -39,7 +39,7 @@ public function has($key) return isset($this->_cache[$key]) && ($this->_cache[$key]['t'] === null || $this->_cache[$key]['t'] >= time()); } - public function set($key, $value, int $ttl = null) + public function set($key, $value, ?int $ttl = null) { $this->_cache[$key] = ['v' => $value, 't' => time() + $ttl]; return $this; diff --git a/src/Console/Events/ConsoleEvent.php b/src/Console/Events/ConsoleEvent.php index a7e73ba..8bbc029 100644 --- a/src/Console/Events/ConsoleEvent.php +++ b/src/Console/Events/ConsoleEvent.php @@ -9,7 +9,7 @@ abstract class ConsoleEvent extends ContextEvent { private $_console; - public static function i(Context $ctx, Console $console = null) + public static function i(Context $ctx, ?Console $console = null) { $event = parent::i($ctx); $event->_console = $console; diff --git a/src/Console/Events/ConsolePrepareEvent.php b/src/Console/Events/ConsolePrepareEvent.php index deeb52e..04dbffc 100644 --- a/src/Console/Events/ConsolePrepareEvent.php +++ b/src/Console/Events/ConsolePrepareEvent.php @@ -12,7 +12,7 @@ class ConsolePrepareEvent extends ConsoleEvent private $_output; public static function i( - Context $ctx, Console $console = null, InputInterface $input = null, OutputInterface $output = null + Context $ctx, ?Console $console = null, ?InputInterface $input = null, ?OutputInterface $output = null ) { $event = parent::i($ctx, $console); diff --git a/src/Context/Events/ConsoleLaunchedEvent.php b/src/Context/Events/ConsoleLaunchedEvent.php index f047a09..a13bc19 100644 --- a/src/Context/Events/ConsoleLaunchedEvent.php +++ b/src/Context/Events/ConsoleLaunchedEvent.php @@ -10,7 +10,7 @@ class ConsoleLaunchedEvent extends AbstractEvent private $_input; private $_output; - public function __construct(InputInterface $input = null, OutputInterface $output = null) + public function __construct(?InputInterface $input = null, ?OutputInterface $output = null) { parent::__construct(); $this->_input = $input; diff --git a/src/Cubex.php b/src/Cubex.php index 4976d4b..80fefcc 100644 --- a/src/Cubex.php +++ b/src/Cubex.php @@ -57,7 +57,7 @@ class Cubex extends DependencyInjector implements LoggerAwareInterface */ private $_hasShutdown; - public function __construct($projectRoot, ClassLoader $loader = null, $global = true) + public function __construct($projectRoot, ?ClassLoader $loader = null, $global = true) { $this->_projectRoot = $projectRoot; $this->_eventChannel = new Channel('cubex'); @@ -72,7 +72,7 @@ public function __construct($projectRoot, ClassLoader $loader = null, $global = } } - public static function withCustomContext(string $ctxClass, $projectRoot, ClassLoader $loader = null, $global = true) + public static function withCustomContext(string $ctxClass, $projectRoot, ?ClassLoader $loader = null, $global = true) { $c = new static($projectRoot, $loader, $global); $c->_contextClass = $ctxClass; @@ -213,7 +213,7 @@ public static function fromContext(Context $ctx, $fallbackToGlobal = true) * @return int * @throws Exception */ - public function cli(InputInterface $input = null, OutputInterface $output = null) + public function cli(?InputInterface $input = null, ?OutputInterface $output = null) { $input = $input ?? new ArgvInput(); $output = $output ?? new ConsoleOutput(); @@ -422,7 +422,7 @@ protected function _getSystemEnvironment() * @return bool true if shutdown has processed, false if shutdown has already been called. * @throws Exception */ - public function shutdown(bool $throwExceptions = null) + public function shutdown(?bool $throwExceptions = null) { if(!$this->_hasShutdown) { diff --git a/src/Events/Handle/HandlerEvent.php b/src/Events/Handle/HandlerEvent.php index 5b22898..ecc3312 100644 --- a/src/Events/Handle/HandlerEvent.php +++ b/src/Events/Handle/HandlerEvent.php @@ -9,7 +9,7 @@ abstract class HandlerEvent extends ContextEvent { private $_handler; - public static function i(Context $context, Handler $handler = null) + public static function i(Context $context, ?Handler $handler = null) { $event = parent::i($context); $event->_handler = $handler; diff --git a/src/Events/Handle/ResponseEvent.php b/src/Events/Handle/ResponseEvent.php index 4c17945..6d8d1b2 100644 --- a/src/Events/Handle/ResponseEvent.php +++ b/src/Events/Handle/ResponseEvent.php @@ -9,7 +9,7 @@ abstract class ResponseEvent extends HandlerEvent { private $_response; - public static function i(Context $context, Handler $handler = null, Response $response = null) + public static function i(Context $context, ?Handler $handler = null, ?Response $response = null) { $event = parent::i($context, $handler); $event->_response = $response; diff --git a/src/ViewModel/TemplatedViewModel.php b/src/ViewModel/TemplatedViewModel.php index 8b62286..3247ef1 100644 --- a/src/ViewModel/TemplatedViewModel.php +++ b/src/ViewModel/TemplatedViewModel.php @@ -42,7 +42,7 @@ protected function _attemptTemplateExtensions() return array_filter(array_merge($this->_variants, ['phtml'])); } - public function createView(string $overrideViewClass = null): ?View + public function createView(?string $overrideViewClass = null): ?View { if($overrideViewClass === null && empty($this->_defaultView)) { diff --git a/src/ViewModel/ViewModel.php b/src/ViewModel/ViewModel.php index a608e54..dd11f3f 100644 --- a/src/ViewModel/ViewModel.php +++ b/src/ViewModel/ViewModel.php @@ -34,7 +34,7 @@ public function setView(string $viewClass) return $this; } - public function createView(string $overrideViewClass = null): ?View + public function createView(?string $overrideViewClass = null): ?View { if($overrideViewClass === null && !empty($this->_defaultView)) { From c53cd84ebc6e56316b509b969d3612a4046751d7 Mon Sep 17 00:00:00 2001 From: cleeve Date: Thu, 27 Nov 2025 16:36:35 +0000 Subject: [PATCH 2/2] Raise minimum support to 8.2+ --- .github/workflows/unit-test.yml | 4 ++-- composer.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index ba43ed5..b240622 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -12,12 +12,12 @@ jobs: strategy: matrix: os: [ ubuntu-latest, windows-latest ] - php: [ '8.0', '8.1', '8.2', '8.3', '8.4' ] + php: [ '8.2', '8.3', '8.4' ] runs-on: ${{matrix.os}} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: shivammathur/setup-php@v2 with: php-version: ${{matrix.php}} diff --git a/composer.json b/composer.json index 479fb9b..e47efc7 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "optimize-autoloader": true }, "require": { - "php": "^8.0", + "php": "^8.2", "ext-json": "*", "packaged/config": "~1.5", "packaged/context": "^1.11",