1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[ticket/17496] Fix Implicitly marking parameters as nullable PHP deprecations

Also use union types consistently instead of question marks.
Fixed with php-cs-fixer.

PHPBB-17496
This commit is contained in:
rxu
2025-04-15 12:14:21 +07:00
parent bdbd0be548
commit 7d1ae5bf19
64 changed files with 113 additions and 113 deletions

View File

@@ -29,7 +29,7 @@ class runtime_exception extends base
* @param \Exception|null $previous The previous runtime_exception used for the runtime_exception chaining.
* @param integer $code The Exception code.
*/
public function __construct($prefix, $message = '', array $parameters = [], \Exception $previous = null, $code = 0)
public function __construct($prefix, $message = '', array $parameters = [], \Exception|null $previous = null, $code = 0)
{
parent::__construct($prefix . $message, $parameters, $previous, $code);
}

View File

@@ -68,7 +68,7 @@ class extension_manager extends manager
* @param string $root_path phpBB root path
* @param config|null $config Config object
*/
public function __construct(installer $installer, driver_interface $cache, ext_manager $extension_manager, filesystem $filesystem, $package_type, $exception_prefix, $root_path, config $config = null)
public function __construct(installer $installer, driver_interface $cache, ext_manager $extension_manager, filesystem $filesystem, $package_type, $exception_prefix, $root_path, config|null $config = null)
{
$this->extension_manager = $extension_manager;
$this->filesystem = $filesystem;
@@ -86,7 +86,7 @@ class extension_manager extends manager
/**
* {@inheritdoc}
*/
public function pre_install(array $packages, IOInterface $io = null)
public function pre_install(array $packages, IOInterface|null $io = null)
{
$installed_manually = array_intersect(array_keys($this->extension_manager->all_available()), array_keys($packages));
if (count($installed_manually) !== 0)
@@ -98,7 +98,7 @@ class extension_manager extends manager
/**
* {@inheritdoc}
*/
public function post_install(array $packages, IOInterface $io = null)
public function post_install(array $packages, IOInterface|null $io = null)
{
if ($this->enable_on_install)
{
@@ -127,7 +127,7 @@ class extension_manager extends manager
/**
* {@inheritdoc}
*/
protected function pre_update(array $packages, IOInterface $io = null)
protected function pre_update(array $packages, IOInterface|null $io = null)
{
/** @psalm-suppress InvalidArgument */
$io->writeError([['DISABLING_EXTENSIONS', [], 1]]);
@@ -158,7 +158,7 @@ class extension_manager extends manager
/**
* {@inheritdoc}
*/
protected function post_update(array $packages, IOInterface $io = null)
protected function post_update(array $packages, IOInterface|null $io = null)
{
/** @psalm-suppress InvalidArgument */
$io->writeError([['ENABLING_EXTENSIONS', [], 1]]);
@@ -184,7 +184,7 @@ class extension_manager extends manager
/**
* {@inheritdoc}
*/
public function remove(array $packages, IOInterface $io = null)
public function remove(array $packages, IOInterface|null $io = null)
{
$packages = $this->normalize_version($packages);
@@ -200,7 +200,7 @@ class extension_manager extends manager
/**
* {@inheritdoc}
*/
public function pre_remove(array $packages, IOInterface $io = null)
public function pre_remove(array $packages, IOInterface|null $io = null)
{
if ($this->purge_on_remove)
{

View File

@@ -101,7 +101,7 @@ class installer
* @param request $request phpBB request object
* @param config|null $config Config object
*/
public function __construct($root_path, filesystem $filesystem, request $request, config $config = null)
public function __construct($root_path, filesystem $filesystem, request $request, config|null $config = null)
{
if ($config)
{
@@ -135,7 +135,7 @@ class installer
*
* @throws runtime_exception
*/
public function install(array $packages, $whitelist, IOInterface $io = null)
public function install(array $packages, $whitelist, IOInterface|null $io = null)
{
$this->wrap(function() use ($packages, $whitelist, $io) {
$this->do_install($packages, $whitelist, $io);
@@ -155,7 +155,7 @@ class installer
* @throws runtime_exception
* @throws JsonValidationException
*/
protected function do_install(array $packages, $whitelist, io\io_interface $io = null)
protected function do_install(array $packages, $whitelist, io\io_interface|null $io = null)
{
if (!$io)
{
@@ -232,7 +232,7 @@ class installer
* @return Composer|PartialComposer
* @throws JsonValidationException
*/
protected function get_composer(?string $config_file): PartialComposer
protected function get_composer(string|null $config_file): PartialComposer
{
static $composer_factory;
if (!$composer_factory)

View File

@@ -46,7 +46,7 @@ class html_output_formatter extends \Composer\Console\HtmlOutputFormatter
/**
* {@inheritdoc}
*/
public function format(?string $message): ?string
public function format(string|null $message): string|null
{
$formatted = parent::format($message);

View File

@@ -28,7 +28,7 @@ class web_io extends BufferIO implements io_interface
* @param int $verbosity Verbosity level
* @param OutputFormatterInterface|null $formatter Output formatter
*/
public function __construct(language $language, $input = '', $verbosity = StreamOutput::VERBOSITY_NORMAL, OutputFormatterInterface $formatter = null)
public function __construct(language $language, $input = '', $verbosity = StreamOutput::VERBOSITY_NORMAL, OutputFormatterInterface|null $formatter = null)
{
$this->language = $language;

View File

@@ -74,7 +74,7 @@ class manager implements manager_interface
/**
* {@inheritdoc}
*/
public function install(array $packages, IOInterface $io = null)
public function install(array $packages, IOInterface|null $io = null)
{
$packages = $this->normalize_version($packages);
@@ -103,7 +103,7 @@ class manager implements manager_interface
* Each entry may be a name or an array associating a version constraint to a name
* @param IOInterface|null $io IO object used for the output
*/
protected function pre_install(array $packages, IOInterface $io = null)
protected function pre_install(array $packages, IOInterface|null $io = null)
{
}
@@ -114,14 +114,14 @@ class manager implements manager_interface
* Each entry may be a name or an array associating a version constraint to a name
* @param IOInterface|null $io IO object used for the output
*/
protected function post_install(array $packages, IOInterface $io = null)
protected function post_install(array $packages, IOInterface|null $io = null)
{
}
/**
* {@inheritdoc}
*/
public function update(array $packages, IOInterface $io = null)
public function update(array $packages, IOInterface|null $io = null)
{
$packages = $this->normalize_version($packages);
@@ -148,7 +148,7 @@ class manager implements manager_interface
* Each entry may be a name or an array associating a version constraint to a name
* @param IOInterface|null $io IO object used for the output
*/
protected function pre_update(array $packages, IOInterface $io = null)
protected function pre_update(array $packages, IOInterface|null $io = null)
{
}
@@ -159,14 +159,14 @@ class manager implements manager_interface
* Each entry may be a name or an array associating a version constraint to a name
* @param IOInterface|null $io IO object used for the output
*/
protected function post_update(array $packages, IOInterface $io = null)
protected function post_update(array $packages, IOInterface|null $io = null)
{
}
/**
* {@inheritdoc}
*/
public function remove(array $packages, IOInterface $io = null)
public function remove(array $packages, IOInterface|null $io = null)
{
$packages = $this->normalize_version($packages);
@@ -195,7 +195,7 @@ class manager implements manager_interface
* Each entry may be a name or an array associating a version constraint to a name
* @param IOInterface|null $io IO object used for the output
*/
protected function pre_remove(array $packages, IOInterface $io = null)
protected function pre_remove(array $packages, IOInterface|null $io = null)
{
}
@@ -206,7 +206,7 @@ class manager implements manager_interface
* Each entry may be a name or an array associating a version constraint to a name
* @param IOInterface|null $io IO object used for the output
*/
protected function post_remove(array $packages, IOInterface $io = null)
protected function post_remove(array $packages, IOInterface|null $io = null)
{
}

View File

@@ -30,7 +30,7 @@ interface manager_interface
*
* @throws runtime_exception
*/
public function install(array $packages, IOInterface $io = null);
public function install(array $packages, IOInterface|null $io = null);
/**
* Updates or installs a set of packages
@@ -41,7 +41,7 @@ interface manager_interface
*
* @throws runtime_exception
*/
public function update(array $packages, IOInterface $io = null);
public function update(array $packages, IOInterface|null $io = null);
/**
* Removes a set of packages
@@ -52,7 +52,7 @@ interface manager_interface
*
* @throws runtime_exception
*/
public function remove(array $packages, IOInterface $io = null);
public function remove(array $packages, IOInterface|null $io = null);
/**
* Tells whether or not a package is managed by Composer.