From 689d2245752d546c62b99fed748dc33b1488a934 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 15 Dec 2024 00:16:16 +0000 Subject: [PATCH] update phpstan to v2 --- composer.json | 12 ++++++------ tests/cases/unit/Collection/ArrayCollectionTest.phpt | 6 +++--- .../unit/Entity/AbstractEntity.is_modified.phpt | 7 ++++++- tests/inc/model/book/BooksMapper.php | 3 +-- tests/inc/model/timeSeries/TimeSeriesRepository.php | 2 +- 5 files changed, 17 insertions(+), 13 deletions(-) diff --git a/composer.json b/composer.json index d1fd316a..f668fd18 100644 --- a/composer.json +++ b/composer.json @@ -35,13 +35,13 @@ "nette/tester": "~2.5", "mockery/mockery": ">=1.5.1", "phpstan/extension-installer": "1.4.3", - "phpstan/phpstan": "1.12.12", - "phpstan/phpstan-deprecation-rules": "1.2.1", - "phpstan/phpstan-nette": "1.3.8", - "phpstan/phpstan-mockery": "1.1.3", - "phpstan/phpstan-strict-rules": "1.6.1", + "phpstan/phpstan": "2.0.4", + "phpstan/phpstan-deprecation-rules": "2.0.1", + "phpstan/phpstan-nette": "2.0.1", + "phpstan/phpstan-mockery": "2.0.0", + "phpstan/phpstan-strict-rules": "2.0.1", "nextras/multi-query-parser": "~1.0", - "nextras/orm-phpstan": "^1.0.1", + "nextras/orm-phpstan": "^2.0.0", "tracy/tracy": "~2.3" }, "autoload": { diff --git a/tests/cases/unit/Collection/ArrayCollectionTest.phpt b/tests/cases/unit/Collection/ArrayCollectionTest.phpt index 543d2d11..c9d9a7b8 100644 --- a/tests/cases/unit/Collection/ArrayCollectionTest.phpt +++ b/tests/cases/unit/Collection/ArrayCollectionTest.phpt @@ -130,7 +130,7 @@ class ArrayCollectionTest extends TestCase $this->e(Book::class, ['title' => 'd', 'printedAt' => new DateTime('2017-01-01 10:00:00')]), ]; - /** @var Book[]|ArrayCollection */ + /** @var ArrayCollection */ $collection = new ArrayCollection($books, $this->orm->books); $collection = $collection->orderBy('printedAt', ICollection::DESC_NULLS_LAST); @@ -208,7 +208,7 @@ class ArrayCollectionTest extends TestCase /** - * @return array{ICollection|Author[], Author[], Book[]} + * @return array{ICollection, Author[], Book[]} */ private function createCollection(): array { @@ -225,7 +225,7 @@ class ArrayCollectionTest extends TestCase $this->e(Book::class, ['title' => 'Valyria 3', 'author' => $authors[2]]), ]; - /** @var ICollection|Author[] $collection */ + /** @var ICollection $collection */ $collection = new ArrayCollection($authors, $this->orm->authors); return [$collection, $authors, $books]; } diff --git a/tests/cases/unit/Entity/AbstractEntity.is_modified.phpt b/tests/cases/unit/Entity/AbstractEntity.is_modified.phpt index 18a728f1..f3f9bbbe 100644 --- a/tests/cases/unit/Entity/AbstractEntity.is_modified.phpt +++ b/tests/cases/unit/Entity/AbstractEntity.is_modified.phpt @@ -19,6 +19,11 @@ use Tester\Assert; require_once __DIR__ . '/../../../bootstrap.php'; +/** + * @property int $id {primary} + * @property string $name + * @property int $age + */ class DataEntityFragmentIsModifiedTest extends AbstractEntity { public function __construct(EntityMetadata $metadata) @@ -88,7 +93,7 @@ class AbstractEntityIsModifiedTest extends TestCase Assert::false($entity->isModified()); Assert::false($entity->isModified('age')); - $entity->setValue('age', 20); + $entity->setValue('age', 20); // @phpstan-ignore nextrasOrm.propertyNotFound Assert::true($entity->isModified()); Assert::true($entity->isModified('age')); diff --git a/tests/inc/model/book/BooksMapper.php b/tests/inc/model/book/BooksMapper.php index 486f9a94..ebd9746b 100644 --- a/tests/inc/model/book/BooksMapper.php +++ b/tests/inc/model/book/BooksMapper.php @@ -13,14 +13,13 @@ */ final class BooksMapper extends DbalMapper { - /** @return Book[]|ICollection */ + /** @return ICollection */ public function findBooksWithEvenId(): ICollection { return $this->toCollection($this->builder()->where('id % 2 = 0')); } - /** @return Book|null */ public function findFirstBook(): ?Book { return $this->toEntity($this->builder()->where('id = 1')); diff --git a/tests/inc/model/timeSeries/TimeSeriesRepository.php b/tests/inc/model/timeSeries/TimeSeriesRepository.php index f3db3efd..d805371d 100644 --- a/tests/inc/model/timeSeries/TimeSeriesRepository.php +++ b/tests/inc/model/timeSeries/TimeSeriesRepository.php @@ -7,7 +7,7 @@ /** - * @extends Repository + * @extends Repository */ final class TimeSeriesRepository extends Repository {