Skip to content

Commit b7db1b0

Browse files
authored
Merge pull request phpbb#6803 from rxu/ticket/17496
[ticket/17496] Fix Implicitly marking parameters as nullable PHP deprecations
2 parents bdbd0be + 0066d53 commit b7db1b0

File tree

70 files changed

+210
-170
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+210
-170
lines changed

build/code_sniffer/phpbb/Sniffs/Namespaces/UnusedUseSniff.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,20 @@ protected function check(File $phpcsFile, $found_name, $full_name, $short_name,
4949
$phpcsFile->addError($error, $stack_pointer, 'FullName');
5050
}
5151

52-
if ($found_name === $short_name)
52+
/*
53+
* Check for possible union types (like string|MyType|null)
54+
* and question mark nullable type syntax (like ?MyType)
55+
*/
56+
$types = explode('|', $found_name);
57+
foreach ($types as $type)
5358
{
54-
return true;
59+
// Nullable type syntax
60+
$type = (strpos($type, '?') === 0) ? substr($type, 1) : $type;
61+
62+
if ($short_name === $type)
63+
{
64+
return true;
65+
}
5566
}
5667

5768
return false;

phpBB/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"composer/package-versions-deprecated": "^1.11",
4040
"doctrine/dbal": "~3.3.6",
4141
"google/recaptcha": "~1.1",
42-
"guzzlehttp/guzzle": "~6.3",
42+
"guzzlehttp/guzzle": " ^7.0",
4343
"marc1706/fast-image-size": "^1.1",
4444
"minishlink/web-push": "^8.0",
4545
"s9e/text-formatter": "^2.0",

phpBB/composer.lock

Lines changed: 75 additions & 49 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

phpBB/includes/functions.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ function phpbb_gmgetdate($time = false)
130130
*
131131
* @return array|string data array if $string_only is false
132132
*/
133-
function get_formatted_filesize($value, bool $string_only = true, array $allowed_units = null)
133+
function get_formatted_filesize($value, bool $string_only = true, array|null $allowed_units = null)
134134
{
135135
global $user;
136136

@@ -253,7 +253,7 @@ function still_on_time($extra_time = 15)
253253
* @return mixed Boolean (true, false) if comparison operator is specified.
254254
* Integer (-1, 0, 1) otherwise.
255255
*/
256-
function phpbb_version_compare(string $version1, string $version2, string $operator = null)
256+
function phpbb_version_compare(string $version1, string $version2, string|null $operator = null)
257257
{
258258
$version1 = strtolower($version1);
259259
$version2 = strtolower($version2);

phpBB/includes/functions_acp.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ function adm_back_link($u_action)
215215
*
216216
* @return array
217217
*/
218-
function build_select(array $options_ary, int|string|bool $option_default = false): array
218+
function build_select(array $options_ary, bool|int|string $option_default = false): array
219219
{
220220
global $language;
221221

phpBB/phpbb/avatar/driver/driver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ abstract class driver implements \phpbb\avatar\driver\driver_interface
8282
* @param \phpbb\path_helper $path_helper phpBB path helper
8383
* @param \phpbb\cache\driver\driver_interface|null $cache Cache driver
8484
*/
85-
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)
85+
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)
8686
{
8787
$this->config = $config;
8888
$this->imagesize = $imagesize;

phpBB/phpbb/ban/type/email.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function get_type(): string
2828
/**
2929
* {@inheritDoc}
3030
*/
31-
public function get_user_column(): ?string
31+
public function get_user_column(): string|null
3232
{
3333
return 'user_email';
3434
}

phpBB/phpbb/ban/type/ip.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function get_type(): string
3131
/**
3232
* @inheritDoc
3333
*/
34-
public function get_user_column(): ?string
34+
public function get_user_column(): string|null
3535
{
3636
return null;
3737
}

phpBB/phpbb/ban/type/type_interface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function get_type(): string;
3333
*
3434
* @return string|null
3535
*/
36-
public function get_user_column(): ?string;
36+
public function get_user_column(): string|null;
3737

3838
/**
3939
* Sets a user object to the ban type to have it excluded

0 commit comments

Comments
 (0)