Skip to content
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

Fix deprecation warnings #1746

Merged
merged 18 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
34a62f5
chore: drop <7.4 PHP version support
antoscarface Oct 9, 2024
ffa94f4
fix: deprecated variable in string usage
antoscarface Oct 9, 2024
282e985
chore: upgrade action-scheduler library to fix warnings
antoscarface Oct 15, 2024
6ae06dd
chore: upgrade common dependencies to fix deprecated warnings
antoscarface Oct 11, 2024
cc74857
fix: deprecation warnings due to missing parent slug admin page
antoscarface Oct 11, 2024
e1f8d25
chore: enforce requirements check by wp
antoscarface Oct 11, 2024
4728c2c
chore: fix deprecated hooks
antoscarface Oct 11, 2024
4a30d21
fix: support missing relations index
antoscarface Oct 11, 2024
ff8a265
fixup! chore: upgrade common dependencies to fix deprecated warnings
antoscarface Oct 15, 2024
b9be5fa
fix: deprecated different return type of jsonSerializable interface
antoscarface Oct 15, 2024
a517d34
fix: Deprecated: preg_replace(): Passing null to parameter #3 ()
antoscarface Oct 15, 2024
aa9f1f2
fixup! fix: deprecated different return type of jsonSerializable inte…
antoscarface Oct 15, 2024
89e5f59
fix: Deprecated: Automatic conversion of false to array is deprecated
antoscarface Oct 15, 2024
1559594
fix: Deprecated: json_decode(): Passing null to parameter #1 () of ty…
antoscarface Oct 15, 2024
bfff6a4
fixup! chore: upgrade action-scheduler library to fix warnings
antoscarface Oct 22, 2024
d338c89
fixup! chore: drop <7.4 PHP version support
antoscarface Oct 25, 2024
3568cb5
chore: fix lint issues
antoscarface Oct 25, 2024
1910baa
chore: remove not supported PHP versions from CI matrix
antoscarface Oct 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion src/admin/class-wordlift-admin-entity-type-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function admin_menu() {
*/
// @todo: use the new {@link Wordlift_Admin_Page}.
add_submenu_page(
null,
'wl_entity_type_settings',
__( 'Edit Entity term', 'wordlift' ),
__( 'Edit Entity term', 'wordlift' ),
'manage_options',
Expand Down
2 changes: 1 addition & 1 deletion src/admin/elements/class-wordlift-admin-select-element.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class="<?php echo esc_attr( $params['class'] ); ?>"
$this->print_notice( $params['notice'] );

// Print the field description.
echo wp_kses( $this->get_description( $params['description'] ), array( 'p' => array() ) );
echo wp_kses( $this->get_description( $params['description'] ) ?? '', array( 'p' => array() ) );

return $this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ private function is_started( $state ) {
*/
public function start() {
$action = $this->get_action_key();
$this->log->debug( "Trying to start ${action}..." );
$this->log->debug( sprintf( "Trying to start %s...", $action ) );
// Create a new Sync_Model state of `started`.
if ( ! $this->is_started( self::get_state() ) ) {
$this->log->debug( 'Starting...' );
Expand Down Expand Up @@ -96,7 +96,7 @@ public function start() {
public function cancel() {

$action = $this->action;
$this->log->debug( "Cancelling ${action}..." );
$this->log->debug( sprintf( 'Cancelling %s...', $action ) );

// Cleanup the process data.
$this->cancel_process();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public function get_type() {
return $this->type;
}

#[\ReturnTypeWillChange]
public function jsonSerialize() {
return array(
'id' => $this->id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function get_menu_title() {
}

protected function get_parent_slug() {
return null;
return 'wl_google_addon_import';
}

public function render() {
Expand Down
2 changes: 1 addition & 1 deletion src/classes/mappings/pages/class-edit-mappings-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private function load_text_settings_for_edit_mapping_page( array $edit_mapping_s
* @return null return null to avoid this page to be displayed in WordLift's menu.
*/
protected function get_parent_slug() {
return null;
return 'wl_edit_mappings';
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/classes/relation/class-relation.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ public static function from_relation_instances( $instance ) {
);
}

#[\ReturnTypeWillChange]
public function jsonSerialize() {
return array(
'subject' => $this->get_subject(),
Expand Down
8 changes: 5 additions & 3 deletions src/classes/relation/class-relations.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,22 +61,23 @@ public function contains( Relation ...$values ) {
return true;
}

public function offsetSet( $offset, $value ) {
public function offsetSet( $offset, $value ): void {
if ( $offset === null ) {
$this->container[] = $value;
} else {
$this->container[ $offset ] = $value;
}
}

public function offsetExists( $offset ) {
public function offsetExists( $offset ): bool {
return isset( $this->container[ $offset ] );
}

public function offsetUnset( $offset ) {
public function offsetUnset( $offset ): void {
unset( $this->container[ $offset ] );
}

#[\ReturnTypeWillChange]
public function offsetGet( $offset ) {
return isset( $this->container[ $offset ] ) ? $this->container[ $offset ] : null;
}
Expand All @@ -85,6 +86,7 @@ public function toArray() {
return $this->container;
}

#[\ReturnTypeWillChange]
public function jsonSerialize() {
return $this->container;
}
Expand Down
4 changes: 2 additions & 2 deletions src/classes/vocabulary-terms/class-entity-type.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ public function save_field( $term_id ) {
public function init_ui_and_save_handlers() {
$taxonomies = Terms_Compat::get_public_taxonomies();
foreach ( $taxonomies as $taxonomy ) {
add_action( "${taxonomy}_edit_form_fields", array( $this, 'render_ui' ), 1 );
add_action( "edited_${taxonomy}", array( $this, 'save_field' ) );
add_action( "{$taxonomy}_edit_form_fields", array( $this, 'render_ui' ), 1 );
add_action( "edited_{$taxonomy}", array( $this, 'save_field' ) );
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/classes/vocabulary-terms/class-term-metabox.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public function save_field( $term_id ) {
public function init_all_custom_fields() {
$taxonomies = Terms_Compat::get_public_taxonomies();
foreach ( $taxonomies as $taxonomy ) {
add_action( "${taxonomy}_edit_form", array( $this, 'render_ui' ), 1 );
add_action( "edited_${taxonomy}", array( $this, 'save_field' ) );
add_action( "{$taxonomy}_edit_form", array( $this, 'render_ui' ), 1 );
add_action( "edited_{$taxonomy}", array( $this, 'save_field' ) );
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/classes/vocabulary-terms/jsonld/class-post-jsonld.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function init() {

public function wl_post_jsonld_array( $data, $post_id ) {

$relations = $data['relations'];
$relations = $data['relations'] ?? null;

if ( ! is_a( $relations, 'Wordlift\Relation\Relations' ) ) {
return $data;
Expand Down
6 changes: 5 additions & 1 deletion src/includes/class-wordlift-entity-type-service.php
Original file line number Diff line number Diff line change
Expand Up @@ -456,11 +456,15 @@ function ( $item ) {
*
* @param int $term_id The term ID.
*
* @return array An array of custom fields (see `custom_fields` in Wordlift_Schema_Service).
* @return array|null An array of custom fields (see `custom_fields` in Wordlift_Schema_Service).
* @since 3.32.0
*/
public function get_custom_fields_for_term( $term_id ) {
$selected_entity_types = get_term_meta( $term_id, 'wl_entity_type' );
if ( ! is_array( $selected_entity_types )) {
return null;
}

$selected_entity_types[] = 'thing';
$selected_entity_types = array_unique( $selected_entity_types );

Expand Down
4 changes: 3 additions & 1 deletion src/includes/class-wordlift.php
Original file line number Diff line number Diff line change
Expand Up @@ -1698,7 +1698,9 @@ private function define_admin_hooks( $that ) {
* @since 3.23.0
*/
add_filter(
'allowed_block_types',
version_compare( get_bloginfo( 'version' ), '5.8', '>=' )
? 'allowed_block_types_all'
: 'allowed_block_types',
function ( $value ) {

if ( true === $value ) {
Expand Down
24 changes: 0 additions & 24 deletions src/libraries/action-scheduler/.editorconfig

This file was deleted.

14 changes: 0 additions & 14 deletions src/libraries/action-scheduler/.gitattributes

This file was deleted.

15 changes: 0 additions & 15 deletions src/libraries/action-scheduler/.github/release-drafter.yml

This file was deleted.

97 changes: 0 additions & 97 deletions src/libraries/action-scheduler/.github/workflows/pr-unit-tests.yml

This file was deleted.

5 changes: 0 additions & 5 deletions src/libraries/action-scheduler/.gitignore

This file was deleted.

57 changes: 0 additions & 57 deletions src/libraries/action-scheduler/Gruntfile.js

This file was deleted.

Loading
Loading