Skip to content

Commit

Permalink
Merge pull request #7200 from pods-framework/release/3.0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
sc0ttkclark authored Oct 19, 2023
2 parents 52daa18 + f5c0b3a commit fbb2e66
Show file tree
Hide file tree
Showing 15 changed files with 709 additions and 127 deletions.
537 changes: 537 additions & 0 deletions changelog.txt

Large diffs are not rendered by default.

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]
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]
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
29 changes: 15 additions & 14 deletions classes/PodsAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -4844,10 +4844,22 @@ public function save_pod_item( $params ) {
return $ids;
}

// Get array of Pods
$pod = $this->load_pod( array( 'id' => $params->pod_id, 'name' => $params->pod ), false );

if ( false === $pod ) {
// Bypass if doing a normal object sync from PodsMeta.
if ( $params->podsmeta ) {
return;
}

return pods_error( __( 'Pod not found', 'pods' ), $error_mode );
}

// 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 All @@ -4869,18 +4881,6 @@ public function save_pod_item( $params ) {
$allow_custom_fields = true;
}

// Get array of Pods
$pod = $this->load_pod( array( 'id' => $params->pod_id, 'name' => $params->pod ), false );

if ( false === $pod ) {
// Bypass if doing a normal object sync from PodsMeta.
if ( $params->podsmeta ) {
return;
}

return pods_error( __( 'Pod not found', 'pods' ), $error_mode );
}

$params->pod = $pod['name'];
$params->pod_id = $pod['id'];

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]
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]
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]
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]
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
1 change: 1 addition & 0 deletions classes/PodsForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ private function __construct() {
*
* @since 2.3.0
*/
#[\ReturnTypeWillChange]
private function __clone() {
// Hulk smash
}
Expand Down
Loading

0 comments on commit fbb2e66

Please sign in to comment.