From 646ba277945b92f934c77cd780e57350557e5d61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Sat, 1 Apr 2023 17:51:29 -0300 Subject: [PATCH] Add missing native parameter type declarations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: MaurĂ­cio Meneghini Fauth --- examples/openid.php | 4 ++-- examples/signon-script.php | 2 +- libraries/classes/Pdf.php | 2 +- libraries/classes/Plugins/Export/Helpers/Pdf.php | 4 ++-- phpcs.xml.dist | 3 --- 5 files changed, 6 insertions(+), 9 deletions(-) diff --git a/examples/openid.php b/examples/openid.php index 91ce8406f0..bfe30da397 100644 --- a/examples/openid.php +++ b/examples/openid.php @@ -33,7 +33,7 @@ $authMap = ['https://launchpad.net/~username' => ['user' => 'root', 'password' = * * @param string $contents Content to include in page */ -function Show_page($contents): void +function Show_page(string $contents): void { header('Content-Type: text/html; charset=utf-8'); @@ -62,7 +62,7 @@ function Show_page($contents): void * * @param Exception $e Exception object */ -function Die_error($e): void +function Die_error(Throwable $e): void { $contents = "
\n"; $contents .= '
' . htmlspecialchars($e->getMessage()) . "
\n"; diff --git a/examples/signon-script.php b/examples/signon-script.php index 0b27a0bbcf..6688fd68aa 100644 --- a/examples/signon-script.php +++ b/examples/signon-script.php @@ -20,7 +20,7 @@ declare(strict_types=1); * * @return array */ -function get_login_credentials($user): array +function get_login_credentials(string $user): array { /* Optionally we can use passed username */ if (! empty($user)) { diff --git a/libraries/classes/Pdf.php b/libraries/classes/Pdf.php index 67869b469c..b76e7dca20 100644 --- a/libraries/classes/Pdf.php +++ b/libraries/classes/Pdf.php @@ -130,7 +130,7 @@ class Pdf extends TCPDF * @param string $errorMessage the error message */ // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps - public function Error($errorMessage = ''): void + public function Error(mixed $errorMessage = ''): void { echo Message::error( __('Error while creating PDF:') . ' ' . $errorMessage, diff --git a/libraries/classes/Plugins/Export/Helpers/Pdf.php b/libraries/classes/Plugins/Export/Helpers/Pdf.php index 3f8048beb2..08676eb1a2 100644 --- a/libraries/classes/Plugins/Export/Helpers/Pdf.php +++ b/libraries/classes/Plugins/Export/Helpers/Pdf.php @@ -103,7 +103,7 @@ class Pdf extends PdfLib * @param bool $addpage if true add a page, otherwise only return * the true/false state */ - public function checkPageBreak($h = 0, $y = '', $addpage = true): bool + public function checkPageBreak(mixed $h = 0, mixed $y = '', mixed $addpage = true): bool { if (TCPDF_STATIC::empty_string($y)) { $y = $this->y; @@ -296,7 +296,7 @@ class Pdf extends PdfLib * * @param float $topMargin the margin */ - public function setTopMargin($topMargin): void + public function setTopMargin(mixed $topMargin): void { $this->tMargin = $topMargin; } diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 45ea036b7b..9777193798 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -42,9 +42,6 @@ 4 - - 4 - 4