Linked build status badge to builds page

This commit is contained in:
Barnaby Walters 2021-06-16 15:58:28 +02:00
parent 6b3c56fb6e
commit bb22f9b0e3
2 changed files with 9 additions and 6 deletions

View File

@ -247,7 +247,7 @@ class Server {
$httpGetWithEffectiveUrl = $config['httpGetWithEffectiveUrl'];
if (is_null($httpGetWithEffectiveUrl)) {
if (class_exists('\GuzzleHttp\Client')) {
$httpGetWithEffectiveUrl = function (string $uri) {
$httpGetWithEffectiveUrl = function (string $uri): array {
// This code cant be tested, ignore it for coverage purposes.
// @codeCoverageIgnoreStart
$resp = (new \GuzzleHttp\Client([

View File

@ -8,7 +8,7 @@ use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerInterface;
// From https://github.com/indieweb/indieauth-client-php/blob/main/src/IndieAuth/Client.php, thanks aaronpk.
function generateRandomString($numBytes) {
function generateRandomString(int $numBytes): string {
if (function_exists('random_bytes')) {
$bytes = random_bytes($numBytes);
// We cant easily test the following code.
@ -25,7 +25,7 @@ function generateRandomString($numBytes) {
return bin2hex($bytes);
}
function generateRandomPrintableAsciiString(int $length) {
function generateRandomPrintableAsciiString(int $length): string {
$chars = [];
while (count($chars) < $length) {
// 0x21 to 0x7E is the entire printable ASCII range, not including space (0x20).
@ -34,7 +34,7 @@ function generateRandomPrintableAsciiString(int $length) {
return join('', $chars);
}
function generatePKCECodeChallenge($plaintext) {
function generatePKCECodeChallenge(string $plaintext): string {
return base64_urlencode(hash('sha256', $plaintext, true));
}
@ -65,7 +65,7 @@ function isIndieAuthAuthorizationCodeRedeemingRequest(ServerRequestInterface $re
function isIndieAuthAuthorizationRequest(ServerRequestInterface $request, array $permittedMethods=['get']): bool {
return in_array(strtolower($request->getMethod()), array_map('strtolower', $permittedMethods))
&& array_key_exists('response_type', $request->getQueryParams() ?? [])
&& array_key_exists('response_type', $request->getQueryParams())
&& $request->getQueryParams()['response_type'] == 'code';
}
@ -107,7 +107,7 @@ function urlComponentsMatch(string $url1, string $url2, ?array $components=null)
* existing query string. Then appends the newly generated query string
* with either ? or & as appropriate.
*/
function appendQueryParams(string $uri, array $queryParams) {
function appendQueryParams(string $uri, array $queryParams): string {
if (empty($queryParams)) {
return $uri;
}
@ -123,6 +123,9 @@ function appendQueryParams(string $uri, array $queryParams) {
*
* If `$target` implements `LoggerAwareInterface`, set its logger
* to `$logger`. Returns `$target`.
*
* @psalm-suppress MissingReturnType
* @psalm-suppress MissingParamType
*/
function trySetLogger($target, LoggerInterface $logger) {
if ($target instanceof LoggerAwareInterface) {