Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UHF-9213: Run phpstan #66

Merged
merged 1 commit into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading