Skip to content

Commit

Permalink
Merge pull request #66 from City-of-Helsinki/UHF-9213
Browse files Browse the repository at this point in the history
UHF-9213: Run phpstan
  • Loading branch information
tuutti authored Nov 29, 2023
2 parents b14b5fc + 14afb15 commit 8966aa2
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 6 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,11 @@ jobs:
- name: Run PHPCS
working-directory: ${{ env.DRUPAL_ROOT }}
run: |
vendor/bin/phpcs $MODULE_FOLDER --standard=Drupal --extensions=php,module,inc,install,test,info
run: vendor/bin/phpcs $MODULE_FOLDER --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,info

- name: Run phpstan
working-directory: ${{ env.DRUPAL_ROOT }}
run: vendor/bin/phpstan analyze -c $MODULE_FOLDER/phpstan.neon $MODULE_FOLDER

- name: Start services
working-directory: ${{ env.DRUPAL_ROOT }}
Expand Down
12 changes: 12 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
parameters:
fileExtensions:
- php
- module
- install
paths:
- ./
excludePaths:
- vendor
level: 3
checkMissingIterableValueType: false
treatPhpDocTypesAsCertain: false
6 changes: 3 additions & 3 deletions src/Plugin/DebugDataItem/Robots.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* description = @Translation("Robots data")
* )
*/
class Robots extends DebugDataItemPluginBase implements ContainerFactoryPluginInterface {
final class Robots extends DebugDataItemPluginBase implements ContainerFactoryPluginInterface {

/**
* Robots header enabled settings value.
Expand All @@ -29,8 +29,8 @@ class Robots extends DebugDataItemPluginBase implements ContainerFactoryPluginIn
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
$instance = new static($configuration, $plugin_id, $plugin_definition);
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) : self {
$instance = new self($configuration, $plugin_id, $plugin_definition);

$instance->robotsHeader = (bool) $container->get('config.factory')
->get('helfi_proxy.settings')
Expand Down
1 change: 1 addition & 0 deletions tests/src/Kernel/RobotsResponseSubscriberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ private function getResponseEvent(Request $request = NULL) : ResponseEvent {
$this->container->get('http_kernel'),
$request,
// @todo Rename this once Core requires 7.0 symfony.
// @phpstan-ignore-next-line
HttpKernelInterface::MASTER_REQUEST,
new HtmlResponse()
);
Expand Down
4 changes: 3 additions & 1 deletion tests/src/Kernel/TunnistamoRedirectUrlSubscriberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ private function configureTunnistamoClient(): void {
*/
private function getRedirectUri() : string {
$client = OpenIDConnectClientEntity::load('tunnistamo')->getPlugin();
$url = $client->authorize()->getTargetUrl();
/** @var \Symfony\Component\HttpFoundation\RedirectResponse $response */
$response = $client->authorize();
$url = $response->getTargetUrl();
parse_str(parse_url($url, PHP_URL_QUERY), $query);

return $query['redirect_uri'];
Expand Down

0 comments on commit 8966aa2

Please sign in to comment.