Skip to content

Commit

Permalink
Merge pull request #218 from spaze/spaze/phpstan-strict-rules
Browse files Browse the repository at this point in the history
Add phpstan/phpstan-strict-rules
  • Loading branch information
antonioribeiro authored Oct 14, 2024
2 parents 75fa22a + bc49457 commit 264dc6f
Show file tree
Hide file tree
Showing 6 changed files with 104 additions and 100 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
},
"require-dev": {
"phpunit/phpunit": "^7.5.15|^8.5|^9.0",
"phpstan/phpstan": "^1.9"
"phpstan/phpstan": "^1.9",
"phpstan/phpstan-strict-rules": "^1.6"
},
"autoload": {
"psr-4": {
Expand Down
1 change: 1 addition & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ parameters:

includes:
- phar://phpstan.phar/conf/bleedingEdge.neon
- vendor/phpstan/phpstan-strict-rules/rules.neon
2 changes: 1 addition & 1 deletion src/Google2FA.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ public function setEnforceGoogleAuthenticatorCompatibility(
public function setAlgorithm(string $algorithm): static
{
// Default to SHA1 HMAC algorithm
if (!in_array($algorithm, $this->getValidAlgorithms())) {
if (!in_array($algorithm, $this->getValidAlgorithms(), true)) {
throw new InvalidAlgorithmException();
}

Expand Down
2 changes: 1 addition & 1 deletion src/Support/Base32.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function generateBase32RandomKey(
#[\SensitiveParameter]
string $prefix = ''
): string {
$secret = $prefix ? $this->toBase32($prefix) : '';
$secret = $prefix !== '' ? $this->toBase32($prefix) : '';

$secret = $this->strPadBase32($secret, $length);

Expand Down
Loading

0 comments on commit 264dc6f

Please sign in to comment.