Skip to content

Commit

Permalink
Fix stan errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Jul 27, 2024
1 parent e33db3f commit 1e53086
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
php-version: '8.3'
extensions: mbstring, intl
coverage: none
tools: vimeo/psalm:5, phpstan:1.10, cs2pr
tools: vimeo/psalm:5, phpstan:1.11, cs2pr

- name: Composer Install
run: composer require --dev cakephp/cakephp-codesniffer:^5.0
Expand Down
4 changes: 2 additions & 2 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ parameters:
path: src/View/Widget/DateTimeWidget.php

-
message: "#^Offset 'name' does not exist on array\\<string\\>\\|string\\.$#"
message: "#^Offset 'name' does not exist on array\\<string\\>\\|string\\|null\\.$#"
count: 1
path: src/View/Widget/DateTimeWidget.php

-
message: "#^Offset 'templateVars' does not exist on array\\<string\\>\\|string\\.$#"
message: "#^Offset 'templateVars' does not exist on array\\<string\\>\\|string\\|null\\.$#"
count: 2
path: src/View/Widget/DateTimeWidget.php

Expand Down
7 changes: 4 additions & 3 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ includes:
- phpstan-baseline.neon

parameters:
level: 7
checkMissingIterableValueType: false
checkGenericClassInNonGenericObjectType: false
level: 8
paths:
- src
universalObjectCratesClasses:
- Crud\Event\Subject
ignoreErrors:
- identifier: missingType.iterableValue
- identifier: missingType.generics
3 changes: 2 additions & 1 deletion src/Listener/Traits/IndexTypeTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
namespace CrudView\Listener\Traits;

use Cake\Controller\Controller;
use Cake\Datasource\RepositoryInterface;
use Crud\Action\BaseAction;
use Crud\Action\IndexAction;

Expand Down Expand Up @@ -154,5 +155,5 @@ abstract protected function _action(?string $name = null): BaseAction;
/**
* @inheritDoc
*/
abstract protected function _model();
abstract protected function _model(): RepositoryInterface;
}
7 changes: 4 additions & 3 deletions src/Listener/ViewListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ class ViewListener extends BaseListener
/**
* Default associations config
*
* @var array|null
* @var array
*/
protected ?array $associations = null;
protected array $associations;

/**
* [beforeFind description]
Expand Down Expand Up @@ -96,7 +96,8 @@ public function beforeRender(EventInterface $event): void
$this->_entity = $event->getSubject()->entity;
}

if ($this->associations === null) {
/** @psalm-suppress RedundantPropertyInitializationCheck */
if (!isset($this->associations)) {
$this->associations = $this->_associations(array_keys($this->_getRelatedModels()));
}

Expand Down

0 comments on commit 1e53086

Please sign in to comment.