Skip to content

Commit dc496b8

Browse files
muhammetsafakclaude
andcommitted
fix: make Application constructor/run params explicitly nullable
PHP 8.4 deprecates implicitly-nullable parameters (a typed parameter with a `null` default). `Application::__construct()`'s $output and `Application::run()`'s $argv used `Type $x = null`, which tripped the PHPStan 8.4 job in CI. Prefix both with `?` (valid since PHP 7.1, so the >=7.2 floor is unaffected). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent b8c7f92 commit dc496b8

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/Application.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class Application
8383
* @param string $version Application version string.
8484
* @param Output|null $output Output implementation; a default {@see Output} is created when null.
8585
*/
86-
public function __construct(string $application = 'InitPHP Console Application', string $version = self::VERSION, Output $output = null)
86+
public function __construct(string $application = 'InitPHP Console Application', string $version = self::VERSION, ?Output $output = null)
8787
{
8888
$this->application = $application;
8989
$this->version = $version;
@@ -144,7 +144,7 @@ public function register(string $command, ?callable $execute = null, string $def
144144
* @param array<int, string>|null $argv Tokens to dispatch; defaults to the global `$argv`.
145145
* @return bool `true` when a command (or help) ran, `false` when nothing matched or no command was given.
146146
*/
147-
public function run(array $argv = null): bool
147+
public function run(?array $argv = null): bool
148148
{
149149
if ($argv === null) {
150150
$argv = \is_array($GLOBALS['argv'] ?? null) ? $GLOBALS['argv'] : [];

0 commit comments

Comments
 (0)