From 7cc134afe6fde940c57fd84505fafe3e8d5e2f81 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 | 38 +++-------------------------- includes/class-sensei-lesson.php | 11 +-------- includes/class-sensei-posttypes.php | 8 +++--- psalm.xml | 5 ++++ 4 files changed, 14 insertions(+), 48 deletions(-) diff --git a/config/psalm/psalm-baseline.xml b/config/psalm/psalm-baseline.xml index 02fb9eb024..63500b38af 100644 --- a/config/psalm/psalm-baseline.xml +++ b/config/psalm/psalm-baseline.xml @@ -1789,9 +1789,8 @@ $user_id $which - + $file - $name $page_slug @@ -2422,18 +2421,6 @@ 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 @@ -4181,11 +4168,9 @@ global $sensei_email_data; - - $heading + $learner $recipient - $subject $teacher $template @@ -4432,8 +4417,7 @@ $post $post - - get_edit_post_link( $post ) + get_edit_post_link( $post->ID ) @@ -4970,13 +4954,6 @@ - - WP_HTTP - - - $result[ $student_id ][ $course_id ] - $result[ $student_id ][ $course_id ] - $edit_course_cap @@ -5013,8 +4990,7 @@ WP_HTTP WP_HTTP - - $result[ $user_id ][ $course_id ] + $result[ $user_id ][ $course_id ] @@ -5249,12 +5225,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 @@ + + + + +