Skip to content

Commit 6b9d8ab

Browse files
committed
Increase strictness phpstan.
1 parent 8d9da13 commit 6b9d8ab

File tree

6 files changed

+57
-7
lines changed

6 files changed

+57
-7
lines changed

composer.json

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"phpstan/extension-installer": "^1.3",
4646
"phpstan/phpstan": "^1.10",
4747
"phpstan/phpstan-deprecation-rules": "^1.1",
48+
"phpstan/phpstan-strict-rules": "^1.5",
4849
"phpunit/phpunit": "^9.6",
4950
"squizlabs/php_codesniffer": "^3.7"
5051
},

composer.lock

+50-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

phpstan.neon

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
parameters:
2-
level: 9
2+
level: max
33
paths:
44
- web/modules/custom
55
- web/themes/custom

web/modules/custom/fs/src/Controller/HomePageController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class HomePageController extends ControllerBase {
2727
*/
2828
public function redirectThatSauce(string $node_uuid) {
2929
$nodes = $this->entityTypeManager()->getStorage('node')->loadByProperties(['uuid' => $node_uuid]);
30-
if (!count($nodes)) {
30+
if (count($nodes) === 0) {
3131
throw new \Exception('Node route UUID doesn\'t appear to match any nodes: ' . $node_uuid);
3232
}
3333
$redirect_url = Url::fromRoute('entity.node.canonical', ['node' => reset($nodes)->id()]);

web/modules/custom/fs_test/fs_test.install

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function fs_test_requirements(string $phase): array {
1313
if ($phase === 'install') {
1414
$error = t('FS Test module can not be installed on production and config is excluded in "config_exclude_modules" setting in settings.php');
1515

16-
if (getenv('PLATFORM_ENVIRONMENT_TYPE') && getenv('PLATFORM_ENVIRONMENT_TYPE') == 'production') {
16+
if (getenv('PLATFORM_ENVIRONMENT_TYPE') === 'production') {
1717
if (php_sapi_name() == 'cli') {
1818
// Prevent user from bypassing with Drush.
1919
throw new \Exception($error);

web/themes/custom/fstheme/fstheme.theme

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ function fstheme_preprocess_page(array &$vars): void {
4646
*/
4747
function fstheme_preprocess_region(array &$vars): void {
4848
try {
49-
$variables['is_front'] = \Drupal::service('path.matcher')->isFrontPage();
49+
$vars['is_front'] = \Drupal::service('path.matcher')->isFrontPage();
5050
}
5151
catch (Exception $e) {
52-
$variables['is_front'] = FALSE;
52+
$vars['is_front'] = FALSE;
5353
}
54-
$variables['#cache']['contexts'][] = 'url.path';
54+
$vars['#cache']['contexts'][] = 'url.path';
5555
}
5656

5757
/**

0 commit comments

Comments
 (0)