diff --git a/phpstan.neon b/phpstan.neon index 13109ce..44b6f3e 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -7,5 +7,3 @@ parameters: - src bootstrapFiles: - tests/bootstrap.php - ignoreErrors: - - '#Unsafe usage of new static\(\)#' diff --git a/src/Frontend/BookingPage.php b/src/Frontend/BookingPage.php index 66a6326..f0c0c01 100644 --- a/src/Frontend/BookingPage.php +++ b/src/Frontend/BookingPage.php @@ -3,17 +3,13 @@ declare(strict_types=1); namespace Unsupervised\Schedular\Frontend; -use Unsupervised\Schedular\Data\AvailabilityRepository; -use Unsupervised\Schedular\Data\BookingRepository; use Unsupervised\Schedular\Roles\RoleManager; class BookingPage { - public function __construct( - private AvailabilityRepository $availability, - private BookingRepository $bookings, - ) {} - + /** + * @param array $atts + */ public function render(array $atts): string { if (! is_user_logged_in()) { diff --git a/src/Frontend/LoginPage.php b/src/Frontend/LoginPage.php index b898686..d779753 100644 --- a/src/Frontend/LoginPage.php +++ b/src/Frontend/LoginPage.php @@ -5,10 +5,13 @@ namespace Unsupervised\Schedular\Frontend; class LoginPage { + /** + * @param array $atts + */ public function render(array $atts): string { if (is_user_logged_in()) { - $redirect = esc_url(get_permalink()); + $redirect = esc_url((string) get_permalink()); return sprintf( '

%s %s.

', esc_html__('You are already logged in.', 'unsupervised-schedular'), @@ -18,7 +21,7 @@ class LoginPage } $error = ''; - $redirect = sanitize_url(get_permalink() ?? ''); + $redirect = sanitize_url((string) get_permalink()); if (isset($_POST['us_login']) && check_admin_referer('us_student_login')) { $credentials = [ diff --git a/src/Frontend/ShortcodeRegistrar.php b/src/Frontend/ShortcodeRegistrar.php index 789f16f..4eaaf2c 100644 --- a/src/Frontend/ShortcodeRegistrar.php +++ b/src/Frontend/ShortcodeRegistrar.php @@ -3,17 +3,14 @@ declare(strict_types=1); namespace Unsupervised\Schedular\Frontend; -use Unsupervised\Schedular\Data\AvailabilityRepository; -use Unsupervised\Schedular\Data\BookingRepository; - class ShortcodeRegistrar { private BookingPage $bookingPage; private LoginPage $loginPage; - public function __construct(AvailabilityRepository $availability, BookingRepository $bookings) + public function __construct() { - $this->bookingPage = new BookingPage($availability, $bookings); + $this->bookingPage = new BookingPage(); $this->loginPage = new LoginPage(); } diff --git a/src/Model/AvailabilitySlot.php b/src/Model/AvailabilitySlot.php index 991eb6f..f994e9f 100644 --- a/src/Model/AvailabilitySlot.php +++ b/src/Model/AvailabilitySlot.php @@ -24,6 +24,9 @@ class AvailabilitySlot ); } + /** + * @return array + */ public function toArray(): array { return [ diff --git a/src/Model/Lesson.php b/src/Model/Lesson.php index e71716a..37d630e 100644 --- a/src/Model/Lesson.php +++ b/src/Model/Lesson.php @@ -33,6 +33,9 @@ class Lesson ); } + /** + * @return array + */ public function toArray(): array { return [ diff --git a/src/Plugin.php b/src/Plugin.php index 2f429c6..e9131d5 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -23,6 +23,6 @@ class Plugin (new RoleManager())->register(); (new AdminMenu($availability, $bookings))->register(); (new RestRegistrar($availability, $bookings))->register(); - (new ShortcodeRegistrar($availability, $bookings))->register(); + (new ShortcodeRegistrar())->register(); } }