From 1b7d71084319b0f51ad85b96b2261c77c84df32d Mon Sep 17 00:00:00 2001 From: ADmad Date: Wed, 17 Nov 2021 18:13:18 +0530 Subject: [PATCH] Add phpstan config file --- .github/workflows/ci.yml | 2 +- phpstan.neon | 6 ++++++ src/Model/Behavior/SequenceBehavior.php | 11 +++++++---- 3 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 phpstan.neon diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7f6e6fa..c7db0cd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -98,4 +98,4 @@ jobs: - name: Run phpstan if: success() || failure() - run: phpstan analyse src + run: phpstan diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 0000000..feefb61 --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,6 @@ +parameters: + level: 8 + checkMissingIterableValueType: false + treatPhpDocTypesAsCertain: false + paths: + - src/ diff --git a/src/Model/Behavior/SequenceBehavior.php b/src/Model/Behavior/SequenceBehavior.php index 8e723f3..2ffadd3 100644 --- a/src/Model/Behavior/SequenceBehavior.php +++ b/src/Model/Behavior/SequenceBehavior.php @@ -65,7 +65,7 @@ class SequenceBehavior extends Behavior /** * Default settings. * - * @var array + * @var array */ protected $_defaultConfig = [ 'sequenceField' => 'position', @@ -109,7 +109,7 @@ public function initialize(array $config): void * * @param \Cake\Event\EventInterface $event The beforeFind event that was fired. * @param \Cake\ORM\Query $query The query object. - * @param \ArrayObject $options The options passed to the find method. + * @param \ArrayObject $options The options passed to the find method. * @return void */ public function beforeFind(EventInterface $event, Query $query, ArrayObject $options): void @@ -124,7 +124,7 @@ public function beforeFind(EventInterface $event, Query $query, ArrayObject $opt * * @param \Cake\Event\EventInterface $event The beforeSave event that was fired. * @param \Cake\Datasource\EntityInterface $entity The entity that is going to be saved. - * @param \ArrayObject $options The options passed to the save method. + * @param \ArrayObject $options The options passed to the save method. * @return void */ public function beforeSave(EventInterface $event, EntityInterface $entity, ArrayObject $options): void @@ -446,7 +446,10 @@ protected function _getOldValues(EntityInterface $entity): array } if (count($fields) != count($values)) { - /** @psalm-suppress PossiblyInvalidArgument */ + /** + * @psalm-suppress PossiblyInvalidArgument + * @phpstan-ignore-next-line + */ $primaryKey = $entity->get($this->_table->getPrimaryKey()); $entity = $this->_table->get($primaryKey, ['fields' => $fields]); $values = $entity->extract($fields);