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

Pods 3.0.7 #7200

Merged
merged 9 commits into from
Oct 19, 2023
18 changes: 10 additions & 8 deletions classes/Pods.php
Original file line number Diff line number Diff line change
Expand Up @@ -4593,6 +4593,7 @@ private function do_hook( $name ) {
*
* @since 2.0.0
*/
#[\ReturnTypeWillChange]
sc0ttkclark marked this conversation as resolved.
Show resolved Hide resolved
public function __get( $name ) {
$name = (string) $name;

Expand Down Expand Up @@ -4659,7 +4660,7 @@ public function __get( $name ) {
*
* @since 2.8.0
*/
public function __set( $name, $value ) {
public function __set( $name, $value ): void {
$name = (string) $name;

$supported_pods_data = array(
Expand Down Expand Up @@ -4691,7 +4692,7 @@ public function __set( $name, $value ) {
*
* @since 2.8.0
*/
public function __isset( $name ) {
public function __isset( $name ): bool {
$value = $this->__get( $name );

return ( null !== $value );
Expand All @@ -4704,27 +4705,28 @@ public function __isset( $name ) {
*
* @since 2.8.0
*/
public function __unset( $name ) {
public function __unset( $name ): void {
$this->__set( $name, null );
}

/**
* Handle methods that have been deprecated and any aliasing.
*
* @param string $name Function name.
* @param array $args Arguments passed to function.
* @param array $arguments Arguments passed to function.
*
* @return mixed|null
*
* @since 2.0.0
*/
public function __call( $name, $args ) {
#[\ReturnTypeWillChange]
sc0ttkclark marked this conversation as resolved.
Show resolved Hide resolved
public function __call( $name, $arguments ) {

$name = (string) $name;

// select > find alias.
if ( 'select' === $name ) {
return call_user_func_array( array( $this, 'find' ), $args );
return call_user_func_array( array( $this, 'find' ), $arguments );
}

if ( ! $this->deprecated ) {
Expand All @@ -4736,7 +4738,7 @@ public function __call( $name, $args ) {
$pod_class_exists = class_exists( 'Deprecated_Pod' );

if ( method_exists( $this->deprecated, $name ) ) {
return call_user_func_array( array( $this->deprecated, $name ), $args );
return call_user_func_array( array( $this->deprecated, $name ), $arguments );
// @codingStandardsIgnoreLine
} elseif ( ! $pod_class_exists || Deprecated_Pod::$deprecated_notice ) {
pods_deprecated( "Pods::{$name}", '2.0' );
Expand All @@ -4750,7 +4752,7 @@ public function __call( $name, $args ) {
*
* @return string Pod type and name in CURIE notation
*/
public function __toString() {
public function __toString(): string {

$string = '';

Expand Down
5 changes: 3 additions & 2 deletions classes/PodsAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -4847,7 +4847,7 @@ public function save_pod_item( $params ) {
// Allow Helpers to know what's going on, are we adding or saving?
$is_new_item = false;

if ( empty( $params->id ) ) {
if ( empty( $params->id ) && 'settings' !== $pod['type'] ) {
$is_new_item = true;
}

Expand Down Expand Up @@ -4984,7 +4984,7 @@ public function save_pod_item( $params ) {
}

// Handle hidden fields
if ( empty( $params->id ) ) {
if ( empty( $params->id ) && 'settings' !== $pod['type'] ) {
foreach ( $fields as $field => $field_data ) {
if ( in_array( $field, $fields_active, true ) ) {
continue;
Expand Down Expand Up @@ -11490,6 +11490,7 @@ private function do_hook() {
*
* @since 2.0.0
*/
#[\ReturnTypeWillChange]
sc0ttkclark marked this conversation as resolved.
Show resolved Hide resolved
public function __get( $name ) {

$name = (string) $name;
Expand Down
44 changes: 16 additions & 28 deletions classes/PodsArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,12 @@ public function __construct( $container ) {
* @return mixed
* @since 2.0.0
*/
#[\ReturnTypeWillChange]
public function offsetSet( $offset, $value ) {

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

return $value;
}

/**
Expand All @@ -57,7 +53,6 @@ public function offsetSet( $offset, $value ) {
*/
#[\ReturnTypeWillChange]
sc0ttkclark marked this conversation as resolved.
Show resolved Hide resolved
public function offsetGet( $offset ) {

if ( is_array( $this->__container ) ) {
if ( isset( $this->__container[ $offset ] ) ) {
return $this->__container[ $offset ];
Expand All @@ -77,9 +72,7 @@ public function offsetGet( $offset ) {
* @return bool
* @since 2.0.0
*/
#[\ReturnTypeWillChange]
public function offsetExists( $offset ) {

public function offsetExists( $offset ): bool {
if ( is_array( $this->__container ) ) {
return isset( $this->__container[ $offset ] );
}
Expand All @@ -94,9 +87,7 @@ public function offsetExists( $offset ) {
*
* @since 2.0.0
*/
#[\ReturnTypeWillChange]
public function offsetUnset( $offset ) {

public function offsetUnset( $offset ): void {
if ( is_array( $this->__container ) ) {
unset( $this->__container[ $offset ] );
} else {
Expand Down Expand Up @@ -205,52 +196,49 @@ public function dump() {
/**
* Mapping >> offsetSet
*
* @param mixed $offset Property name.
* @param mixed $name Property name.
* @param mixed $value Property value.
*
* @return mixed
* @since 2.0.0
*/
public function __set( $offset, $value ) {

return $this->offsetSet( $offset, $value );
public function __set( $name, $value ): void {
$this->offsetSet( $name, $value );
}

/**
* Mapping >> offsetGet
*
* @param mixed $offset Property name.
* @param mixed $name Property name.
*
* @return mixed|null
* @since 2.0.0
*/
public function __get( $offset ) {

return $this->offsetGet( $offset );
#[\ReturnTypeWillChange]
sc0ttkclark marked this conversation as resolved.
Show resolved Hide resolved
public function __get( $name ) {
return $this->offsetGet( $name );
}

/**
* Mapping >> offsetExists
*
* @param mixed $offset Property name.
* @param mixed $name Property name.
*
* @return bool
* @since 2.0.0
*/
public function __isset( $offset ) {

return $this->offsetExists( $offset );
public function __isset( $name ): bool {
return $this->offsetExists( $name );
}

/**
* Mapping >> offsetUnset
*
* @param mixed $offset Property name.
* @param mixed $name Property name.
*
* @since 2.0.0
*/
public function __unset( $offset ) {

$this->offsetUnset( $offset );
public function __unset( $name ): void {
$this->offsetUnset( $name );
}
}
17 changes: 9 additions & 8 deletions classes/PodsData.php
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ public function insert( $table, $data, $format = null ) {
}
}

list( $table, $data, $format ) = self::do_hook( 'insert', array( $table, $data, $format ), $this );
[ $table, $data, $format ] = self::do_hook( 'insert', array( $table, $data, $format ), $this );

$result = $wpdb->insert( $table, $data, $format );
$this->insert_id = $wpdb->insert_id;
Expand Down Expand Up @@ -560,7 +560,7 @@ public function update( $table, $data, $where, $format = null, $where_format = n
}
}

list( $table, $data, $where, $format, $where_format ) = self::do_hook(
[ $table, $data, $where, $format, $where_format ] = self::do_hook(
'update', array(
$table,
$data,
Expand Down Expand Up @@ -626,7 +626,7 @@ public function delete( $table, $where, $where_format = null ) {

$sql = "DELETE FROM `$table` WHERE " . implode( ' AND ', $wheres );

list( $sql, $where ) = self::do_hook(
[ $sql, $where ] = self::do_hook(
'delete', array(
$sql,
array_values( $where ),
Expand Down Expand Up @@ -1965,7 +1965,7 @@ public function reorder( $table, $weight_field, $id_field, $ids ) {
$success = false;
$ids = (array) $ids;

list( $table, $weight_field, $id_field, $ids ) = self::do_hook(
[ $table, $weight_field, $id_field, $ids ] = self::do_hook(
'reorder', array(
$table,
$weight_field,
Expand Down Expand Up @@ -2622,7 +2622,7 @@ public static function prepare( $sql, $data ) {
* @var $wpdb wpdb
*/
global $wpdb;
list( $sql, $data ) = apply_filters( 'pods_data_prepare', array( $sql, $data ) );
[ $sql, $data ] = apply_filters( 'pods_data_prepare', array( $sql, $data ) );

return $wpdb->prepare( $sql, $data );
}
Expand Down Expand Up @@ -3907,6 +3907,7 @@ public static function get_db_field( $params ) {
*
* @since 2.8.0
*/
#[\ReturnTypeWillChange]
sc0ttkclark marked this conversation as resolved.
Show resolved Hide resolved
public function __get( $name ) {
$name = (string) $name;

Expand Down Expand Up @@ -3964,7 +3965,7 @@ public function __get( $name ) {
*
* @since 2.8.0
*/
public function __set( $name, $value ) {
public function __set( $name, $value ): void {
$supported_overrides = array(
'select' => 'select',
'table' => 'table',
Expand Down Expand Up @@ -3992,7 +3993,7 @@ public function __set( $name, $value ) {
*
* @since 2.8.0
*/
public function __isset( $name ) {
public function __isset( $name ): bool {
// Handle alias Pod properties.
$supported_pods_object = array(
'pod' => 'name',
Expand Down Expand Up @@ -4034,7 +4035,7 @@ public function __isset( $name ) {
*
* @since 2.8.0
*/
public function __unset( $name ) {
public function __unset( $name ): void {
// Don't do anything.
return;
}
Expand Down
2 changes: 1 addition & 1 deletion classes/PodsForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private function __construct() {
*
* @since 2.3.0
*/
private function __clone() {
private function __clone(): void {
// Hulk smash
}

Expand Down
24 changes: 12 additions & 12 deletions deprecated/deprecated.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ public function __construct( $type = null, $id = null ) {
*
* @return array|bool|int|mixed|PodsData
*/
#[\ReturnTypeWillChange]
sc0ttkclark marked this conversation as resolved.
Show resolved Hide resolved
public function __get( $name ) {
$name = (string) $name;

Expand Down Expand Up @@ -194,15 +195,11 @@ public function __get( $name ) {
*
* @param string $name Property name.
* @param mixed $value Property value to set.
*
* @return mixed
*/
public function __set( $name, $value ) {
public function __set( $name, $value ): void {
$name = (string) $name;

$this->new->{$name} = $value;

return $value;
}

/**
Expand All @@ -211,14 +208,15 @@ public function __set( $name, $value ) {
* @since 2.0.0
*
* @param string $name Call name.
* @param array $args Call arguments.
* @param array $arguments Call arguments.
*
* @return mixed
*/
public function __call( $name, $args ) {
#[\ReturnTypeWillChange]
sc0ttkclark marked this conversation as resolved.
Show resolved Hide resolved
public function __call( $name, $arguments ) {
$name = (string) $name;

return call_user_func_array( array( $this->new, $name ), $args );
return call_user_func_array( array( $this->new, $name ), $arguments );
}

/**
Expand All @@ -230,7 +228,7 @@ public function __call( $name, $args ) {
*
* @return bool
*/
public function __isset( $name ) {
public function __isset( $name ): bool {
$name = (string) $name;

if ( in_array( $name, array( '_data', 'data', 'total', 'total_rows', 'zebra' ), true ) ) {
Expand Down Expand Up @@ -279,6 +277,7 @@ public function __construct( $type = null, $format = null ) {
*
* @return null|mixed
*/
#[\ReturnTypeWillChange]
sc0ttkclark marked this conversation as resolved.
Show resolved Hide resolved
public function __get( $name ) {
$name = (string) $name;

Expand All @@ -293,14 +292,15 @@ public function __get( $name ) {
* @since 2.0.0
*
* @param string $name Call name.
* @param array $args Call arguments.
* @param array $arguments Call arguments.
*
* @return mixed
*/
public function __call( $name, $args ) {
#[\ReturnTypeWillChange]
sc0ttkclark marked this conversation as resolved.
Show resolved Hide resolved
public function __call( $name, $arguments ) {
$name = (string) $name;

return call_user_func_array( array( $this->new, $name ), $args );
return call_user_func_array( array( $this->new, $name ), $arguments );
}
}

Expand Down
Loading
Loading