Skip to content

Commit

Permalink
UHF-9329: Add phpstan check
Browse files Browse the repository at this point in the history
  • Loading branch information
hyrsky committed Feb 9, 2024
1 parent 14a41fa commit 407556a
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ jobs:
vendor/bin/phpcs public/modules/custom/ --ignore="*.js,*.css" --extensions=php,module,install --standard=Drupal,DrupalPractice
vendor/bin/phpcs public/themes/custom/ --ignore="*.js,*.css" --extensions=php,theme --standard=Drupal,DrupalPractice
- name: Run phpstan
run: vendor/bin/phpstan analyze

- name: Download latest dump
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
15 changes: 12 additions & 3 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
parameters:
treatPhpDocTypesAsCertain: false
fileExtensions:
- php
- module
- install
- theme
paths:
- ./public/modules/custom
- ./public/themes/custom
excludePaths:
- *Test.php
- *TestBase.php
- vendor
level: 3
checkMissingIterableValueType: false
treatPhpDocTypesAsCertain: false
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
/**
* Announcement client for dealing with requests to azure storage.
*/
class AnnouncementClient {
final class AnnouncementClient {
use StringTranslationTrait;

/**
* A fully-configured Guzzle client to pass to the client.
*
* @var \GuzzleHttp\Client
* @var \GuzzleHttp\ClientInterface
*/
protected ClientInterface $httpClient;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/**
* Form class for emergency announcement message.
*/
class AnnouncementEditForm extends FormBase {
final class AnnouncementEditForm extends FormBase {

use StringTranslationTrait;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/**
* Provides a form for triggering static site re-generation.
*/
class TriggerForm extends FormBase {
final class TriggerForm extends FormBase {

/**
* The Static Trigger service.
Expand Down
2 changes: 1 addition & 1 deletion public/themes/custom/hdbt_subtheme/hdbt_subtheme.theme
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function hdbt_subtheme_preprocess_paragraph(&$variables) {
/** @var \Drupal\paragraphs\Entity\Paragraph $paragraph */
$paragraph = $variables['paragraph'];
// Get the referenced entities.
/** @var \Drupal\paragraphs\Entity\ParagraphsType $referencedEntities */
/** @var \Drupal\paragraphs\Entity\ParagraphsType[] $referencedEntities */
$referencedEntities = $paragraph->referencedEntities();
foreach ($referencedEntities as $paragraph_type) {
// Add local (crisis) news to the helfi_news template.
Expand Down

0 comments on commit 407556a

Please sign in to comment.