Skip to content

Commit

Permalink
PHP 8.4: Implicitly nullable parameter declarations deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
MioVisman committed Jul 9, 2024
1 parent c7f6b5a commit 89ffe3e
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions include/email.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function is_valid_email(string $email)
//
// Check if $email is banned
//
function is_banned_email(string $email, int $id = null)
function is_banned_email(string $email, ?int $id = null)
{
global $pun_bans;

Expand Down Expand Up @@ -79,7 +79,7 @@ function encode_mail_text(string $str)
//
// Make a post email safe
//
function bbcode2email(string $text, int $wrap_length = 72, string $language = null)
function bbcode2email(string $text, int $wrap_length = 72, ?string $language = null)
{
static $base_url;
static $wrotes = array();
Expand Down
10 changes: 5 additions & 5 deletions include/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ function check_bans()
//
// Check username
//
function check_username(string $username, int $exclude_id = null)
function check_username(string $username, ?int $exclude_id = null)
{
global $db, $pun_config, $errors, $lang_prof_reg, $lang_register, $lang_common;

Expand Down Expand Up @@ -638,7 +638,7 @@ function generate_avatar_markup(int $user_id)
//
// Generate browser's title
//
function generate_page_title($page_title, int $p = null)
function generate_page_title($page_title, ?int $p = null)
{
global $lang_common;

Expand Down Expand Up @@ -1034,7 +1034,7 @@ function paginate(int $num_pages, int $cur_page, string $link)
//
// Display a message
//
function message(string $message, bool $no_back_link = false, string $http_status = null)
function message(string $message, bool $no_back_link = false, ?string $http_status = null)
{
global $db, $lang_common, $pun_config, $pun_start, $tpl_main, $pun_user, $page_js;

Expand Down Expand Up @@ -1344,7 +1344,7 @@ function pun_linebreaks(string $str)
//
// A wrapper for utf8_trim for compatibility
//
function pun_trim($str, string $charlist = null)
function pun_trim($str, ?string $charlist = null)
{
if (! is_scalar($str)) {
$str = '';
Expand Down Expand Up @@ -1649,7 +1649,7 @@ function redirect(string $destination_url, string $message)
//
// Display a simple error message
//
function error(string $message, string $file = null, $line = null, $db_error = false)
function error(string $message, ?string $file = null, $line = null, $db_error = false)
{
global $pun_config, $lang_common;

Expand Down
2 changes: 1 addition & 1 deletion include/parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ function handle_img_tag(string $url, bool $is_signature = false, ?string $alt =
//
// Email bbcode replace to <a href="mailto:... - Visman
//
function handle_email_tag(string $mail, string $body = null)
function handle_email_tag(string $mail, ?string $body = null)
{
if (null === $body)
$body = $mail;
Expand Down
2 changes: 1 addition & 1 deletion include/search_idx.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ function strip_bbcode(string $text)
//
// Updates the search index with the contents of $post_id (and $subject)
//
function update_search_index(string $mode, int $post_id, string $message, string $subject = null)
function update_search_index(string $mode, int $post_id, string $message, ?string $subject = null)
{
global $db_type, $db;

Expand Down
4 changes: 2 additions & 2 deletions include/upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ public function setImageQuality($quality)
protected $fileIsUp;
protected $image;

public function loadFile(string $path, string $basename = null)
public function loadFile(string $path, ?string $basename = null)
{
$this->filePath = null;
$this->fileName = null;
Expand Down Expand Up @@ -778,7 +778,7 @@ public function __destruct()
$this->destroyImage();
}

protected function hidePath(string $str, string $path = null)
protected function hidePath(string $str, ?string $path = null)
{
$search = [];
if (null !== $this->filePath) {
Expand Down
2 changes: 1 addition & 1 deletion upfiles.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function upf_get_pg(string $key, $default = null)
return $_POST[$key] ?? ($_GET[$key] ?? $default);
}

function upf_message(string $message, bool $no_back_link = false, string $http_status = null)
function upf_message(string $message, bool $no_back_link = false, ?string $http_status = null)
{
global $upf_ajax;

Expand Down

0 comments on commit 89ffe3e

Please sign in to comment.