From 77ee8c5a68168b3b89661891d49318db86a62658 Mon Sep 17 00:00:00 2001 From: Miroslav Mitev Date: Mon, 4 Nov 2024 14:43:58 +0200 Subject: [PATCH] Fix psalm issues --- config/psalm/psalm-baseline.xml | 87 +++++++++++++++++++---------- includes/class-sensei-lesson.php | 11 +--- includes/class-sensei-posttypes.php | 8 +-- psalm.xml | 5 ++ 4 files changed, 69 insertions(+), 42 deletions(-) diff --git a/config/psalm/psalm-baseline.xml b/config/psalm/psalm-baseline.xml index 02fb9eb024..e2e377f19f 100644 --- a/config/psalm/psalm-baseline.xml +++ b/config/psalm/psalm-baseline.xml @@ -1789,9 +1789,8 @@ $user_id $which - + $file - $name $page_slug @@ -2403,6 +2402,13 @@ new $class_name() + + $course + $lesson + $messages + $question + $quiz + $role_caps $slider_labels @@ -2422,17 +2428,12 @@ get_queried_object()->ID get_queried_object()->post_type - + $course $lesson $messages $question $quiz - WooThemes_Sensei_PostTypes - WooThemes_Sensei_PostTypes - WooThemes_Sensei_PostTypes - WooThemes_Sensei_PostTypes - WooThemes_Sensei_PostTypes $post instanceof WP_Post @@ -2504,6 +2505,10 @@ $question_id Sensei()->lesson->get_course_id( $lesson_id ) + + $meta_fields + $token + $post $post_id @@ -2695,6 +2700,19 @@ string string + + $errors + $fields + $has_imageselector + $has_range + $has_tabs + $page_slug + $sections + $settings + $settings_version + $token + $token_legacy + $section $type @@ -2736,6 +2754,30 @@ get_current_screen()->id + + Sensei_Settings + Sensei_Settings + Sensei_Settings + Sensei_Settings + Sensei_Settings + Sensei_Settings + Sensei_Settings + Sensei_Settings + Sensei_Settings + Sensei_Settings + Sensei_Settings + WooThemes_Sensei_Settings + WooThemes_Sensei_Settings + WooThemes_Sensei_Settings + WooThemes_Sensei_Settings + WooThemes_Sensei_Settings + WooThemes_Sensei_Settings + WooThemes_Sensei_Settings + WooThemes_Sensei_Settings + WooThemes_Sensei_Settings + WooThemes_Sensei_Settings + WooThemes_Sensei_Settings + empty( $template->title ) @@ -4181,11 +4223,9 @@ global $sensei_email_data; - - $heading + $learner $recipient - $subject $teacher $template @@ -4364,6 +4404,9 @@ is_wp_error( $result ) + + \ReturnTypeWillChange + $timestamp @@ -4377,6 +4420,9 @@ false false + + \ReturnTypeWillChange + array @@ -4432,8 +4478,7 @@ $post $post - - get_edit_post_link( $post ) + get_edit_post_link( $post->ID ) @@ -4970,13 +5015,6 @@ - - WP_HTTP - - - $result[ $student_id ][ $course_id ] - $result[ $student_id ][ $course_id ] - $edit_course_cap @@ -5013,8 +5051,7 @@ WP_HTTP WP_HTTP - - $result[ $user_id ][ $course_id ] + $result[ $user_id ][ $course_id ] @@ -5249,12 +5286,6 @@ - - $post_args - - - $post_args - $question_categories diff --git a/includes/class-sensei-lesson.php b/includes/class-sensei-lesson.php index a03593d3c4..8412af07d5 100755 --- a/includes/class-sensei-lesson.php +++ b/includes/class-sensei-lesson.php @@ -57,15 +57,6 @@ class Sensei_Lesson { */ private $lesson_id_updating; - /** - * Message to display on the legacy quiz meta boxes. - * - * @since 3.9.1 - * - * @var string - */ - private $legacy_quiz_message; - /** * Constructor. * @@ -1245,7 +1236,7 @@ public function lesson_course_meta_box_content() { } /** - * Get the legazy quiz message. + * Get the message to display on the legacy quiz meta boxes. * * @return string */ diff --git a/includes/class-sensei-posttypes.php b/includes/class-sensei-posttypes.php index 06fc77bd50..1854bc9863 100755 --- a/includes/class-sensei-posttypes.php +++ b/includes/class-sensei-posttypes.php @@ -910,11 +910,11 @@ public function setup_lesson_tag_taxonomy() { /** * Get the singular, plural and menu label names for the post types. * - * @param string $post_type The post type. + * @param string|null $post_type The post type. * - * @return string[] + * @return array */ - private function get_main_post_type_labels( $post_type ) { + private function get_main_post_type_labels( $post_type = null ) { $labels = array( 'course' => array( 'singular' => __( 'Course', 'sensei-lms' ), @@ -948,7 +948,7 @@ private function get_main_post_type_labels( $post_type ) { ), ); - return $labels[ $post_type ]; + return $post_type ? $labels[ $post_type ] : $labels; } /** diff --git a/psalm.xml b/psalm.xml index c78dd94e95..2f153e5b36 100644 --- a/psalm.xml +++ b/psalm.xml @@ -32,6 +32,11 @@ + + + + +