Skip to content

Commit

Permalink
Merge pull request #122 from eliashaeussler/task/phpstan-config
Browse files Browse the repository at this point in the history
[!!!][TASK] Use `eliashaeussler/phpstan-config` and require `spomky-labs/otphp` >= 11.1
  • Loading branch information
eliashaeussler authored Mar 11, 2023
2 parents aa3dba3 + 803fa4e commit fd917eb
Show file tree
Hide file tree
Showing 6 changed files with 152 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ composer require eliashaeussler/cpanel-requests

:warning: If you want to use two-factor authentication together with
the HTTP session [authorization](#authorization) method, you must
**manually require the `spomky-labs/otphp` package**.
**manually require the `spomky-labs/otphp` package (>= 11.1)**.

## :zap:Usage

Expand Down
11 changes: 6 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@
"armin/editorconfig-cli": "^1.5",
"donatj/mock-webserver": "^2.4",
"eliashaeussler/php-cs-fixer-config": "^1.1",
"eliashaeussler/phpstan-config": "^1.0",
"eliashaeussler/rector-config": "^1.0",
"ergebnis/composer-normalize": "^2.28",
"phpstan/phpstan": "^1.8",
"phpstan/extension-installer": "^1.2",
"phpstan/phpstan-phpunit": "^1.1",
"phpstan/phpstan-strict-rules": "^1.2",
"phpunit/phpunit": "^10.0",
"spomky-labs/otphp": "^11.0",
"spomky-labs/otphp": "^11.1",
"thecodingmachine/safe": "^2.0"
},
"suggest": {
"spomky-labs/otphp": "Used for authentication via HTTP session (^11.0)"
"spomky-labs/otphp": "Used for authentication via HTTP session (^11.1)"
},
"autoload": {
"psr-4": {
Expand All @@ -53,7 +53,8 @@
"bin": "bin/cpanel-requests",
"config": {
"allow-plugins": {
"ergebnis/composer-normalize": true
"ergebnis/composer-normalize": true,
"phpstan/extension-installer": true
},
"sort-packages": true
},
Expand Down
144 changes: 143 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
includes:
- vendor/phpstan/phpstan/conf/bleedingEdge.neon
- vendor/phpstan/phpstan-phpunit/extension.neon
- vendor/phpstan/phpstan-strict-rules/rules.neon
parameters:
level: max
paths:
Expand Down
2 changes: 1 addition & 1 deletion src/Application/Authorization/HttpAuthorization.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ private function getOTP(): ?string
return null;
}

return TOTP::create(trim($this->otpSecret))->now();
return TOTP::createFromSecret(trim($this->otpSecret))->now();
}

private function createUriBuilder(): Http\UriBuilder\UriBuilderInterface
Expand Down
2 changes: 1 addition & 1 deletion tests/Application/Authorization/HttpAuthorizationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function sendAuthorizedRequestProvidesOTPTokenIfOTPSecretIsGiven(): void

self::assertNotEmpty($otpSecret);

$otp = TOTP::create($otpSecret)->now();
$otp = TOTP::createFromSecret($otpSecret)->now();
$subject = new Application\Authorization\HttpAuthorization('foo', 'bar', $otpSecret);
$request = new Http\Request\ApiRequest(self::getMockServerBaseUri(), 'foo');

Expand Down

0 comments on commit fd917eb

Please sign in to comment.