Skip to content

Fix PHP 8.4 deprecation: Implicitly marking parameter as nullable is deprecated, the explicit nullable type must be used instead #2699

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dt-core/configuration/config-site-defaults.php
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ function dt_get_site_options_defaults() {
*
* @return array|mixed
*/
function dt_get_site_custom_lists( string $list_title = null ) {
function dt_get_site_custom_lists( ?string $list_title = null ) {
$fields = [];

$fields['version'] = 10;
Expand Down
6 changes: 3 additions & 3 deletions dt-core/libraries/parsedown/Parsedown.php
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ protected function blockHeader($Line)
#
# List

protected function blockList($Line, array $CurrentBlock = null)
protected function blockList($Line, ?array $CurrentBlock = null)
{
list($name, $pattern) = $Line['text'][0] <= '-' ? array('ul', '[*+-]') : array('ol', '[0-9]{1,9}+[.\)]');

Expand Down Expand Up @@ -808,7 +808,7 @@ protected function blockRule($Line)
#
# Setext

protected function blockSetextHeader($Line, array $Block = null)
protected function blockSetextHeader($Line, ?array $Block = null)
{
if ( ! isset($Block) or $Block['type'] !== 'Paragraph' or isset($Block['interrupted']))
{
Expand Down Expand Up @@ -894,7 +894,7 @@ protected function blockReference($Line)
#
# Table

protected function blockTable($Line, array $Block = null)
protected function blockTable($Line, ?array $Block = null)
{
if ( ! isset($Block) or $Block['type'] !== 'Paragraph' or isset($Block['interrupted']))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function getUpdate() {
* @param Update|null $update
* @return $this
*/
public function setUpdate(Update $update = null) {
public function setUpdate(?Update $update = null) {
$this->lazyLoad();
$this->update = $update;
return $this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ protected function filterUpdateResult($update, $httpResult = null) {
*
* @param Metadata|null $update
*/
protected function fixSupportedWordpressVersion(Metadata $update = null) {
protected function fixSupportedWordpressVersion(?Metadata $update = null) {
if ( !isset($update->tested) || !preg_match('/^\d++\.\d++$/', $update->tested) ) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ protected function blockRule($Line)
#
# Setext

protected function blockSetextHeader($Line, array $Block = null)
protected function blockSetextHeader($Line, ?array $Block = null)
{
if ( ! isset($Block) or isset($Block['type']) or isset($Block['interrupted']))
{
Expand Down Expand Up @@ -786,7 +786,7 @@ protected function blockReference($Line)
#
# Table

protected function blockTable($Line, array $Block = null)
protected function blockTable($Line, ?array $Block = null)
{
if ( ! isset($Block) or isset($Block['type']) or isset($Block['interrupted']))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ public function loadLambda($source, $delims = null)
*
* @return Mustache_Template
*/
private function loadSource($source, Mustache_Cache $cache = null)
private function loadSource($source, ?Mustache_Cache $cache = null)
{
$className = $this->getTemplateClassName($source);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function setPragmas(array $pragmas)
*
* @return array Mustache Token parse tree
*/
private function buildTree(array &$tokens, array $parent = null)
private function buildTree(array &$tokens, ?array $parent = null)
{
$nodes = array();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ abstract class BaseInstaller
* @param Composer $composer
* @param IOInterface $io
*/
public function __construct(PackageInterface $package = null, Composer $composer = null, IOInterface $io = null)
public function __construct(?PackageInterface $package = null, ?Composer $composer = null, ?IOInterface $io = null)
{
$this->composer = $composer;
$this->package = $package;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class JWK
*
* @uses parseKey
*/
public static function parseKeySet(array $jwks, string $defaultAlg = null): array
public static function parseKeySet(array $jwks, ?string $defaultAlg = null): array
{
$keys = [];

Expand Down Expand Up @@ -86,7 +86,7 @@ public static function parseKeySet(array $jwks, string $defaultAlg = null): arra
*
* @uses createPemFromModulusAndExponent
*/
public static function parseKey(array $jwk, string $defaultAlg = null): ?Key
public static function parseKey(array $jwk, ?string $defaultAlg = null): ?Key
{
if (empty($jwk)) {
throw new InvalidArgumentException('JWK must not be empty');
Expand Down
2 changes: 1 addition & 1 deletion dt-mapping/geocode-api/location-grid-geocoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ public function query_level_by_lnglat( float $longitude, float $latitude, int $l
return $query;
}

public function query_lowest_level_by_lnglat( float $longitude, float $latitude, string $country_code = null ): array {
public function query_lowest_level_by_lnglat( float $longitude, float $latitude, ?string $country_code = null ): array {
global $wpdb;

if ( is_null( $country_code ) ) {
Expand Down
4 changes: 2 additions & 2 deletions dt-mapping/location-grid-meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public static function add_location_grid_meta( $post_id, array $location_grid_me
return $wpdb->insert_id;
}

public static function delete_location_grid_meta( int $post_id, $type, int $value, array $existing_post = null ) {
public static function delete_location_grid_meta( int $post_id, $type, int $value, ?array $existing_post = null ) {
global $wpdb;

$status = false;
Expand Down Expand Up @@ -274,7 +274,7 @@ public static function add_user_location_grid_meta( $user_id, $location_grid_met
return $wpdb->insert_id;
}

public static function delete_user_location_grid_meta( int $user_id, $type, $grid_meta_id, array $existing_post = null ) {
public static function delete_user_location_grid_meta( int $user_id, $type, $grid_meta_id, ?array $existing_post = null ) {
global $wpdb;

$status = false;
Expand Down
4 changes: 2 additions & 2 deletions dt-metrics/contacts/sources.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ private static function check_date_string( string $str ) {
* ];
*
*/
public static function get_source_data_from_db( string $from = null, string $to = null ) {
public static function get_source_data_from_db( ?string $from = null, ?string $to = null ) {
global $wpdb;

$prepare_args = [ '1' ];
Expand Down Expand Up @@ -236,7 +236,7 @@ public static function get_source_data_from_db( string $from = null, string $to
}


public static function get_sources_milestones( string $from = null, string $to = null ) {
public static function get_sources_milestones( ?string $from = null, ?string $to = null ) {
global $wpdb;

$prepare_args = [ 'milestones' ];
Expand Down
8 changes: 4 additions & 4 deletions dt-posts/posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ public static function format_activity_message( $activity, $post_type_settings )
* @param int $limit
* @return array|object|null
*/
public static function get_recently_viewed_posts( string $post_type, int $user_id = null, int $limit = 30 ){
public static function get_recently_viewed_posts( string $post_type, ?int $user_id = null, int $limit = 30 ){
if ( !$user_id ){
$user_id = get_current_user_id();
}
Expand Down Expand Up @@ -1536,7 +1536,7 @@ public static function check_for_invalid_post_fields( array $post_settings, arra
return $bad_fields;
}

public static function update_multi_select_fields( array $field_settings, int $post_id, array $fields, array $existing_contact = null ){
public static function update_multi_select_fields( array $field_settings, int $post_id, array $fields, ?array $existing_contact = null ){
global $wpdb;
$current_user_id = get_current_user_id();

Expand Down Expand Up @@ -1601,7 +1601,7 @@ public static function update_multi_select_fields( array $field_settings, int $p
return $fields;
}

public static function update_location_grid_fields( array $field_settings, int $post_id, array $fields, $post_type, array $existing_post = null ){
public static function update_location_grid_fields( array $field_settings, int $post_id, array $fields, $post_type, ?array $existing_post = null ){

global $wpdb;
foreach ( $fields as $field_key => $field ){
Expand Down Expand Up @@ -1808,7 +1808,7 @@ public static function update_post_user_select( string $post_type, int $post_id,
return true;
}

public static function update_post_contact_methods( array $post_settings, int $post_id, array $fields, array $existing_contact = null ){
public static function update_post_contact_methods( array $post_settings, int $post_id, array $fields, ?array $existing_contact = null ){
// update contact details (phone, facebook, etc)
foreach ( $post_settings['fields'] as $field_key => $field_settings ) {
if ( $field_settings['type'] !== 'communication_channel' ){
Expand Down
2 changes: 1 addition & 1 deletion dt-users/users-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ function dt_build_user_fields_display( array $usermeta ): array
*
* @return bool
*/
function dt_user_notification_is_enabled( string $notification_name, string $channel, array $user_meta_data = null, int $user_id = null ): bool
function dt_user_notification_is_enabled( string $notification_name, string $channel, ?array $user_meta_data = null, ?int $user_id = null ): bool
{
if ( empty( $user_id ) ) {
$user_id = get_current_user_id();
Expand Down
4 changes: 2 additions & 2 deletions dt-users/users.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public static function get_users_fields( $from_cache = true ){
* @param bool $get_all
* @return array|WP_Error
*/
public static function get_assignable_users_compact( string $search_string = null, bool $get_all = false, string $post_type = null ) {
public static function get_assignable_users_compact( ?string $search_string = null, bool $get_all = false, ?string $post_type = null ) {
if ( !current_user_can( 'access_contacts' ) ) {
return new WP_Error( __FUNCTION__, __( 'No permissions to assign', 'disciple_tools' ), [ 'status' => 403 ] );
}
Expand Down Expand Up @@ -924,7 +924,7 @@ public static function update_settings_on_user( int $user_id, $body ){
*
* @return array
*/
public static function switch_preference( int $user_id, string $preference_key, string $type = null ) {
public static function switch_preference( int $user_id, string $preference_key, ?string $type = null ) {

$value = get_user_meta( $user_id, $preference_key, true );

Expand Down