Installed Psalm, set up static analysis
Fixed a couple of minor issues
This commit is contained in:
parent
f0469a7d54
commit
896f661a7f
5
.github/workflows/php.yml
vendored
5
.github/workflows/php.yml
vendored
@ -34,5 +34,8 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: composer install --prefer-dist --no-progress
|
||||
|
||||
- name: Run test suite
|
||||
- name: Run Test Suite
|
||||
run: XDEBUG_MODE=coverage ./vendor/bin/phpunit tests --coverage-filter src --coverage-text
|
||||
|
||||
- name: Run Static Analysis
|
||||
run: ./vendor/bin/psalm
|
||||
|
@ -34,6 +34,7 @@
|
||||
},
|
||||
"require-dev": {
|
||||
"guzzlehttp/guzzle": "^7.3",
|
||||
"phpunit/phpunit": "^9.5"
|
||||
"phpunit/phpunit": "^9.5",
|
||||
"vimeo/psalm": "^4.7"
|
||||
}
|
||||
}
|
||||
|
1515
composer.lock
generated
1515
composer.lock
generated
File diff suppressed because it is too large
Load Diff
15
psalm.xml
Normal file
15
psalm.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0"?>
|
||||
<psalm
|
||||
errorLevel="4"
|
||||
resolveFromConfigFile="true"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="https://getpsalm.org/schema/config"
|
||||
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
|
||||
>
|
||||
<projectFiles>
|
||||
<directory name="src" />
|
||||
<ignoreFiles>
|
||||
<directory name="vendor" />
|
||||
</ignoreFiles>
|
||||
</projectFiles>
|
||||
</psalm>
|
@ -369,7 +369,7 @@ class Server {
|
||||
}
|
||||
|
||||
// Check that this token either grants at most the profile scope.
|
||||
$requestedScopes = explode(' ', $authCode['scope'] ?? '');
|
||||
$requestedScopes = array_filter(explode(' ', $authCode['scope'] ?? ''));
|
||||
if (!empty($requestedScopes) && $requestedScopes != ['profile']) {
|
||||
$this->logger->error("An exchange request for a token granting scopes other than “profile” was sent to the authorization endpoint.");
|
||||
throw IndieAuthException::create(IndieAuthException::INVALID_GRANT, $request);
|
||||
|
@ -40,7 +40,7 @@ class FilesystemJsonStorage implements TokenStorageInterface, LoggerAwareInterfa
|
||||
public function __construct(string $path, string $secret, ?int $authCodeTtl=null, ?int $accessTokenTtl=null, $cleanUpNow=false, ?LoggerInterface $logger=null) {
|
||||
$this->logger = $logger ?? new NullLogger();
|
||||
|
||||
if (!is_string($secret) || strlen($secret) < 64) {
|
||||
if (strlen($secret) < 64) {
|
||||
throw new Exception("\$secret must be a string with a minimum length of 64 characters. Make one with Taproot\IndieAuth\generateRandomString(64)");
|
||||
}
|
||||
$this->secret = $secret;
|
||||
|
Reference in New Issue
Block a user