From 8d889cce196af4fe67e372cd83fb0181a53728aa Mon Sep 17 00:00:00 2001 From: corsac Date: Wed, 18 Jun 2025 11:30:31 +0100 Subject: [PATCH 1/2] Fix PHP 8.4 deprecation: Implicitly marking parameter as nullable is deprecated, the explicit nullable type must be used instead --- dt-core/configuration/config-site-defaults.php | 2 +- dt-core/libraries/parsedown/Parsedown.php | 6 +++--- .../plugin-update-checker/Puc/v5p1/StateStore.php | 2 +- .../plugin-update-checker/Puc/v5p1/UpdateChecker.php | 2 +- .../plugin-update-checker/vendor/ParsedownModern.php | 4 ++-- .../vendor/mustache/mustache/src/Mustache/Engine.php | 2 +- .../vendor/mustache/mustache/src/Mustache/Parser.php | 2 +- .../installers/src/Composer/Installers/BaseInstaller.php | 2 +- .../includes/vendor/firebase/php-jwt/src/JWK.php | 4 ++-- dt-mapping/geocode-api/location-grid-geocoder.php | 2 +- dt-mapping/location-grid-meta.php | 4 ++-- dt-metrics/contacts/sources.php | 4 ++-- dt-posts/posts.php | 8 ++++---- dt-users/users-template.php | 2 +- dt-users/users.php | 4 ++-- 15 files changed, 25 insertions(+), 25 deletions(-) diff --git a/dt-core/configuration/config-site-defaults.php b/dt-core/configuration/config-site-defaults.php index cc1e675f43..a768cc49cf 100644 --- a/dt-core/configuration/config-site-defaults.php +++ b/dt-core/configuration/config-site-defaults.php @@ -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; diff --git a/dt-core/libraries/parsedown/Parsedown.php b/dt-core/libraries/parsedown/Parsedown.php index ae0cbdecd0..fb5239d1fd 100644 --- a/dt-core/libraries/parsedown/Parsedown.php +++ b/dt-core/libraries/parsedown/Parsedown.php @@ -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}+[.\)]'); @@ -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'])) { @@ -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'])) { diff --git a/dt-core/libraries/plugin-update-checker/Puc/v5p1/StateStore.php b/dt-core/libraries/plugin-update-checker/Puc/v5p1/StateStore.php index b6f6cc103a..65f305e22e 100644 --- a/dt-core/libraries/plugin-update-checker/Puc/v5p1/StateStore.php +++ b/dt-core/libraries/plugin-update-checker/Puc/v5p1/StateStore.php @@ -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; diff --git a/dt-core/libraries/plugin-update-checker/Puc/v5p1/UpdateChecker.php b/dt-core/libraries/plugin-update-checker/Puc/v5p1/UpdateChecker.php index 28480bfa27..47d98e8bb5 100644 --- a/dt-core/libraries/plugin-update-checker/Puc/v5p1/UpdateChecker.php +++ b/dt-core/libraries/plugin-update-checker/Puc/v5p1/UpdateChecker.php @@ -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; } diff --git a/dt-core/libraries/plugin-update-checker/vendor/ParsedownModern.php b/dt-core/libraries/plugin-update-checker/vendor/ParsedownModern.php index 5d96071ba4..fd6c35618f 100644 --- a/dt-core/libraries/plugin-update-checker/vendor/ParsedownModern.php +++ b/dt-core/libraries/plugin-update-checker/vendor/ParsedownModern.php @@ -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'])) { @@ -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'])) { diff --git a/dt-core/libraries/posts-to-posts/vendor/mustache/mustache/src/Mustache/Engine.php b/dt-core/libraries/posts-to-posts/vendor/mustache/mustache/src/Mustache/Engine.php index 08bcc810f3..6a389ee6fe 100644 --- a/dt-core/libraries/posts-to-posts/vendor/mustache/mustache/src/Mustache/Engine.php +++ b/dt-core/libraries/posts-to-posts/vendor/mustache/mustache/src/Mustache/Engine.php @@ -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); diff --git a/dt-core/libraries/posts-to-posts/vendor/mustache/mustache/src/Mustache/Parser.php b/dt-core/libraries/posts-to-posts/vendor/mustache/mustache/src/Mustache/Parser.php index 7d3559b740..8596f3a5e2 100644 --- a/dt-core/libraries/posts-to-posts/vendor/mustache/mustache/src/Mustache/Parser.php +++ b/dt-core/libraries/posts-to-posts/vendor/mustache/mustache/src/Mustache/Parser.php @@ -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(); diff --git a/dt-core/libraries/wp-api-jwt-auth/includes/vendor/composer/installers/src/Composer/Installers/BaseInstaller.php b/dt-core/libraries/wp-api-jwt-auth/includes/vendor/composer/installers/src/Composer/Installers/BaseInstaller.php index 70dde907ed..624f28649b 100644 --- a/dt-core/libraries/wp-api-jwt-auth/includes/vendor/composer/installers/src/Composer/Installers/BaseInstaller.php +++ b/dt-core/libraries/wp-api-jwt-auth/includes/vendor/composer/installers/src/Composer/Installers/BaseInstaller.php @@ -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; diff --git a/dt-core/libraries/wp-api-jwt-auth/includes/vendor/firebase/php-jwt/src/JWK.php b/dt-core/libraries/wp-api-jwt-auth/includes/vendor/firebase/php-jwt/src/JWK.php index 15631ecc24..0f83c67844 100644 --- a/dt-core/libraries/wp-api-jwt-auth/includes/vendor/firebase/php-jwt/src/JWK.php +++ b/dt-core/libraries/wp-api-jwt-auth/includes/vendor/firebase/php-jwt/src/JWK.php @@ -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 = []; @@ -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'); diff --git a/dt-mapping/geocode-api/location-grid-geocoder.php b/dt-mapping/geocode-api/location-grid-geocoder.php index 586cf43712..13418f0d3b 100644 --- a/dt-mapping/geocode-api/location-grid-geocoder.php +++ b/dt-mapping/geocode-api/location-grid-geocoder.php @@ -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 ) ) { diff --git a/dt-mapping/location-grid-meta.php b/dt-mapping/location-grid-meta.php index 50d873b5a2..92ee65aa09 100644 --- a/dt-mapping/location-grid-meta.php +++ b/dt-mapping/location-grid-meta.php @@ -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; @@ -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; diff --git a/dt-metrics/contacts/sources.php b/dt-metrics/contacts/sources.php index 95c9126fa6..818fbe595d 100644 --- a/dt-metrics/contacts/sources.php +++ b/dt-metrics/contacts/sources.php @@ -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' ]; @@ -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' ]; diff --git a/dt-posts/posts.php b/dt-posts/posts.php index fea8f227e8..25e5fda18d 100644 --- a/dt-posts/posts.php +++ b/dt-posts/posts.php @@ -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(); } @@ -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(); @@ -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 ){ @@ -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' ){ diff --git a/dt-users/users-template.php b/dt-users/users-template.php index 68779d81f6..2ad5805d33 100644 --- a/dt-users/users-template.php +++ b/dt-users/users-template.php @@ -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(); diff --git a/dt-users/users.php b/dt-users/users.php index 5b44af7756..5f1623bf9e 100644 --- a/dt-users/users.php +++ b/dt-users/users.php @@ -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 $search_string = null ) { if ( !current_user_can( 'access_contacts' ) ) { return new WP_Error( __FUNCTION__, __( 'No permissions to assign', 'disciple_tools' ), [ 'status' => 403 ] ); } @@ -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 ); From ff23fcf56e953dc70979eafe8c583dcf8485241f Mon Sep 17 00:00:00 2001 From: corsac Date: Wed, 18 Jun 2025 12:15:59 +0100 Subject: [PATCH 2/2] fix --- dt-users/users.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dt-users/users.php b/dt-users/users.php index 5f1623bf9e..22d7872617 100644 --- a/dt-users/users.php +++ b/dt-users/users.php @@ -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 $search_string = 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 ] ); }