Skip to content

Commit

Permalink
Phpstan fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sc0ttkclark committed Aug 28, 2024
1 parent 091c677 commit a4c3365
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 22 deletions.
2 changes: 1 addition & 1 deletion classes/PodsAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -8333,7 +8333,7 @@ public function get_pod_type_count( $type ) {
*
* @param bool $strict Makes sure the pod exists, throws an error if it doesn't work.
*
* @return Pods\Whatsit\Pod|false Pod object or false if not found.
* @return Pods\Whatsit\Pod|false|WP_Error Pod object or false if not found.
*
* @throws Exception
* @since 1.7.9
Expand Down
1 change: 1 addition & 0 deletions classes/PodsForm.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

use Pods\Whatsit\Field;
use Pods\API\Whatsit\Value_Field;

/**
* @package Pods
Expand Down
20 changes: 5 additions & 15 deletions classes/PodsMeta.php
Original file line number Diff line number Diff line change
Expand Up @@ -1052,10 +1052,9 @@ public function groups_get( $type, $name, $default_fields = null, $full_objects
*
* @since 2.6.6
*
* @param array $groups Array of groups
* @param string $type The type of Pod
* @param string $name Name of the Pod
*
* @param array $groups Array of groups
*/
$groups = apply_filters( 'pods_meta_groups_get', $groups, $type, $name );

Expand Down Expand Up @@ -2345,7 +2344,7 @@ public function save_user_track_changed_fields( $user_login ) {
if ( ! $no_conflict ) {
$user = get_user_by( 'login', $user_login );

if ( $user && ! is_wp_error( $user ) ) {
if ( $user instanceof WP_User ) {
$pod = 'user';
$id = $user->ID;

Expand Down Expand Up @@ -4324,10 +4323,6 @@ public function update_meta( $object_type, $_null = null, $object_id = 0, $meta_
}

$pod->data->row[ $meta_key ] = $meta_value;

if ( isset( $meta_cache[ '_pods_' . $key ] ) && $field_object && in_array( $field_object['type'], $tableless_field_types, true ) ) {
unset( $meta_cache[ '_pods_' . $key ] );
}
}

$pod->save( $meta_key, $meta_value, $object_id, array(
Expand Down Expand Up @@ -4594,11 +4589,9 @@ public static function split_shared_term( $term_id, $new_term_id, $term_taxonomy

/**
* @param $id
*
* @return bool
*/
public function delete_user( $id ) {
return $this->delete_object( 'user', $id );
$this->delete_object( 'user', $id );
}

/**
Expand All @@ -4607,17 +4600,14 @@ public function delete_user( $id ) {
* @return bool
*/
public function delete_comment( $id ) {
return $this->delete_object( 'comment', $id );
$this->delete_object( 'comment', $id );

Check failure on line 4603 in classes/PodsMeta.php

View workflow job for this annotation

GitHub Actions / phpstan / phpstan (8.2)

Method PodsMeta::delete_comment() should return bool but return statement is missing.

Check failure on line 4603 in classes/PodsMeta.php

View workflow job for this annotation

GitHub Actions / phpstan / phpstan (8.3)

Method PodsMeta::delete_comment() should return bool but return statement is missing.
}

/**
* @param $id
*
* @return bool
*/
public function delete_media( $id ) {

return $this->delete_object( 'media', $id );
$this->delete_object( 'media', $id );
}

/**
Expand Down
12 changes: 7 additions & 5 deletions components/Pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ public function clear_cache( $data, $pod = null, $id = null, $groups = null, $po
* @param $text
* @param $post
*
* @return string|void
* @return string
*/
public function set_title_text( $text, $post ) {
return __( 'Enter URL here', 'pods' );
Expand Down Expand Up @@ -991,7 +991,7 @@ public function page_check() {
*
* @param bool $pods_page
*
* @return string
* @return string|false
*/
public static function content( $return = false, $pods_page = false ) {

Expand Down Expand Up @@ -1060,6 +1060,8 @@ public static function content( $return = false, $pods_page = false ) {
}

echo $content;

return '';
}

/**
Expand All @@ -1084,8 +1086,8 @@ public function precode() {
if ( $permission ) {
$content = false;

if ( ! is_object( $pods ) && 404 != $pods && 0 < strlen( (string) pods_var( 'pod', self::$exists['options'] ) ) ) {
$slug = pods_var_raw( 'pod_slug', self::$exists['options'], null, null, true );
if ( ! is_object( $pods ) && 404 != $pods && 0 < strlen( (string) pods_v( 'pod', self::$exists['options'] ) ) ) {
$slug = pods_v( 'pod_slug', self::$exists['options'], null, null, true );

$has_slug = 0 < strlen( $slug );

Expand All @@ -1094,7 +1096,7 @@ public function precode() {
$slug = pods_evaluate_tags( $slug, true );
}

$pods = pods_get_instance( pods_var( 'pod', self::$exists['options'] ), $slug );
$pods = pods_get_instance( pods_v_sanitized( 'pod', self::$exists['options'] ), $slug );

// Auto 404 handling if item doesn't exist
if ( $has_slug && ( empty( $slug ) || ! $pods->exists() ) && apply_filters( 'pods_pages_auto_404', true, $slug, $pods, self::$exists ) ) {
Expand Down
2 changes: 1 addition & 1 deletion components/Templates/Templates.php
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ public function clear_cache( $data, $pod = null, $id = null, $groups = null, $po
* @param $text
* @param $post
*
* @return string|void
* @return string
*/
public function set_title_text( $text, $post ) {
return __( 'Enter template name here', 'pods' );
Expand Down

0 comments on commit a4c3365

Please sign in to comment.