From 58adb61e8666b85bbcbe2ae8ef652a2019cb2d00 Mon Sep 17 00:00:00 2001 From: Tang Rufus Date: Tue, 19 Feb 2019 14:19:19 +0000 Subject: [PATCH] Enforce return type hint IssueId: 35443450 Message: The expression ``return wp_unslash($_POST['pass1'] ?? $_POST['password_1'])`` could return the type ``array`` which is incompatible with the type-hinted return ``string``. Consider adding an additional type-check to rule them out. Filename: src/Handlers/FormSubmission.php LineNumber: 41 Link: https://scrutinizer-ci.com/g/ItinerisLtd/disallow-pwned-passwords/inspections/70057df8-67e6-4069-97df-3c98bc02845a/issues/files/src/Handlers/FormSubmission.php?status=new&orderField=path&order=asc&honorSelectedPaths=0&issueId=35443450 --- src/Handlers/FormSubmission.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Handlers/FormSubmission.php b/src/Handlers/FormSubmission.php index c043cb8..9b3036a 100644 --- a/src/Handlers/FormSubmission.php +++ b/src/Handlers/FormSubmission.php @@ -38,6 +38,6 @@ protected function getPasswordCleartextFromSuperglobals(): string return ''; } - return wp_unslash($_POST['pass1'] ?? $_POST['password_1']); // WPCS: input var, CSRF ok. + return (string) wp_unslash($_POST['pass1'] ?? $_POST['password_1']); // WPCS: input var, CSRF ok. } }