Skip to content

Commit

Permalink
[TASK] Raise phpstan level to 4 (#267)
Browse files Browse the repository at this point in the history
There were no additional errors on level 3.

Add non-usage of exampleConfiguration to baseline as this is an example of fetching the config.
  • Loading branch information
linawolf authored May 4, 2024
1 parent b4e4df9 commit 51cbce2
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
5 changes: 5 additions & 0 deletions Build/phpstan/phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
parameters:
ignoreErrors:
-
message: "#^Property T3docs\\\\Examples\\\\Controller\\\\ModuleController\\:\\:\\$exampleConfig is never read, only written\\.$#"
count: 1
path: ../../Classes/Controller/ModuleController.php

-
message: "#^Access to an undefined property T3docs\\\\Examples\\\\Xclass\\\\NewRecordController\\:\\:\\$content\\.$#"
count: 1
Expand Down
2 changes: 1 addition & 1 deletion Build/phpstan/phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ includes:

parameters:
phpVersion: 80200
level: 2
level: 4

bootstrapFiles:
- phpstan-typo3-constants.php
Expand Down
5 changes: 4 additions & 1 deletion Classes/Http/MeowInformationRequester.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ public function request(): string
}
// Get the content as a string on a successful request
$content = $response->getBody()->getContents();
return (string)json_decode($content, true, flags: JSON_THROW_ON_ERROR)['fact'] ??
$result = json_decode($content, true, flags: JSON_THROW_ON_ERROR);
if (!is_array($result) || !isset($result['fact']) || !is_scalar($result['fact'])) {
throw new \RuntimeException('The service returned an unexpected format.', 1666413230);
}
return (string)$result['fact'];
}
}
12 changes: 10 additions & 2 deletions Classes/LinkHandler/GitHubLinkHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,16 @@ public function canHandleLink(array $linkParts): bool
*/
public function formatCurrentUrl(): string
{
return 'https://github.com/' . $this->configuration['project'] . '/'
. $this->configuration['action'] . '/' . $this->linkParts['issue'] ?? '';
$issue = '';
if (isset($this->linkParts['issue'])) {
$issue = $this->linkParts['issue'];
}
return sprintf(
'https://github.com/%s/%s/%s',
$this->configuration['project'],
$this->configuration['action'],
$issue,
);
}

/**
Expand Down

0 comments on commit 51cbce2

Please sign in to comment.