diff --git a/Loader/SymfonyFixturesLoader.php b/Loader/SymfonyFixturesLoader.php index 77d0e219..a42129d4 100644 --- a/Loader/SymfonyFixturesLoader.php +++ b/Loader/SymfonyFixturesLoader.php @@ -135,7 +135,7 @@ private function addGroupsFixtureMapping(string $className, array $groups) } /** - * @param string[] $fixtures An array of fixtures with class names as keys + * @param array, FixtureInterface> $fixtures An array of fixtures with class names as keys */ private function validateDependencies(array $fixtures, FixtureInterface $fixture) { diff --git a/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Repository/TestCustomClassRepoRepository.php b/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Repository/TestCustomClassRepoRepository.php index 7d929622..c51274e9 100644 --- a/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Repository/TestCustomClassRepoRepository.php +++ b/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Repository/TestCustomClassRepoRepository.php @@ -6,6 +6,7 @@ use Doctrine\ODM\MongoDB\Repository\DocumentRepository; +/** @template-extends DocumentRepository */ class TestCustomClassRepoRepository extends DocumentRepository { } diff --git a/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Repository/TestCustomServiceRepoDocumentRepository.php b/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Repository/TestCustomServiceRepoDocumentRepository.php index beea11d3..d78a4ee7 100644 --- a/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Repository/TestCustomServiceRepoDocumentRepository.php +++ b/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Repository/TestCustomServiceRepoDocumentRepository.php @@ -8,6 +8,7 @@ use Doctrine\Bundle\MongoDBBundle\Repository\ServiceDocumentRepository; use Doctrine\Bundle\MongoDBBundle\Tests\DependencyInjection\Fixtures\Bundles\RepositoryServiceBundle\Document\TestCustomServiceRepoDocument; +/** @template-extends ServiceDocumentRepository */ class TestCustomServiceRepoDocumentRepository extends ServiceDocumentRepository { public function __construct(ManagerRegistry $registry) diff --git a/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Repository/TestCustomServiceRepoGridFSRepository.php b/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Repository/TestCustomServiceRepoGridFSRepository.php index a7aae410..4b2e147b 100644 --- a/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Repository/TestCustomServiceRepoGridFSRepository.php +++ b/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Repository/TestCustomServiceRepoGridFSRepository.php @@ -8,6 +8,7 @@ use Doctrine\Bundle\MongoDBBundle\Repository\ServiceDocumentRepository; use Doctrine\Bundle\MongoDBBundle\Tests\DependencyInjection\Fixtures\Bundles\RepositoryServiceBundle\Document\TestCustomServiceRepoFile; +/** @template-extends ServiceDocumentRepository */ class TestCustomServiceRepoGridFSRepository extends ServiceDocumentRepository { public function __construct(ManagerRegistry $registry) diff --git a/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Repository/TestUnmappedDocumentRepository.php b/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Repository/TestUnmappedDocumentRepository.php index 331d69ac..3c5c67f0 100644 --- a/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Repository/TestUnmappedDocumentRepository.php +++ b/Tests/DependencyInjection/Fixtures/Bundles/RepositoryServiceBundle/Repository/TestUnmappedDocumentRepository.php @@ -8,6 +8,7 @@ use Doctrine\Bundle\MongoDBBundle\Repository\ServiceDocumentRepository; use Doctrine\Bundle\MongoDBBundle\Tests\DependencyInjection\Fixtures\Bundles\RepositoryServiceBundle\Document\TestUnmappedDocument; +/** @template-extends ServiceDocumentRepository */ class TestUnmappedDocumentRepository extends ServiceDocumentRepository { public function __construct(ManagerRegistry $registry) diff --git a/Tests/Fixtures/Cache/Collections.php b/Tests/Fixtures/Cache/Collections.php index d88000a2..e1f44757 100644 --- a/Tests/Fixtures/Cache/Collections.php +++ b/Tests/Fixtures/Cache/Collections.php @@ -40,10 +40,12 @@ class Collections public $another; } +/** @template-extends ArrayCollection */ class SomeCollection extends ArrayCollection { } +/** @template-extends ArrayCollection */ class AnotherCollection extends ArrayCollection { } diff --git a/Tests/Fixtures/Repository/CustomGridFSRepository.php b/Tests/Fixtures/Repository/CustomGridFSRepository.php index 9dac0f18..2c10afcd 100644 --- a/Tests/Fixtures/Repository/CustomGridFSRepository.php +++ b/Tests/Fixtures/Repository/CustomGridFSRepository.php @@ -6,6 +6,7 @@ use Doctrine\ODM\MongoDB\Repository\DocumentRepository; +/** @template-extends DocumentRepository */ final class CustomGridFSRepository extends DocumentRepository { } diff --git a/Tests/Fixtures/Repository/CustomRepository.php b/Tests/Fixtures/Repository/CustomRepository.php index 41aab3ff..d5fabb89 100644 --- a/Tests/Fixtures/Repository/CustomRepository.php +++ b/Tests/Fixtures/Repository/CustomRepository.php @@ -6,6 +6,7 @@ use Doctrine\ODM\MongoDB\Repository\DocumentRepository; +/** @template-extends DocumentRepository */ final class CustomRepository extends DocumentRepository { } diff --git a/Tests/Repository/ContainerRepositoryFactoryTest.php b/Tests/Repository/ContainerRepositoryFactoryTest.php index 803bb8c6..5dae1291 100644 --- a/Tests/Repository/ContainerRepositoryFactoryTest.php +++ b/Tests/Repository/ContainerRepositoryFactoryTest.php @@ -171,10 +171,12 @@ private function createDocumentManager(array $documentRepositoryClasses) } } +/** @template-extends DocumentRepository */ class StubRepository extends DocumentRepository { } +/** @template-extends DocumentRepository */ class StubServiceRepository extends DocumentRepository implements ServiceDocumentRepositoryInterface { } diff --git a/composer.json b/composer.json index 613a98be..0615bca3 100644 --- a/composer.json +++ b/composer.json @@ -42,7 +42,7 @@ "symfony/stopwatch": "^4.4|^5.3|^6.0", "symfony/validator": "^4.4|^5.3|^6.0", "symfony/yaml": "^4.3.3|^5.3|^6.0", - "vimeo/psalm": "^4.8" + "vimeo/psalm": "^4.30" }, "suggest": { "doctrine/data-fixtures": "Load data fixtures" diff --git a/psalm-baseline.xml b/psalm-baseline.xml new file mode 100644 index 00000000..5ed264aa --- /dev/null +++ b/psalm-baseline.xml @@ -0,0 +1,8 @@ + + + + + ask + + + diff --git a/psalm.xml b/psalm.xml index 9b43740f..4d93e85e 100644 --- a/psalm.xml +++ b/psalm.xml @@ -5,6 +5,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" + errorBaseline="psalm-baseline.xml" >