[PR #197] [MERGED] PHPStan level 9 with bleeding edge #205

Closed
opened 2026-02-25 20:32:50 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/antonioribeiro/google2fa/pull/197
Author: @spaze
Created: 2/29/2024
Status: Merged
Merged: 9/7/2024
Merged by: @antonioribeiro

Base: 9.xHead: spaze/phpstan++


📝 Commits (4)

  • 616a46b Update PHPStan level to 6
  • 55a31b6 PHPStan level 8
  • 7ea7122 PHPStan level 9/max
  • 685f17d Opt in to bleeding edge, no changes needed, woohoo

📊 Changes

12 files changed (+116 additions, -61 deletions)

View changed files

📝 phpstan.neon (+4 -1)
src/Exceptions/Contracts/InvalidHash.php (+9 -0)
📝 src/Exceptions/IncompatibleWithGoogleAuthenticatorException.php (+1 -0)
📝 src/Exceptions/InvalidAlgorithmException.php (+1 -0)
📝 src/Exceptions/InvalidCharactersException.php (+1 -0)
src/Exceptions/InvalidHashException.php (+19 -0)
📝 src/Exceptions/SecretKeyTooShortException.php (+1 -0)
📝 src/Google2FA.php (+26 -18)
📝 src/Support/Base32.php (+6 -4)
📝 tests/Google2FATest.php (+42 -35)
📝 tests/QRCodeTest.php (+1 -1)
📝 tests/helpers.php (+5 -2)

📄 Description

Update PHPStan level to 9/max with bleeding edge. You can't go any higher :-) #172 inspired me to do this, to make sure the types are correct throughout the lib.

Native types could be used instead of docblocks if support for older PHP version is dropped, but first I wanted to make sure the lib is on a highest possible PHPStan level to make adding native types a bit safer. Can add them in a next PR once this is merged for example.

This branch is based on #196 branch to make tests run on all PHP versions, probably should be rebased before merging, can take care of that.

I'm not sure what to do with the failing Style CI test that wants me to update a preexisting code like this:

- exit();
+ exit;

I can update it if it looks like what's expected.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/antonioribeiro/google2fa/pull/197 **Author:** [@spaze](https://github.com/spaze) **Created:** 2/29/2024 **Status:** ✅ Merged **Merged:** 9/7/2024 **Merged by:** [@antonioribeiro](https://github.com/antonioribeiro) **Base:** `9.x` ← **Head:** `spaze/phpstan++` --- ### 📝 Commits (4) - [`616a46b`](https://github.com/antonioribeiro/google2fa/commit/616a46b92f9b7d42011d12919f0b00a19b2eea6b) Update PHPStan level to 6 - [`55a31b6`](https://github.com/antonioribeiro/google2fa/commit/55a31b60feb7b2312e137694c30afd262b652908) PHPStan level 8 - [`7ea7122`](https://github.com/antonioribeiro/google2fa/commit/7ea7122bb1f0fbdf054ccaadaab5dd4964a0d7e2) PHPStan level 9/max - [`685f17d`](https://github.com/antonioribeiro/google2fa/commit/685f17dd2488075b49f0e723c676a6acd03eb85a) Opt in to bleeding edge, no changes needed, woohoo ### 📊 Changes **12 files changed** (+116 additions, -61 deletions) <details> <summary>View changed files</summary> 📝 `phpstan.neon` (+4 -1) ➕ `src/Exceptions/Contracts/InvalidHash.php` (+9 -0) 📝 `src/Exceptions/IncompatibleWithGoogleAuthenticatorException.php` (+1 -0) 📝 `src/Exceptions/InvalidAlgorithmException.php` (+1 -0) 📝 `src/Exceptions/InvalidCharactersException.php` (+1 -0) ➕ `src/Exceptions/InvalidHashException.php` (+19 -0) 📝 `src/Exceptions/SecretKeyTooShortException.php` (+1 -0) 📝 `src/Google2FA.php` (+26 -18) 📝 `src/Support/Base32.php` (+6 -4) 📝 `tests/Google2FATest.php` (+42 -35) 📝 `tests/QRCodeTest.php` (+1 -1) 📝 `tests/helpers.php` (+5 -2) </details> ### 📄 Description Update PHPStan level to 9/max with [bleeding edge](https://phpstan.org/blog/what-is-bleeding-edge). You can't go any higher :-) #172 inspired me to do this, to make sure the types are correct throughout the lib. Native types could be used instead of docblocks if support for older PHP version is dropped, but first I wanted to make sure the lib is on a highest possible PHPStan level to make adding native types a bit safer. Can add them in a next PR once this is merged for example. This branch is based on #196 branch to make tests run on all PHP versions, probably should be rebased before merging, can take care of that. I'm not sure what to do with the failing Style CI test that wants me to update a preexisting code like this: ```diff - exit(); + exit; ``` I can update it if it looks like what's expected. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-25 20:32:50 +03:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/google2fa#205
No description provided.