From 4711674ec05dbc0475cc6549ea4d5cc2ccd5dd8b Mon Sep 17 00:00:00 2001 From: Nicolas CARPi Date: Thu, 29 Dec 2022 13:32:02 +0100 Subject: [PATCH] crank phpstan to level 6 --- lib/Providers/Qr/HandlesDataUri.php | 3 +++ lib/Providers/Time/HttpTimeProvider.php | 21 ++++++++------------- lib/TwoFactorAuth.php | 3 +++ phpstan.neon | 2 +- tests/Providers/Rng/NeedsRngLengths.php | 2 +- 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/lib/Providers/Qr/HandlesDataUri.php b/lib/Providers/Qr/HandlesDataUri.php index 20fc98d..8f8458e 100644 --- a/lib/Providers/Qr/HandlesDataUri.php +++ b/lib/Providers/Qr/HandlesDataUri.php @@ -7,6 +7,9 @@ use function preg_match; trait HandlesDataUri { + /** + * @return array + */ private function DecodeDataUri(string $datauri): ?array { if (preg_match('/data:(?P[\w\.\-\+\/]+);(?P\w+),(?P.*)/', $datauri, $m) === 1) { diff --git a/lib/Providers/Time/HttpTimeProvider.php b/lib/Providers/Time/HttpTimeProvider.php index d81809f..13d379d 100644 --- a/lib/Providers/Time/HttpTimeProvider.php +++ b/lib/Providers/Time/HttpTimeProvider.php @@ -10,22 +10,17 @@ use Exception; */ class HttpTimeProvider implements ITimeProvider { - /** @var string */ - public $url; - - /** @var string */ - public $expectedtimeformat; - - /** @var array */ - public $options; + /** @var array */ + public array $options; /** - * @param string $url - * @param string $expectedtimeformat - * @param array $options + * @param array $options */ - public function __construct($url = 'https://google.com', $expectedtimeformat = 'D, d M Y H:i:s O+', array $options = null) - { + public function __construct( + public string $url = 'https://google.com', + public string $expectedtimeformat = 'D, d M Y H:i:s O+', + array $options = null, + ) { $this->url = $url; $this->expectedtimeformat = $expectedtimeformat; if ($options === null) { diff --git a/lib/TwoFactorAuth.php b/lib/TwoFactorAuth.php index d4a3ee1..179ade8 100644 --- a/lib/TwoFactorAuth.php +++ b/lib/TwoFactorAuth.php @@ -19,8 +19,10 @@ class TwoFactorAuth { private static string $_base32dict = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567='; + /** @var array */ private static array $_base32; + /** @var array */ private static array $_base32lookup = array(); public function __construct( @@ -118,6 +120,7 @@ class TwoFactorAuth /** * Compare default timeprovider with specified timeproviders and ensure the time is within the specified number of seconds (leniency) + * @param array $timeproviders */ public function ensureCorrectTime(?array $timeproviders = null, int $leniency = 5): void { diff --git a/phpstan.neon b/phpstan.neon index de87fe2..50bfcb6 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,5 +1,5 @@ parameters: - level: 3 + level: 6 excludePaths: - %currentWorkingDirectory%/lib/Providers/Qr/BaconQrCodeProvider.php diff --git a/tests/Providers/Rng/NeedsRngLengths.php b/tests/Providers/Rng/NeedsRngLengths.php index cd1d2f4..daefe3c 100644 --- a/tests/Providers/Rng/NeedsRngLengths.php +++ b/tests/Providers/Rng/NeedsRngLengths.php @@ -4,6 +4,6 @@ namespace Tests\Providers\Rng; trait NeedsRngLengths { - /** @var array */ + /** @var array */ protected $rngTestLengths = array(1, 16, 32, 256); }