diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 030fd17d0c..c5e60b497d 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -130,7 +130,7 @@ function phpbb_gmgetdate($time = false) * * @return array|string data array if $string_only is false */ -function get_formatted_filesize($value, bool $string_only = true, array $allowed_units = null) +function get_formatted_filesize($value, bool $string_only = true, array|null $allowed_units = null) { global $user; @@ -253,7 +253,7 @@ function still_on_time($extra_time = 15) * @return mixed Boolean (true, false) if comparison operator is specified. * Integer (-1, 0, 1) otherwise. */ -function phpbb_version_compare(string $version1, string $version2, string $operator = null) +function phpbb_version_compare(string $version1, string $version2, string|null $operator = null) { $version1 = strtolower($version1); $version2 = strtolower($version2); diff --git a/phpBB/includes/functions_acp.php b/phpBB/includes/functions_acp.php index a3bae23ab5..3a3dc080d0 100644 --- a/phpBB/includes/functions_acp.php +++ b/phpBB/includes/functions_acp.php @@ -215,7 +215,7 @@ function adm_back_link($u_action) * * @return array */ -function build_select(array $options_ary, int|string|bool $option_default = false): array +function build_select(array $options_ary, bool|int|string $option_default = false): array { global $language; diff --git a/phpBB/phpbb/avatar/driver/driver.php b/phpBB/phpbb/avatar/driver/driver.php index 03c4790a6e..4e6f588f4a 100644 --- a/phpBB/phpbb/avatar/driver/driver.php +++ b/phpBB/phpbb/avatar/driver/driver.php @@ -82,7 +82,7 @@ abstract class driver implements \phpbb\avatar\driver\driver_interface * @param \phpbb\path_helper $path_helper phpBB path helper * @param \phpbb\cache\driver\driver_interface|null $cache Cache driver */ - public function __construct(\phpbb\config\config $config, \FastImageSize\FastImageSize $imagesize, $phpbb_root_path, $php_ext, \phpbb\path_helper $path_helper, \phpbb\cache\driver\driver_interface $cache = null) + public function __construct(\phpbb\config\config $config, \FastImageSize\FastImageSize $imagesize, $phpbb_root_path, $php_ext, \phpbb\path_helper $path_helper, \phpbb\cache\driver\driver_interface|null $cache = null) { $this->config = $config; $this->imagesize = $imagesize; diff --git a/phpBB/phpbb/ban/type/email.php b/phpBB/phpbb/ban/type/email.php index 213084fc24..5eef248eb3 100644 --- a/phpBB/phpbb/ban/type/email.php +++ b/phpBB/phpbb/ban/type/email.php @@ -28,7 +28,7 @@ class email extends base /** * {@inheritDoc} */ - public function get_user_column(): ?string + public function get_user_column(): string|null { return 'user_email'; } diff --git a/phpBB/phpbb/ban/type/ip.php b/phpBB/phpbb/ban/type/ip.php index 7f8c6ee81d..6dfa807a30 100644 --- a/phpBB/phpbb/ban/type/ip.php +++ b/phpBB/phpbb/ban/type/ip.php @@ -31,7 +31,7 @@ class ip extends base /** * @inheritDoc */ - public function get_user_column(): ?string + public function get_user_column(): string|null { return null; } diff --git a/phpBB/phpbb/ban/type/type_interface.php b/phpBB/phpbb/ban/type/type_interface.php index db86fc8ae7..346b57072e 100644 --- a/phpBB/phpbb/ban/type/type_interface.php +++ b/phpBB/phpbb/ban/type/type_interface.php @@ -33,7 +33,7 @@ interface type_interface * * @return string|null */ - public function get_user_column(): ?string; + public function get_user_column(): string|null; /** * Sets a user object to the ban type to have it excluded diff --git a/phpBB/phpbb/class_loader.php b/phpBB/phpbb/class_loader.php index 19242049aa..9f115a22ed 100644 --- a/phpBB/phpbb/class_loader.php +++ b/phpBB/phpbb/class_loader.php @@ -48,7 +48,7 @@ class class_loader * @param string $php_ext The file extension for PHP files * @param \phpbb\cache\driver\driver_interface|null $cache An implementation of the phpBB cache interface. */ - public function __construct($namespace, $path, $php_ext = 'php', \phpbb\cache\driver\driver_interface $cache = null) + public function __construct($namespace, $path, $php_ext = 'php', \phpbb\cache\driver\driver_interface|null $cache = null) { if ($namespace[0] !== '\\') { @@ -69,7 +69,7 @@ class class_loader * * @param \phpbb\cache\driver\driver_interface|null $cache An implementation of the phpBB cache interface. */ - public function set_cache(\phpbb\cache\driver\driver_interface $cache = null) + public function set_cache(\phpbb\cache\driver\driver_interface|null $cache = null) { if ($cache) { diff --git a/phpBB/phpbb/composer/exception/runtime_exception.php b/phpBB/phpbb/composer/exception/runtime_exception.php index adbb67994f..161e203d4b 100644 --- a/phpBB/phpbb/composer/exception/runtime_exception.php +++ b/phpBB/phpbb/composer/exception/runtime_exception.php @@ -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); } diff --git a/phpBB/phpbb/composer/extension_manager.php b/phpBB/phpbb/composer/extension_manager.php index 1e14a7591d..144b8d3c89 100644 --- a/phpBB/phpbb/composer/extension_manager.php +++ b/phpBB/phpbb/composer/extension_manager.php @@ -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) { diff --git a/phpBB/phpbb/composer/installer.php b/phpBB/phpbb/composer/installer.php index cd7456baf6..2e7ab9a614 100644 --- a/phpBB/phpbb/composer/installer.php +++ b/phpBB/phpbb/composer/installer.php @@ -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) diff --git a/phpBB/phpbb/composer/io/html_output_formatter.php b/phpBB/phpbb/composer/io/html_output_formatter.php index a5e2e8cc4a..6914709d51 100644 --- a/phpBB/phpbb/composer/io/html_output_formatter.php +++ b/phpBB/phpbb/composer/io/html_output_formatter.php @@ -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); diff --git a/phpBB/phpbb/composer/io/web_io.php b/phpBB/phpbb/composer/io/web_io.php index aac7f06088..b6e9a1b7ff 100644 --- a/phpBB/phpbb/composer/io/web_io.php +++ b/phpBB/phpbb/composer/io/web_io.php @@ -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; diff --git a/phpBB/phpbb/composer/manager.php b/phpBB/phpbb/composer/manager.php index e36a32d1e9..13d3491e9f 100644 --- a/phpBB/phpbb/composer/manager.php +++ b/phpBB/phpbb/composer/manager.php @@ -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) { } diff --git a/phpBB/phpbb/composer/manager_interface.php b/phpBB/phpbb/composer/manager_interface.php index d14abee8bc..9fda2f66ee 100644 --- a/phpBB/phpbb/composer/manager_interface.php +++ b/phpBB/phpbb/composer/manager_interface.php @@ -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. diff --git a/phpBB/phpbb/controller/resolver.php b/phpBB/phpbb/controller/resolver.php index e2d3e2f193..d4daec7eb2 100644 --- a/phpBB/phpbb/controller/resolver.php +++ b/phpBB/phpbb/controller/resolver.php @@ -53,7 +53,7 @@ class resolver implements ControllerResolverInterface * @param string $phpbb_root_path Relative path to phpBB root * @param \phpbb\template\template|null $template */ - public function __construct(ContainerInterface $container, $phpbb_root_path, \phpbb\template\template $template = null) + public function __construct(ContainerInterface $container, $phpbb_root_path, \phpbb\template\template|null $template = null) { $this->container = $container; $this->template = $template; diff --git a/phpBB/phpbb/datetime.php b/phpBB/phpbb/datetime.php index 7b9f9c83ac..a52148e609 100644 --- a/phpBB/phpbb/datetime.php +++ b/phpBB/phpbb/datetime.php @@ -42,7 +42,7 @@ class datetime extends \DateTime * @param string $time String in a format accepted by strtotime(). * @param \DateTimeZone|null $timezone Time zone of the time. */ - public function __construct($user, $time = 'now', \DateTimeZone $timezone = null) + public function __construct($user, $time = 'now', \DateTimeZone|null $timezone = null) { $this->user = $user; $timezone = $timezone ?: $this->user->timezone; diff --git a/phpBB/phpbb/db/doctrine/connection_factory.php b/phpBB/phpbb/db/doctrine/connection_factory.php index b692309688..fb24994b3d 100644 --- a/phpBB/phpbb/db/doctrine/connection_factory.php +++ b/phpBB/phpbb/db/doctrine/connection_factory.php @@ -73,10 +73,10 @@ class connection_factory public static function get_connection_from_params( string $driver, string $host, - ?string $user = null, - ?string $password = null, - ?string $name = null, - ?string $port = null): Connection + string|null $user = null, + string|null $password = null, + string|null $name = null, + string|null $port = null): Connection { $available_drivers = DriverManager::getAvailableDrivers(); if (!in_array($driver, $available_drivers)) diff --git a/phpBB/phpbb/db/doctrine/connection_parameter_factory.php b/phpBB/phpbb/db/doctrine/connection_parameter_factory.php index f9008616ca..95aa0c189c 100644 --- a/phpBB/phpbb/db/doctrine/connection_parameter_factory.php +++ b/phpBB/phpbb/db/doctrine/connection_parameter_factory.php @@ -37,11 +37,11 @@ class connection_parameter_factory */ public static function get_configuration( string $driver, - ?string $host = null, - ?string $user = null, - ?string $password = null, - ?string $name = null, - ?string $port = null) : array + string|null $host = null, + string|null $user = null, + string|null $password = null, + string|null $name = null, + string|null $port = null) : array { $params = [ 'driver' => $driver, @@ -73,11 +73,11 @@ class connection_parameter_factory */ private static function build_connection_parameters( array $params, - ?string $host = null, - ?string $user = null, - ?string $password = null, - ?string $name = null, - ?string $port = null) : array + string|null $host = null, + string|null $user = null, + string|null $password = null, + string|null $name = null, + string|null $port = null) : array { if ($params['driver'] === 'pdo_sqlite') { @@ -120,7 +120,7 @@ class connection_parameter_factory * * @return array Doctrine's DBAL configuration for SQLite. */ - private static function build_sqlite_parameters(array $params, string $path, ?string $user, ?string $password) : array + private static function build_sqlite_parameters(array $params, string $path, string|null $user, string|null $password) : array { $params['path'] = $path; diff --git a/phpBB/phpbb/db/migration/container_aware_migration.php b/phpBB/phpbb/db/migration/container_aware_migration.php index 3b4b49b04b..405bf6f7e8 100644 --- a/phpBB/phpbb/db/migration/container_aware_migration.php +++ b/phpBB/phpbb/db/migration/container_aware_migration.php @@ -29,7 +29,7 @@ abstract class container_aware_migration extends migration implements ContainerA /** * {@inheritdoc} */ - public function setContainer(ContainerInterface $container = null) + public function setContainer(ContainerInterface|null $container = null) { $this->container = $container; } diff --git a/phpBB/phpbb/db/migration/schema_generator.php b/phpBB/phpbb/db/migration/schema_generator.php index dfbbf3ccbb..0048d8198d 100644 --- a/phpBB/phpbb/db/migration/schema_generator.php +++ b/phpBB/phpbb/db/migration/schema_generator.php @@ -240,7 +240,7 @@ class schema_generator * @param mixed $data Array of values to be set. * @param callable|null $value_transform Callback to transform the value being set. */ - private static function set_all(&$schema, $data, ?callable $value_transform = null) + private static function set_all(&$schema, $data, callable|null $value_transform = null) { $data = (!is_array($data)) ? [$data] : $data; foreach ($data as $key => $change) @@ -317,7 +317,7 @@ class schema_generator * * @return Closure|null The value transformation callback or null if it is not needed. */ - private static function get_value_transform(string $change_type, string $schema_type) : ?Closure + private static function get_value_transform(string $change_type, string $schema_type) : Closure|null { if ($change_type !== 'add') { diff --git a/phpBB/phpbb/debug/error_handler.php b/phpBB/phpbb/debug/error_handler.php index f0a1efa3e3..159d0d36b1 100644 --- a/phpBB/phpbb/debug/error_handler.php +++ b/phpBB/phpbb/debug/error_handler.php @@ -24,7 +24,7 @@ class error_handler extends ErrorHandler /** * @psalm-suppress MethodSignatureMismatch */ - public function __construct(BufferingLogger $bootstrappingLogger = null, private readonly bool $debug = false) // phpcs:ignore Generic.CodeAnalysis.UselessOverridingMethod.Found + public function __construct(BufferingLogger|null $bootstrappingLogger = null, private readonly bool $debug = false) // phpcs:ignore Generic.CodeAnalysis.UselessOverridingMethod.Found { parent::__construct($bootstrappingLogger, $debug); } diff --git a/phpBB/phpbb/event/dispatcher.php b/phpBB/phpbb/event/dispatcher.php index 7b85edf600..472b1dff96 100644 --- a/phpBB/phpbb/event/dispatcher.php +++ b/phpBB/phpbb/event/dispatcher.php @@ -52,7 +52,7 @@ class dispatcher extends EventDispatcher implements dispatcher_interface /** * {@inheritdoc} */ - public function dispatch(object $event, string $eventName = null) : object + public function dispatch(object $event, string|null $eventName = null) : object { if ($this->disabled) { diff --git a/phpBB/phpbb/event/recursive_event_filter_iterator.php b/phpBB/phpbb/event/recursive_event_filter_iterator.php index f671c474d9..c8734cd6de 100644 --- a/phpBB/phpbb/event/recursive_event_filter_iterator.php +++ b/phpBB/phpbb/event/recursive_event_filter_iterator.php @@ -39,7 +39,7 @@ class recursive_event_filter_iterator extends \RecursiveFilterIterator * * @return recursive_event_filter_iterator */ - public function getChildren(): ?\RecursiveFilterIterator + public function getChildren(): \RecursiveFilterIterator|null { $inner_iterator = $this->getInnerIterator(); assert($inner_iterator instanceof \RecursiveIterator); diff --git a/phpBB/phpbb/exception/http_exception.php b/phpBB/phpbb/exception/http_exception.php index f22c90128e..f92606cc7c 100644 --- a/phpBB/phpbb/exception/http_exception.php +++ b/phpBB/phpbb/exception/http_exception.php @@ -44,7 +44,7 @@ class http_exception extends runtime_exception implements HttpExceptionInterface * @param array $headers Additional headers to set in the response. * @param integer $code The Exception code. */ - public function __construct($status_code, $message = "", array $parameters = array(), \Exception $previous = null, array $headers = array(), $code = 0) + public function __construct($status_code, $message = "", array $parameters = array(), \Exception|null $previous = null, array $headers = array(), $code = 0) { $this->status_code = $status_code; $this->headers = $headers; diff --git a/phpBB/phpbb/exception/runtime_exception.php b/phpBB/phpbb/exception/runtime_exception.php index ccf0d84f32..632e26dec4 100644 --- a/phpBB/phpbb/exception/runtime_exception.php +++ b/phpBB/phpbb/exception/runtime_exception.php @@ -35,7 +35,7 @@ class runtime_exception extends \RuntimeException implements exception_interface * @param \Exception|null $previous The previous runtime_exception used for the runtime_exception chaining. * @param integer $code The Exception code. */ - public function __construct($message = "", array $parameters = array(), \Exception $previous = null, $code = 0) + public function __construct($message = "", array $parameters = array(), \Exception|null $previous = null, $code = 0) { $this->parameters = $parameters; diff --git a/phpBB/phpbb/extension/manager.php b/phpBB/phpbb/extension/manager.php index adb6d884d1..ffa38be286 100644 --- a/phpBB/phpbb/extension/manager.php +++ b/phpBB/phpbb/extension/manager.php @@ -47,7 +47,7 @@ class manager * @param \phpbb\cache\service|null $cache A cache instance or null * @param string $cache_name The name of the cache variable, defaults to _ext */ - public function __construct(ContainerInterface $container, \phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, finder_factory $finder_factory, $extension_table, $phpbb_root_path, \phpbb\cache\service $cache = null, $cache_name = '_ext') + public function __construct(ContainerInterface $container, \phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, finder_factory $finder_factory, $extension_table, $phpbb_root_path, \phpbb\cache\service|null $cache = null, $cache_name = '_ext') { $this->cache = $cache; $this->cache_name = $cache_name; diff --git a/phpBB/phpbb/feed/exception/no_feed_exception.php b/phpBB/phpbb/feed/exception/no_feed_exception.php index af6357b74c..42a9d6b81a 100644 --- a/phpBB/phpbb/feed/exception/no_feed_exception.php +++ b/phpBB/phpbb/feed/exception/no_feed_exception.php @@ -15,7 +15,7 @@ namespace phpbb\feed\exception; class no_feed_exception extends feed_unavailable_exception { - public function __construct(\Exception $previous = null, $code = 0) + public function __construct(\Exception|null $previous = null, $code = 0) { parent::__construct('NO_FEED', array(), $previous, $code); } diff --git a/phpBB/phpbb/feed/exception/no_forum_exception.php b/phpBB/phpbb/feed/exception/no_forum_exception.php index a60832957a..0d2be5fe95 100644 --- a/phpBB/phpbb/feed/exception/no_forum_exception.php +++ b/phpBB/phpbb/feed/exception/no_forum_exception.php @@ -15,7 +15,7 @@ namespace phpbb\feed\exception; class no_forum_exception extends feed_unavailable_exception { - public function __construct($forum_id, \Exception $previous = null, $code = 0) + public function __construct($forum_id, \Exception|null $previous = null, $code = 0) { parent::__construct('NO_FORUM', array($forum_id), $previous, $code); } diff --git a/phpBB/phpbb/feed/exception/no_topic_exception.php b/phpBB/phpbb/feed/exception/no_topic_exception.php index b961a65d1c..a97186d8a0 100644 --- a/phpBB/phpbb/feed/exception/no_topic_exception.php +++ b/phpBB/phpbb/feed/exception/no_topic_exception.php @@ -15,7 +15,7 @@ namespace phpbb\feed\exception; class no_topic_exception extends feed_unavailable_exception { - public function __construct($topic_id, \Exception $previous = null, $code = 0) + public function __construct($topic_id, \Exception|null $previous = null, $code = 0) { parent::__construct('NO_TOPIC', array($topic_id), $previous, $code); } diff --git a/phpBB/phpbb/feed/exception/unauthorized_forum_exception.php b/phpBB/phpbb/feed/exception/unauthorized_forum_exception.php index 4384c7b39b..eb80dd2497 100644 --- a/phpBB/phpbb/feed/exception/unauthorized_forum_exception.php +++ b/phpBB/phpbb/feed/exception/unauthorized_forum_exception.php @@ -15,7 +15,7 @@ namespace phpbb\feed\exception; class unauthorized_forum_exception extends unauthorized_exception { - public function __construct($forum_id, \Exception $previous = null, $code = 0) + public function __construct($forum_id, \Exception|null $previous = null, $code = 0) { parent::__construct('SORRY_AUTH_READ', array($forum_id), $previous, $code); } diff --git a/phpBB/phpbb/feed/exception/unauthorized_topic_exception.php b/phpBB/phpbb/feed/exception/unauthorized_topic_exception.php index f49f0a0476..2a758b1b65 100644 --- a/phpBB/phpbb/feed/exception/unauthorized_topic_exception.php +++ b/phpBB/phpbb/feed/exception/unauthorized_topic_exception.php @@ -15,7 +15,7 @@ namespace phpbb\feed\exception; class unauthorized_topic_exception extends unauthorized_exception { - public function __construct($topic_id, \Exception $previous = null, $code = 0) + public function __construct($topic_id, \Exception|null $previous = null, $code = 0) { parent::__construct('SORRY_AUTH_READ_TOPIC', array($topic_id), $previous, $code); } diff --git a/phpBB/phpbb/files/filespec.php b/phpBB/phpbb/files/filespec.php index 48e9284f69..3e167fa731 100644 --- a/phpBB/phpbb/files/filespec.php +++ b/phpBB/phpbb/files/filespec.php @@ -103,7 +103,7 @@ class filespec * @param \phpbb\mimetype\guesser|null $mimetype_guesser Mime type guesser * @param \phpbb\plupload\plupload|null $plupload Plupload */ - public function __construct(\phpbb\filesystem\filesystem_interface $phpbb_filesystem, language $language, \bantu\IniGetWrapper\IniGetWrapper $php_ini, \FastImageSize\FastImageSize $imagesize, $phpbb_root_path, \phpbb\mimetype\guesser $mimetype_guesser = null, \phpbb\plupload\plupload $plupload = null) + public function __construct(\phpbb\filesystem\filesystem_interface $phpbb_filesystem, language $language, \bantu\IniGetWrapper\IniGetWrapper $php_ini, \FastImageSize\FastImageSize $imagesize, $phpbb_root_path, \phpbb\mimetype\guesser|null $mimetype_guesser = null, \phpbb\plupload\plupload|null $plupload = null) { $this->filesystem = $phpbb_filesystem; $this->language = $language; diff --git a/phpBB/phpbb/files/filespec_storage.php b/phpBB/phpbb/files/filespec_storage.php index fcda005d7b..5fb71315b2 100644 --- a/phpBB/phpbb/files/filespec_storage.php +++ b/phpBB/phpbb/files/filespec_storage.php @@ -86,7 +86,7 @@ class filespec_storage * @param \phpbb\mimetype\guesser|null $mimetype_guesser Mime type guesser * @param \phpbb\plupload\plupload|null $plupload Plupload */ - public function __construct(language $language, \FastImageSize\FastImageSize $imagesize, \phpbb\mimetype\guesser $mimetype_guesser = null, \phpbb\plupload\plupload $plupload = null) + public function __construct(language $language, \FastImageSize\FastImageSize $imagesize, \phpbb\mimetype\guesser|null $mimetype_guesser = null, \phpbb\plupload\plupload|null $plupload = null) { $this->language = $language; $this->imagesize = $imagesize; diff --git a/phpBB/phpbb/filesystem/exception/filesystem_exception.php b/phpBB/phpbb/filesystem/exception/filesystem_exception.php index 55ea3625a5..6d533705a2 100644 --- a/phpBB/phpbb/filesystem/exception/filesystem_exception.php +++ b/phpBB/phpbb/filesystem/exception/filesystem_exception.php @@ -26,7 +26,7 @@ class filesystem_exception extends runtime_exception * @param \Exception|null $previous The previous runtime_exception used for the runtime_exception chaining. * @param integer $code The Exception code. */ - public function __construct($message = '', $filename = '', $parameters = array(), \Exception $previous = null, $code = 0) + public function __construct($message = '', $filename = '', $parameters = array(), \Exception|null $previous = null, $code = 0) { parent::__construct($message, array_merge(array('filename' => $filename), $parameters), $previous, $code); } diff --git a/phpBB/phpbb/filesystem/filesystem.php b/phpBB/phpbb/filesystem/filesystem.php index 6324c5c209..a84c458bb9 100644 --- a/phpBB/phpbb/filesystem/filesystem.php +++ b/phpBB/phpbb/filesystem/filesystem.php @@ -293,7 +293,7 @@ class filesystem implements filesystem_interface /** * {@inheritdoc} */ - public function mirror($origin_dir, $target_dir, \Traversable $iterator = null, $options = array()) + public function mirror($origin_dir, $target_dir, \Traversable|null $iterator = null, $options = array()) { try { diff --git a/phpBB/phpbb/filesystem/filesystem_interface.php b/phpBB/phpbb/filesystem/filesystem_interface.php index 0e7967dcfb..11c4141d0d 100644 --- a/phpBB/phpbb/filesystem/filesystem_interface.php +++ b/phpBB/phpbb/filesystem/filesystem_interface.php @@ -190,7 +190,7 @@ interface filesystem_interface * The filename which triggered the error can be * retrieved by filesystem_exception::get_filename() */ - public function mirror($origin_dir, $target_dir, \Traversable $iterator = null, $options = array()); + public function mirror($origin_dir, $target_dir, \Traversable|null $iterator = null, $options = array()); /** * Creates a directory recursively. diff --git a/phpBB/phpbb/finder/factory.php b/phpBB/phpbb/finder/factory.php index 0ce087b061..81b60bcd8b 100644 --- a/phpBB/phpbb/finder/factory.php +++ b/phpBB/phpbb/finder/factory.php @@ -33,7 +33,7 @@ class factory * @param string $phpbb_root_path Path to the phpbb root directory * @param string $php_ext php file extension */ - public function __construct(?service $cache, bool $use_cache, string $phpbb_root_path, string $php_ext) + public function __construct(service|null $cache, bool $use_cache, string $phpbb_root_path, string $php_ext) { $this->cache = $cache; $this->use_cache = $use_cache; diff --git a/phpBB/phpbb/finder/finder.php b/phpBB/phpbb/finder/finder.php index 7bad84e36d..1bb197a37c 100644 --- a/phpBB/phpbb/finder/finder.php +++ b/phpBB/phpbb/finder/finder.php @@ -58,7 +58,7 @@ class finder * @param string $cache_name The name of the cache variable, defaults to * _ext_finder */ - public function __construct(?service $cache, bool $use_cache, string $phpbb_root_path, string $php_ext, string $cache_name = '_ext_finder') + public function __construct(service|null $cache, bool $use_cache, string $phpbb_root_path, string $php_ext, string $cache_name = '_ext_finder') { $this->phpbb_root_path = $phpbb_root_path; $this->cache = $cache; diff --git a/phpBB/phpbb/form/form_helper.php b/phpBB/phpbb/form/form_helper.php index 7a266f2339..d489150a11 100644 --- a/phpBB/phpbb/form/form_helper.php +++ b/phpBB/phpbb/form/form_helper.php @@ -52,7 +52,7 @@ class form_helper * * @return array Array containing form_token and creation_time of form token */ - public function get_form_tokens(string $form_name, ?int &$now = 0, ?string &$token_sid = '', ?string &$token = ''): array + public function get_form_tokens(string $form_name, int|null &$now = 0, string|null &$token_sid = '', string|null &$token = ''): array { $now = time(); $token_sid = ($this->user->data['user_id'] == ANONYMOUS && !empty($this->config['form_token_sid_guests'])) ? $this->user->session_id : ''; @@ -71,7 +71,7 @@ class form_helper * @param int|null $timespan Lifetime of token or null if default value should be used * @return bool True if form token is valid, false if not */ - public function check_form_tokens(string $form_name, ?int $timespan = null): bool + public function check_form_tokens(string $form_name, int|null $timespan = null): bool { if ($timespan === null) { diff --git a/phpBB/phpbb/install/database_task.php b/phpBB/phpbb/install/database_task.php index 758e511c1a..83bfe8fbfe 100644 --- a/phpBB/phpbb/install/database_task.php +++ b/phpBB/phpbb/install/database_task.php @@ -74,7 +74,7 @@ abstract class database_task extends task_base * * @return Result|null Result of the query. */ - protected function query(string $sql) : ?Result + protected function query(string $sql) : Result|null { try { @@ -95,7 +95,7 @@ abstract class database_task extends task_base * * @return Statement|null The prepared statement object or null if preparing failed */ - protected function create_prepared_stmt(string $sql): ?Statement + protected function create_prepared_stmt(string $sql): Statement|null { try { @@ -155,7 +155,7 @@ abstract class database_task extends task_base * * @return int|null The last insert ID. */ - protected function get_last_insert_id() : ?int + protected function get_last_insert_id() : int|null { try { diff --git a/phpBB/phpbb/install/sequential_task.php b/phpBB/phpbb/install/sequential_task.php index bc389c272d..60af336039 100644 --- a/phpBB/phpbb/install/sequential_task.php +++ b/phpBB/phpbb/install/sequential_task.php @@ -38,7 +38,7 @@ trait sequential_task * * @throws resource_limit_reached_exception When resources are exhausted. */ - protected function execute(config $config, array $data, ?string $counter_name = null) : void + protected function execute(config $config, array $data, string|null $counter_name = null) : void { if ($counter_name === null) { diff --git a/phpBB/phpbb/messenger/method/base.php b/phpBB/phpbb/messenger/method/base.php index 17213c6b3d..d4d2310ca8 100644 --- a/phpBB/phpbb/messenger/method/base.php +++ b/phpBB/phpbb/messenger/method/base.php @@ -119,8 +119,8 @@ abstract class base implements messenger_interface user $user, string $phpbb_root_path, string $template_cache_path, - ?manager $ext_manager = null, - ?log_interface $log = null + manager|null $ext_manager = null, + log_interface|null $log = null ) { $this->assets_bag = $assets_bag; @@ -469,7 +469,7 @@ abstract class base implements messenger_interface * * @return void */ - protected function set_template_paths(string|array $path_name, string|array $paths): void + protected function set_template_paths(array|string $path_name, array|string $paths): void { $this->setup_template(); $this->template->set_custom_style($path_name, $paths); diff --git a/phpBB/phpbb/notification/method/email.php b/phpBB/phpbb/notification/method/email.php index 07ce0b4f06..d18867927a 100644 --- a/phpBB/phpbb/notification/method/email.php +++ b/phpBB/phpbb/notification/method/email.php @@ -91,7 +91,7 @@ class email extends messenger_base * method additionally checks if the type provides an email template. * @return bool */ - public function is_available(type_interface $notification_type = null) + public function is_available(type_interface|null $notification_type = null) { return parent::is_available($notification_type) && $this->config['email_enable'] && !empty($this->user->data['user_email']); } diff --git a/phpBB/phpbb/notification/method/messenger_base.php b/phpBB/phpbb/notification/method/messenger_base.php index 090cf9c8d9..3f2532c243 100644 --- a/phpBB/phpbb/notification/method/messenger_base.php +++ b/phpBB/phpbb/notification/method/messenger_base.php @@ -59,7 +59,7 @@ abstract class messenger_base extends \phpbb\notification\method\base * only if the type is provided and if it doesn't provide an email template. * @return bool */ - public function is_available(type_interface $notification_type = null) + public function is_available(type_interface|null $notification_type = null) { return $notification_type === null || $notification_type->get_email_template() !== false; } diff --git a/phpBB/phpbb/notification/method/webpush.php b/phpBB/phpbb/notification/method/webpush.php index 25b22d54d8..8923728362 100644 --- a/phpBB/phpbb/notification/method/webpush.php +++ b/phpBB/phpbb/notification/method/webpush.php @@ -101,7 +101,7 @@ class webpush extends base implements extended_method_interface /** * {@inheritDoc} */ - public function is_available(type_interface $notification_type = null): bool + public function is_available(type_interface|null $notification_type = null): bool { return $this->config['webpush_enable'] && $this->config['webpush_vapid_public'] diff --git a/phpBB/phpbb/request/request.php b/phpBB/phpbb/request/request.php index a28b9df541..b546f6869a 100644 --- a/phpBB/phpbb/request/request.php +++ b/phpBB/phpbb/request/request.php @@ -57,7 +57,7 @@ class request implements request_interface * Initialises the request class, that means it stores all input data in {@link $input input} * and then calls {@link \phpbb\request\deactivated_super_global \phpbb\request\deactivated_super_global} */ - public function __construct(\phpbb\request\type_cast_helper_interface $type_cast_helper = null, $disable_super_globals = true) + public function __construct(\phpbb\request\type_cast_helper_interface|null $type_cast_helper = null, $disable_super_globals = true) { if ($type_cast_helper) { diff --git a/phpBB/phpbb/routing/resources_locator/default_resources_locator.php b/phpBB/phpbb/routing/resources_locator/default_resources_locator.php index 8cbf089b2a..12866248ff 100644 --- a/phpBB/phpbb/routing/resources_locator/default_resources_locator.php +++ b/phpBB/phpbb/routing/resources_locator/default_resources_locator.php @@ -48,7 +48,7 @@ class default_resources_locator implements resources_locator_interface * @param string $environment Name of the current environment * @param manager|null $extension_manager Extension manager */ - public function __construct($phpbb_root_path, $environment, manager $extension_manager = null) + public function __construct($phpbb_root_path, $environment, manager|null $extension_manager = null) { $this->phpbb_root_path = $phpbb_root_path; $this->environment = $environment; diff --git a/phpBB/phpbb/search/backend/base.php b/phpBB/phpbb/search/backend/base.php index 9663c15f65..5d3c8efaa5 100644 --- a/phpBB/phpbb/search/backend/base.php +++ b/phpBB/phpbb/search/backend/base.php @@ -316,7 +316,7 @@ abstract class base implements search_backend_interface /** * {@inheritdoc} */ - public function create_index(int &$post_counter = 0): ?array + public function create_index(int &$post_counter = 0): array|null { $max_post_id = $this->get_max_post_id(); $forums_indexing_enabled = $this->forum_ids_with_indexing_enabled(); @@ -377,7 +377,7 @@ abstract class base implements search_backend_interface /** * {@inheritdoc} */ - public function delete_index(int &$post_counter = null): ?array + public function delete_index(int|null &$post_counter = null): array|null { $max_post_id = $this->get_max_post_id(); diff --git a/phpBB/phpbb/search/backend/fulltext_mysql.php b/phpBB/phpbb/search/backend/fulltext_mysql.php index 7635b503fa..977003d351 100644 --- a/phpBB/phpbb/search/backend/fulltext_mysql.php +++ b/phpBB/phpbb/search/backend/fulltext_mysql.php @@ -912,7 +912,7 @@ class fulltext_mysql extends base implements search_backend_interface /** * {@inheritdoc} */ - public function create_index(int &$post_counter = 0): ?array + public function create_index(int &$post_counter = 0): array|null { // Make sure we can actually use MySQL with fulltext indexes if ($error = $this->init()) @@ -984,7 +984,7 @@ class fulltext_mysql extends base implements search_backend_interface /** * {@inheritdoc} */ - public function delete_index(int &$post_counter = null): ?array + public function delete_index(int|null &$post_counter = null): array|null { // Make sure we can actually use MySQL with fulltext indexes if ($error = $this->init()) diff --git a/phpBB/phpbb/search/backend/fulltext_native.php b/phpBB/phpbb/search/backend/fulltext_native.php index ffdcbff3db..3be1e935f0 100644 --- a/phpBB/phpbb/search/backend/fulltext_native.php +++ b/phpBB/phpbb/search/backend/fulltext_native.php @@ -1621,7 +1621,7 @@ class fulltext_native extends base implements search_backend_interface /** * {@inheritdoc} */ - public function delete_index(int &$post_counter = null): ?array + public function delete_index(int|null &$post_counter = null): array|null { $truncate_tables = [ $this->search_wordlist_table, diff --git a/phpBB/phpbb/search/backend/fulltext_postgres.php b/phpBB/phpbb/search/backend/fulltext_postgres.php index 6c4ac05932..9e1962f9e9 100644 --- a/phpBB/phpbb/search/backend/fulltext_postgres.php +++ b/phpBB/phpbb/search/backend/fulltext_postgres.php @@ -867,7 +867,7 @@ class fulltext_postgres extends base implements search_backend_interface /** * {@inheritdoc} */ - public function create_index(int &$post_counter = 0): ?array + public function create_index(int &$post_counter = 0): array|null { // Make sure we can actually use PostgreSQL with fulltext indexes if ($error = $this->init()) @@ -926,7 +926,7 @@ class fulltext_postgres extends base implements search_backend_interface /** * {@inheritdoc} */ - public function delete_index(int &$post_counter = null): ?array + public function delete_index(int|null &$post_counter = null): array|null { // Make sure we can actually use PostgreSQL with fulltext indexes if ($error = $this->init()) diff --git a/phpBB/phpbb/search/backend/fulltext_sphinx.php b/phpBB/phpbb/search/backend/fulltext_sphinx.php index 93b0c1c522..aa7e0b94fe 100644 --- a/phpBB/phpbb/search/backend/fulltext_sphinx.php +++ b/phpBB/phpbb/search/backend/fulltext_sphinx.php @@ -629,7 +629,7 @@ class fulltext_sphinx implements search_backend_interface /** * {@inheritdoc} */ - public function create_index(int &$post_counter = 0): ?array + public function create_index(int &$post_counter = 0): array|null { if (!$this->index_created()) { @@ -656,7 +656,7 @@ class fulltext_sphinx implements search_backend_interface /** * {@inheritdoc} */ - public function delete_index(int &$post_counter = null): ?array + public function delete_index(int|null &$post_counter = null): array|null { if ($this->index_created()) { diff --git a/phpBB/phpbb/search/backend/search_backend_interface.php b/phpBB/phpbb/search/backend/search_backend_interface.php index 82ea0d03ff..b620ef98c0 100644 --- a/phpBB/phpbb/search/backend/search_backend_interface.php +++ b/phpBB/phpbb/search/backend/search_backend_interface.php @@ -163,7 +163,7 @@ interface search_backend_interface * @param int $post_counter * @return array|null array with current status or null if finished */ - public function create_index(int &$post_counter = 0): ?array; + public function create_index(int &$post_counter = 0): array|null; /** * Drop fulltext index @@ -171,7 +171,7 @@ interface search_backend_interface * @param int $post_counter * @return array|null array with current status or null if finished */ - public function delete_index(int &$post_counter = 0): ?array; + public function delete_index(int &$post_counter = 0): array|null; /** * Returns true if both FULLTEXT indexes exist diff --git a/phpBB/phpbb/search/backend/sphinx/config.php b/phpBB/phpbb/search/backend/sphinx/config.php index 2dac3a8687..d9ba56a5f2 100644 --- a/phpBB/phpbb/search/backend/sphinx/config.php +++ b/phpBB/phpbb/search/backend/sphinx/config.php @@ -28,7 +28,7 @@ class config * @param string $name The name of the section that shall be returned * @return config_section|null The section object or null if none was found */ - public function get_section_by_name(string $name): ?config_section + public function get_section_by_name(string $name): config_section|null { for ($i = 0, $size = count($this->sections); $i < $size; $i++) { diff --git a/phpBB/phpbb/search/backend/sphinx/config_section.php b/phpBB/phpbb/search/backend/sphinx/config_section.php index a3f522209f..eff5bb2953 100644 --- a/phpBB/phpbb/search/backend/sphinx/config_section.php +++ b/phpBB/phpbb/search/backend/sphinx/config_section.php @@ -60,7 +60,7 @@ class config_section extends config_item * @return config_variable|null The first variable object from this section with the * given name or null if none was found */ - public function get_variable_by_name(string $name): ?config_variable + public function get_variable_by_name(string $name): config_variable|null { for ($i = 0, $size = count($this->variables); $i < $size; $i++) { diff --git a/phpBB/phpbb/storage/exception/storage_exception.php b/phpBB/phpbb/storage/exception/storage_exception.php index 205cf82561..b7635218a3 100644 --- a/phpBB/phpbb/storage/exception/storage_exception.php +++ b/phpBB/phpbb/storage/exception/storage_exception.php @@ -26,7 +26,7 @@ class storage_exception extends runtime_exception * @param \Exception|null $previous The previous runtime_exception used for the runtime_exception chaining * @param integer $code The Exception code */ - public function __construct($message = '', $filename = '', $parameters = [], \Exception $previous = null, $code = 0) + public function __construct($message = '', $filename = '', $parameters = [], \Exception|null $previous = null, $code = 0) { parent::__construct($message, array_merge(array('filename' => $filename), $parameters), $previous, $code); } diff --git a/phpBB/phpbb/template/twig/environment.php b/phpBB/phpbb/template/twig/environment.php index 68d3e9ad89..a5af650c66 100644 --- a/phpBB/phpbb/template/twig/environment.php +++ b/phpBB/phpbb/template/twig/environment.php @@ -66,7 +66,7 @@ class environment extends \Twig\Environment * @param dispatcher_interface|null $phpbb_dispatcher Event dispatcher object * @param array $options Array of options to pass to Twig */ - public function __construct(assets_bag $assets_bag, config $phpbb_config, filesystem $filesystem, path_helper $path_helper, $cache_path, manager $extension_manager = null, LoaderInterface $loader = null, dispatcher_interface $phpbb_dispatcher = null, $options = array()) + public function __construct(assets_bag $assets_bag, config $phpbb_config, filesystem $filesystem, path_helper $path_helper, $cache_path, manager|null $extension_manager = null, LoaderInterface|null $loader = null, dispatcher_interface|null $phpbb_dispatcher = null, $options = array()) { $this->phpbb_config = $phpbb_config; @@ -271,7 +271,7 @@ class environment extends \Twig\Environment * @return \Twig\Template A template instance representing the given template name * @throws \Twig\Error\LoaderError */ - public function loadTemplate(string $cls, string $name, int $index = null) : \Twig\Template + public function loadTemplate(string $cls, string $name, int|null $index = null) : \Twig\Template { if (strpos($name, '@') === false) { diff --git a/phpBB/phpbb/template/twig/extension/avatar.php b/phpBB/phpbb/template/twig/extension/avatar.php index 238caddaf5..e10330301e 100644 --- a/phpBB/phpbb/template/twig/extension/avatar.php +++ b/phpBB/phpbb/template/twig/extension/avatar.php @@ -70,7 +70,7 @@ class avatar extends AbstractExtension * * @return string The avatar HTML for the specified mode */ - public function get_avatar(environment $environment, string $mode, array $row, ?string $alt, ?bool $ignore_config, ?bool $lazy): string + public function get_avatar(environment $environment, string $mode, array $row, string|null $alt, bool|null $ignore_config, bool|null $lazy): string { $alt = $alt ?? false; $ignore_config = $ignore_config ?? false; diff --git a/phpBB/phpbb/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php index 1259618175..aba1d3d099 100644 --- a/phpBB/phpbb/template/twig/twig.php +++ b/phpBB/phpbb/template/twig/twig.php @@ -70,9 +70,9 @@ class twig extends \phpbb\template\base \phpbb\template\context $context, environment $twig_environment, $cache_path, - \phpbb\user $user = null, + \phpbb\user|null $user = null, $extensions = [], - \phpbb\extension\manager $extension_manager = null + \phpbb\extension\manager|null $extension_manager = null ) { $this->path_helper = $path_helper; diff --git a/phpBB/phpbb/user.php b/phpBB/phpbb/user.php index c486161a05..f3f4cd04c4 100644 --- a/phpBB/phpbb/user.php +++ b/phpBB/phpbb/user.php @@ -709,7 +709,7 @@ class user extends \phpbb\session * @param ?\DateTimeZone $timezone Time zone of the time. * @return \phpbb\datetime Date time object linked to the current users locale */ - public function create_datetime(string $time = 'now', ?\DateTimeZone $timezone = null) + public function create_datetime(string $time = 'now', \DateTimeZone|null $timezone = null) { $timezone = $timezone ?: $this->create_timezone(); return new $this->datetime($this, $time, $timezone); @@ -723,7 +723,7 @@ class user extends \phpbb\session * @param ?\DateTimeZone $timezone Timezone of the date/time, falls back to timezone of current user * @return string|false Returns the unix timestamp or false if date is invalid */ - public function get_timestamp_from_format($format, $time, ?\DateTimeZone $timezone = null) + public function get_timestamp_from_format($format, $time, \DateTimeZone|null $timezone = null) { $timezone = $timezone ?: $this->create_timezone(); $date = \DateTime::createFromFormat($format, $time, $timezone); diff --git a/tests/mock/container_builder.php b/tests/mock/container_builder.php index 9200ed0767..b6676df3f5 100644 --- a/tests/mock/container_builder.php +++ b/tests/mock/container_builder.php @@ -56,7 +56,7 @@ class phpbb_mock_container_builder implements ContainerInterface * * @api */ - public function get(string $id, int $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE): ?object + public function get(string $id, int $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE): object|null { if ($this->has($id)) { diff --git a/tests/mock/search_backend_mock.php b/tests/mock/search_backend_mock.php index 84dd26385e..33579ee557 100644 --- a/tests/mock/search_backend_mock.php +++ b/tests/mock/search_backend_mock.php @@ -82,13 +82,13 @@ class search_backend_mock implements search_backend_interface // Nothing } - public function create_index(int &$post_counter = 0): ?array + public function create_index(int &$post_counter = 0): array|null { $this->index_created = true; return null; } - public function delete_index(int &$post_counter = 0): ?array + public function delete_index(int &$post_counter = 0): array|null { $this->index_created = true; return null; diff --git a/tests/profilefields/type_date_test.php b/tests/profilefields/type_date_test.php index 75de0773d2..480b03baf0 100644 --- a/tests/profilefields/type_date_test.php +++ b/tests/profilefields/type_date_test.php @@ -221,7 +221,7 @@ class phpbb_profilefield_type_date_test extends phpbb_test_case return implode('-', func_get_args()); } - public function create_datetime_callback($time = 'now', \DateTimeZone $timezone = null) + public function create_datetime_callback($time = 'now', \DateTimeZone|null $timezone = null) { $timezone = $timezone ?: $this->user->timezone; return new \phpbb\datetime($this->user, $time, $timezone); diff --git a/tests/test_framework/phpbb_test_case_helpers.php b/tests/test_framework/phpbb_test_case_helpers.php index 3bb279c25f..d3adcceedd 100644 --- a/tests/test_framework/phpbb_test_case_helpers.php +++ b/tests/test_framework/phpbb_test_case_helpers.php @@ -346,7 +346,7 @@ class phpbb_test_case_helpers * @param string $styles_path Path to the styles dir * @return ContainerInterface */ - public function set_s9e_services(ContainerInterface $container = null, $fixture = null, $styles_path = null) + public function set_s9e_services(ContainerInterface|null $container = null, $fixture = null, $styles_path = null) { static $first_run; global $config, $phpbb_container, $phpbb_dispatcher, $phpbb_root_path, $phpEx, $request, $user;