From 046a3d6855e9e4b3bc860869d5f640ff151fc0f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Mon, 13 Jan 2025 22:16:34 +0100 Subject: [PATCH] Drop Psalm in favor of PHPStan As per the decision we made during the hackathon. I have left many psalm-suppress annotations that seem informative in the codebase. --- .gitattributes | 3 +- .github/workflows/static-analysis.yml | 25 +------ composer.json | 8 +-- phpstan.neon.dist | 9 +++ psalm.xml.dist | 66 ------------------- src/Command/CreateDatabaseDoctrineCommand.php | 1 + src/Command/DoctrineCommand.php | 1 + src/Command/DropDatabaseDoctrineCommand.php | 1 + src/Command/ImportMappingDoctrineCommand.php | 2 + src/Command/Proxy/DoctrineCommandHelper.php | 2 + src/ConnectionFactory.php | 10 +-- src/DataCollector/DoctrineDataCollector.php | 10 +-- .../Compiler/DoctrineOrmMappingsPass.php | 4 +- src/DependencyInjection/DoctrineExtension.php | 6 +- src/Mapping/DisconnectedMetadataFactory.php | 2 + src/Middleware/BacktraceDebugDataHolder.php | 1 - src/Middleware/DebugMiddleware.php | 1 - src/Registry.php | 2 + src/Repository/ContainerRepositoryFactory.php | 8 +-- .../LazyServiceEntityRepository.php | 2 +- tests/CacheSchemaSubscriberTest.php | 4 +- .../AbstractDoctrineExtensionTest.php | 2 +- .../DoctrineExtensionTest.php | 6 ++ .../BacktraceDebugDataHolderTest.php | 6 -- tests/Middleware/DebugMiddlewareTest.php | 1 - tests/ProfilerTest.php | 8 --- .../ServiceEntityRepositoryTest.php | 4 +- 27 files changed, 63 insertions(+), 132 deletions(-) create mode 100644 phpstan.neon.dist delete mode 100644 psalm.xml.dist diff --git a/.gitattributes b/.gitattributes index fd6ab1032..08e3d6f81 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4,7 +4,8 @@ .gitignore export-ignore phpunit.xml.dist export-ignore phpcs.xml.dist export-ignore -psalm.xml.dist export-ignore +phpstan-baseline.neon export-ignore +phpstan.neon.dist export-ignore /docs export-ignore /tests export-ignore .symfony.bundle.yaml export-ignore diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index fde93c2f4..d1e538332 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -10,25 +10,6 @@ on: - "*.x" jobs: - static-analysis-psalm: - name: "Static Analysis with Psalm" - runs-on: "ubuntu-latest" - - steps: - - name: "Checkout code" - uses: "actions/checkout@v4" - - - name: "Install PHP" - uses: "shivammathur/setup-php@v2" - with: - coverage: "none" - php-version: "8.2" - - - name: "Enforce using stable dependencies" - run: "composer config minimum-stability stable" - - - name: "Install dependencies with Composer" - uses: "ramsey/composer-install@v3" - - - name: "Run a static analysis with vimeo/psalm" - run: "vendor/bin/psalm --show-info=false --stats --output-format=github --find-unused-psalm-suppress" + static-analysis: + name: "Static Analysis" + uses: "doctrine/.github/.github/workflows/phpstan.yml@7.1.0" diff --git a/composer.json b/composer.json index c924f2bb2..302e2e7a5 100644 --- a/composer.json +++ b/composer.json @@ -50,9 +50,10 @@ "doctrine/deprecations": "^1.0", "doctrine/orm": "^2.17 || ^3.0", "friendsofphp/proxy-manager-lts": "^1.0", + "phpstan/phpstan": "2.1.1", + "phpstan/phpstan-phpunit": "2.0.3", + "phpstan/phpstan-strict-rules": "^2", "phpunit/phpunit": "^9.5.26", - "psalm/plugin-phpunit": "^0.18.4", - "psalm/plugin-symfony": "^5", "psr/log": "^1.1.4 || ^2.0 || ^3.0", "symfony/phpunit-bridge": "^6.1 || ^7.0", "symfony/property-info": "^5.4 || ^6.0 || ^7.0", @@ -65,8 +66,7 @@ "symfony/var-exporter": "^5.4 || ^6.2 || ^7.0", "symfony/web-profiler-bundle": "^5.4 || ^6.0 || ^7.0", "symfony/yaml": "^5.4 || ^6.0 || ^7.0", - "twig/twig": "^1.34 || ^2.12 || ^3.0", - "vimeo/psalm": "^5.15" + "twig/twig": "^1.34 || ^2.12 || ^3.0" }, "conflict": { "doctrine/annotations": ">=3.0", diff --git a/phpstan.neon.dist b/phpstan.neon.dist new file mode 100644 index 000000000..c7d831239 --- /dev/null +++ b/phpstan.neon.dist @@ -0,0 +1,9 @@ +parameters: + level: 1 + paths: + - src + - tests + + excludePaths: + - src/Command/Proxy/ConvertMappingDoctrineCommand.php + - src/Command/Proxy/EnsureProductionSettingsDoctrineCommand.php diff --git a/psalm.xml.dist b/psalm.xml.dist deleted file mode 100644 index 931a530af..000000000 --- a/psalm.xml.dist +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Command/CreateDatabaseDoctrineCommand.php b/src/Command/CreateDatabaseDoctrineCommand.php index 678a05c86..1d0b8948b 100644 --- a/src/Command/CreateDatabaseDoctrineCommand.php +++ b/src/Command/CreateDatabaseDoctrineCommand.php @@ -63,6 +63,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int // Need to get rid of _every_ occurrence of dbname from connection configuration as we have already extracted all relevant info from url /** @psalm-suppress InvalidArrayOffset Need to be compatible with DBAL < 4, which still has `$params['url']` */ + /** @phpstan-ignore unset.offset */ unset($params['dbname'], $params['path'], $params['url']); if ($connection->getDatabasePlatform() instanceof PostgreSQLPlatform) { diff --git a/src/Command/DoctrineCommand.php b/src/Command/DoctrineCommand.php index 866d695cb..da787f7ac 100644 --- a/src/Command/DoctrineCommand.php +++ b/src/Command/DoctrineCommand.php @@ -34,6 +34,7 @@ public function __construct(ManagerRegistry $doctrine) */ protected function getEntityGenerator() { + /** @phpstan-ignore class.notFound */ $entityGenerator = new EntityGenerator(); $entityGenerator->setGenerateAnnotations(false); $entityGenerator->setGenerateStubMethods(true); diff --git a/src/Command/DropDatabaseDoctrineCommand.php b/src/Command/DropDatabaseDoctrineCommand.php index dc85b293f..360e6daa7 100644 --- a/src/Command/DropDatabaseDoctrineCommand.php +++ b/src/Command/DropDatabaseDoctrineCommand.php @@ -74,6 +74,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int } /** @psalm-suppress InvalidArrayOffset Need to be compatible with DBAL < 4, which still has `$params['url']` */ + /* @phpstan-ignore unset.offset */ unset($params['dbname'], $params['url']); if ($connection->getDatabasePlatform() instanceof PostgreSQLPlatform) { diff --git a/src/Command/ImportMappingDoctrineCommand.php b/src/Command/ImportMappingDoctrineCommand.php index 951eea691..44ca44651 100644 --- a/src/Command/ImportMappingDoctrineCommand.php +++ b/src/Command/ImportMappingDoctrineCommand.php @@ -109,6 +109,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int } } + /* @phpstan-ignore class.notFound */ $cme = new ClassMetadataExporter(); $exporter = $cme->getExporter($type); $exporter->setOverwriteExistingFiles($input->getOption('force')); @@ -126,6 +127,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $emName = $input->getOption('em'); $emName = $emName ? $emName : 'default'; + /* @phpstan-ignore class.notFound */ $cmf = new DisconnectedClassMetadataFactory(); $cmf->setEntityManager($em); $metadata = $cmf->getAllMetadata(); diff --git a/src/Command/Proxy/DoctrineCommandHelper.php b/src/Command/Proxy/DoctrineCommandHelper.php index 49e0b593e..b5c626d2e 100644 --- a/src/Command/Proxy/DoctrineCommandHelper.php +++ b/src/Command/Proxy/DoctrineCommandHelper.php @@ -29,12 +29,14 @@ public static function setApplicationEntityManager(Application $application, $em assert($em instanceof EntityManagerInterface); $helperSet = $application->getHelperSet(); /** @psalm-suppress InvalidArgument ORM < 3 specific */ + /* @phpstan-ignore class.notFound */ $helperSet->set(new EntityManagerHelper($em), 'em'); trigger_deprecation( 'doctrine/doctrine-bundle', '2.7', 'Providing an EntityManager using "%s" is deprecated. Use an instance of "%s" instead.', + /* @phpstan-ignore class.notFound */ EntityManagerHelper::class, EntityManagerProvider::class, ); diff --git a/src/ConnectionFactory.php b/src/ConnectionFactory.php index 2b273bdf9..d762963b0 100644 --- a/src/ConnectionFactory.php +++ b/src/ConnectionFactory.php @@ -28,7 +28,7 @@ use const PHP_EOL; -/** @psalm-import-type Params from DriverManager */ +/** @phpstan-import-type Params from DriverManager */ class ConnectionFactory { /** @internal */ @@ -63,7 +63,7 @@ public function __construct(array $typesConfig, ?DsnParser $dsnParser = null) * * @param mixed[] $params * @param array $mappingTypes - * @psalm-param Params $params + * @phpstan-param Params $params * * @return Connection */ @@ -108,6 +108,7 @@ public function createConnection(array $params, ?Configuration $config = null, ? throw InvalidWrapperClass::new($params['wrapperClass']); } + /* @phpstan-ignore staticMethod.notFound */ throw DBALException::invalidWrapperClass($params['wrapperClass']); } @@ -186,6 +187,7 @@ private function getDatabasePlatform(Connection $connection): AbstractPlatform } catch (DriverException $driverException) { $class = class_exists(DBALException::class) ? DBALException::class : ConnectionException::class; + /* @phpstan-ignore new.interface */ throw new $class( 'An exception occurred while establishing a connection to figure out your platform version.' . PHP_EOL . "You can circumvent this by setting a 'server_version' configuration value" . PHP_EOL . PHP_EOL . @@ -244,11 +246,11 @@ private function addDatabaseSuffix(array $params): array * updated list of parameters. * * @param mixed[] $params The list of parameters. - * @psalm-param Params $params + * @phpstan-param Params $params * * @return mixed[] A modified list of parameters with info from a database * URL extracted into individual parameter parts. - * @psalm-return Params + * @phpstan-return Params * * @throws DBALException */ diff --git a/src/DataCollector/DoctrineDataCollector.php b/src/DataCollector/DoctrineDataCollector.php index 2ecd7a48d..f8132a1aa 100644 --- a/src/DataCollector/DoctrineDataCollector.php +++ b/src/DataCollector/DoctrineDataCollector.php @@ -24,7 +24,7 @@ use function usort; /** - * @psalm-type QueryType = array{ + * @phpstan-type QueryType = array{ * executionMS: float, * explainable: bool, * sql: string, @@ -32,7 +32,7 @@ * runnable: bool, * types: ?array, * } - * @psalm-type DataType = array{ + * @phpstan-type DataType = array{ * caches: array{ * enabled: bool, * counts: array<"puts"|"hits"|"misses", int>, @@ -54,7 +54,7 @@ class DoctrineDataCollector extends BaseCollector /** * @var mixed[][]|null - * @psalm-var ?array> + * @phpstan-var ?array> */ private ?array $groupedQueries = null; @@ -216,7 +216,7 @@ public function getCacheEnabled() /** * @return array> - * @psalm-return array<"puts"|"hits"|"misses", array> + * @phpstan-return array<"puts"|"hits"|"misses", array> */ public function getCacheRegions() { @@ -237,7 +237,7 @@ public function getInvalidEntityCount() /** * @return string[][] - * @psalm-return array> + * @phpstan-return array> */ public function getGroupedQueries() { diff --git a/src/DependencyInjection/Compiler/DoctrineOrmMappingsPass.php b/src/DependencyInjection/Compiler/DoctrineOrmMappingsPass.php index 3a3a3ca69..5dad51b54 100644 --- a/src/DependencyInjection/Compiler/DoctrineOrmMappingsPass.php +++ b/src/DependencyInjection/Compiler/DoctrineOrmMappingsPass.php @@ -89,7 +89,8 @@ public static function createXmlMappingDriver(array $namespaces, array $managerP public static function createYamlMappingDriver(array $namespaces, array $managerParameters = [], $enabledParameter = false, array $aliasMap = []) { $locator = new Definition(SymfonyFileLocator::class, [$namespaces, '.orm.yml']); - $driver = new Definition(YamlDriver::class, [$locator]); + /* @phpstan-ignore class.notFound */ + $driver = new Definition(YamlDriver::class, [$locator]); return new DoctrineOrmMappingsPass($driver, $namespaces, $managerParameters, $enabledParameter, $aliasMap); } @@ -133,6 +134,7 @@ public static function createPhpMappingDriver(array $namespaces, array $managerP public static function createAnnotationMappingDriver(array $namespaces, array $directories, array $managerParameters = [], $enabledParameter = false, array $aliasMap = [], bool $reportFieldsWhereDeclared = false) { $reader = new Reference('annotation_reader'); + /* @phpstan-ignore class.notFound */ $driver = new Definition(AnnotationDriver::class, [$reader, $directories, $reportFieldsWhereDeclared]); return new DoctrineOrmMappingsPass($driver, $namespaces, $managerParameters, $enabledParameter, $aliasMap); diff --git a/src/DependencyInjection/DoctrineExtension.php b/src/DependencyInjection/DoctrineExtension.php index bea0b8e9c..86fe53724 100644 --- a/src/DependencyInjection/DoctrineExtension.php +++ b/src/DependencyInjection/DoctrineExtension.php @@ -91,7 +91,7 @@ * DoctrineExtension is an extension for the Doctrine DBAL and ORM library. * * @final since 2.9 - * @psalm-type DBALConfig = array{ + * @phpstan-type DBALConfig = array{ * connections: array, * driver_schemes: array, * default_connection: string, @@ -579,7 +579,6 @@ protected function ormLoad(array $config, ContainerBuilder $container) $entityManagers = []; foreach (array_keys($config['entity_managers']) as $name) { - /** @psalm-suppress InvalidArrayOffset */ $entityManagers[$name] = sprintf('doctrine.orm.%s_entity_manager', $name); } @@ -1186,12 +1185,15 @@ protected function getMetadataDriverClass(string $driverType): string return SimplifiedXmlDriver::class; case 'yml': + /* @phpstan-ignore class.notFound */ return SimplifiedYamlDriver::class; case 'php': + /* @phpstan-ignore class.notFound */ return class_exists(PHPDriver::class) ? PHPDriver::class : LegacyPHPDriver::class; case 'staticphp': + /* @phpstan-ignore class.notFound */ return class_exists(StaticPHPDriver::class) ? StaticPHPDriver::class : LegacyStaticPHPDriver::class; case 'attribute': diff --git a/src/Mapping/DisconnectedMetadataFactory.php b/src/Mapping/DisconnectedMetadataFactory.php index 86cbdfbfb..fcae05cc1 100644 --- a/src/Mapping/DisconnectedMetadataFactory.php +++ b/src/Mapping/DisconnectedMetadataFactory.php @@ -146,6 +146,7 @@ private function getMetadataForNamespace(string $namespace): ClassMetadataCollec private function getMetadataForClass(string $entity): ClassMetadataCollection { foreach ($this->registry->getManagers() as $em) { + /* @phpstan-ignore class.notFound */ $cmf = new DisconnectedClassMetadataFactory(); $cmf->setEntityManager($em); @@ -162,6 +163,7 @@ private function getAllMetadata(): array { $metadata = []; foreach ($this->registry->getManagers() as $em) { + /* @phpstan-ignore class.notFound */ $cmf = new DisconnectedClassMetadataFactory(); $cmf->setEntityManager($em); foreach ($cmf->getAllMetadata() as $m) { diff --git a/src/Middleware/BacktraceDebugDataHolder.php b/src/Middleware/BacktraceDebugDataHolder.php index 8eae91188..8d612937e 100644 --- a/src/Middleware/BacktraceDebugDataHolder.php +++ b/src/Middleware/BacktraceDebugDataHolder.php @@ -11,7 +11,6 @@ use const DEBUG_BACKTRACE_IGNORE_ARGS; -/** @psalm-suppress MissingDependency */ class BacktraceDebugDataHolder extends DebugDataHolder { /** @var string[] */ diff --git a/src/Middleware/DebugMiddleware.php b/src/Middleware/DebugMiddleware.php index 55aaabb54..d8e4b68fc 100644 --- a/src/Middleware/DebugMiddleware.php +++ b/src/Middleware/DebugMiddleware.php @@ -27,7 +27,6 @@ public function setConnectionName(string $name): void public function wrap(DriverInterface $driver): DriverInterface { - /** @psalm-suppress InternalClass,InternalMethod */ return new Driver($driver, $this->debugDataHolder, $this->stopwatch, $this->connectionName); } } diff --git a/src/Registry.php b/src/Registry.php index aa84319db..958956dc3 100644 --- a/src/Registry.php +++ b/src/Registry.php @@ -53,10 +53,12 @@ public function getAliasNamespace($alias) try { /** @psalm-suppress UndefinedMethod ORM < 3 specific */ return $objectManager->getConfiguration()->getEntityNamespace($alias); + /* @phpstan-ignore class.notFound */ } catch (ORMException $e) { } } + /* @phpstan-ignore class.notFound */ throw ORMException::unknownEntityNamespace($alias); } diff --git a/src/Repository/ContainerRepositoryFactory.php b/src/Repository/ContainerRepositoryFactory.php index 9d007c8ef..efa712097 100644 --- a/src/Repository/ContainerRepositoryFactory.php +++ b/src/Repository/ContainerRepositoryFactory.php @@ -40,7 +40,7 @@ public function __construct(ContainerInterface $container) * @param class-string $entityName * * @return ObjectRepository - * @psalm-return ($strictTypeCheck is true ? EntityRepository : ObjectRepository) + * @phpstan-return ($strictTypeCheck is true ? EntityRepository : ObjectRepository) * * @template T of object */ @@ -67,7 +67,7 @@ private function doGetRepository(EntityManagerInterface $entityManager, string $ trigger_deprecation('doctrine/doctrine-bundle', '2.11', 'The service "%s" of type "%s" should extend "%s", not doing so is deprecated.', $repositoryServiceId, get_debug_type($repository), EntityRepository::class); } - /** @psalm-var ObjectRepository */ + /** @phpstan-var ObjectRepository */ return $repository; } @@ -99,13 +99,13 @@ private function getOrCreateRepository( ): ObjectRepository { $repositoryHash = $metadata->getName() . spl_object_hash($entityManager); if (isset($this->managedRepositories[$repositoryHash])) { - /** @psalm-var ObjectRepository */ + /** @phpstan-var ObjectRepository */ return $this->managedRepositories[$repositoryHash]; } $repositoryClassName = $metadata->customRepositoryClassName ?: $entityManager->getConfiguration()->getDefaultRepositoryClassName(); - /** @psalm-var ObjectRepository */ + /** @phpstan-var ObjectRepository */ return $this->managedRepositories[$repositoryHash] = new $repositoryClassName($entityManager, $metadata); } } diff --git a/src/Repository/LazyServiceEntityRepository.php b/src/Repository/LazyServiceEntityRepository.php index c6905994a..3296f97c9 100644 --- a/src/Repository/LazyServiceEntityRepository.php +++ b/src/Repository/LazyServiceEntityRepository.php @@ -25,7 +25,7 @@ class LazyServiceEntityRepository extends EntityRepository implements ServiceEnt /** * @param string $entityClass The class name of the entity this repository manages - * @psalm-param class-string $entityClass + * @phpstan-param class-string $entityClass */ public function __construct(ManagerRegistry $registry, string $entityClass) { diff --git a/tests/CacheSchemaSubscriberTest.php b/tests/CacheSchemaSubscriberTest.php index 22bcc169a..8d0e85cc6 100644 --- a/tests/CacheSchemaSubscriberTest.php +++ b/tests/CacheSchemaSubscriberTest.php @@ -104,9 +104,9 @@ public function getSchemaSubscribers(): Generator /** * available in Symfony 5.1 and up to Symfony 5.4 (deprecated) - * - * @psalm-suppress UndefinedClass */ + + /* @phpstan-ignore class.notFound */ yield ['cache.adapter.pdo', 'doctrine.orm.listeners.pdo_cache_adapter_doctrine_schema_subscriber', PdoCacheAdapterDoctrineSchemaSubscriber::class]; } } diff --git a/tests/DependencyInjection/AbstractDoctrineExtensionTest.php b/tests/DependencyInjection/AbstractDoctrineExtensionTest.php index 90918bdc0..d9627f29b 100644 --- a/tests/DependencyInjection/AbstractDoctrineExtensionTest.php +++ b/tests/DependencyInjection/AbstractDoctrineExtensionTest.php @@ -936,7 +936,7 @@ public function testAddCustomHydrationMode(): void $container = $this->loadContainer('orm_hydration_mode'); $definition = $container->getDefinition('doctrine.orm.default_configuration'); - /** @psalm-suppress UndefinedClass */ + /* @phpstan-ignore class.notFound */ $this->assertDICDefinitionMethodCallOnce($definition, 'addCustomHydrationMode', ['test_hydrator', TestHydrator::class]); } diff --git a/tests/DependencyInjection/DoctrineExtensionTest.php b/tests/DependencyInjection/DoctrineExtensionTest.php index c3d25d8cd..60135032d 100644 --- a/tests/DependencyInjection/DoctrineExtensionTest.php +++ b/tests/DependencyInjection/DoctrineExtensionTest.php @@ -433,19 +433,25 @@ public function testDependencyInjectionConfigurationDefaults(): void $this->assertEquals(EntityManager::class, $container->getParameter('doctrine.orm.entity_manager.class')); $this->assertEquals('Proxies', $container->getParameter('doctrine.orm.proxy_namespace')); /** @psalm-suppress UndefinedClass Remove in doctrine/doctrine-bundle 3.0 */ + /* @phpstan-ignore class.notFound */ $this->assertEquals(ArrayCache::class, $container->getParameter('doctrine.orm.cache.array.class')); /** @psalm-suppress UndefinedClass Remove in doctrine/doctrine-bundle 3.0 */ + /* @phpstan-ignore class.notFound */ $this->assertEquals(ApcCache::class, $container->getParameter('doctrine.orm.cache.apc.class')); /** @psalm-suppress UndefinedClass Remove in doctrine/doctrine-bundle 3.0 */ + /* @phpstan-ignore class.notFound */ $this->assertEquals(MemcacheCache::class, $container->getParameter('doctrine.orm.cache.memcache.class')); $this->assertEquals('localhost', $container->getParameter('doctrine.orm.cache.memcache_host')); $this->assertEquals('11211', $container->getParameter('doctrine.orm.cache.memcache_port')); $this->assertEquals('Memcache', $container->getParameter('doctrine.orm.cache.memcache_instance.class')); /** @psalm-suppress UndefinedClass Remove in doctrine/doctrine-bundle 3.0 */ + /* @phpstan-ignore class.notFound */ $this->assertEquals(XcacheCache::class, $container->getParameter('doctrine.orm.cache.xcache.class')); $this->assertEquals(MappingDriverChain::class, $container->getParameter('doctrine.orm.metadata.driver_chain.class')); + /* @phpstan-ignore class.notFound */ $this->assertEquals(AnnotationDriver::class, $container->getParameter('doctrine.orm.metadata.annotation.class')); $this->assertEquals(SimplifiedXmlDriver::class, $container->getParameter('doctrine.orm.metadata.xml.class')); + /* @phpstan-ignore class.notFound */ $this->assertEquals(SimplifiedYamlDriver::class, $container->getParameter('doctrine.orm.metadata.yml.class')); // second-level cache diff --git a/tests/Middleware/BacktraceDebugDataHolderTest.php b/tests/Middleware/BacktraceDebugDataHolderTest.php index 1843e4b56..53d2a3795 100644 --- a/tests/Middleware/BacktraceDebugDataHolderTest.php +++ b/tests/Middleware/BacktraceDebugDataHolderTest.php @@ -12,12 +12,6 @@ use function sprintf; use function strpos; -/** - * @psalm-suppress UndefinedClass - * @psalm-suppress MissingDependency - * @psalm-suppress InternalMethod - * @psalm-suppress InternalClass - */ class BacktraceDebugDataHolderTest extends TestCase { protected function setUp(): void diff --git a/tests/Middleware/DebugMiddlewareTest.php b/tests/Middleware/DebugMiddlewareTest.php index 0609834e8..81a25dde3 100644 --- a/tests/Middleware/DebugMiddlewareTest.php +++ b/tests/Middleware/DebugMiddlewareTest.php @@ -15,7 +15,6 @@ use function sprintf; use function strpos; -/** @psalm-suppress MissingDependency */ class DebugMiddlewareTest extends TestCase { protected function setUp(): void diff --git a/tests/ProfilerTest.php b/tests/ProfilerTest.php index 787a538d8..dd86b14fc 100644 --- a/tests/ProfilerTest.php +++ b/tests/ProfilerTest.php @@ -32,10 +32,6 @@ use function preg_quote; use function str_replace; -/** - * @psalm-suppress InternalMethod - * @psalm-suppress InternalClass - */ class ProfilerTest extends BaseTestCase { private DebugDataHolder $debugDataHolder; @@ -73,10 +69,6 @@ public function setUp(): void $this->twig->addExtension(new RoutingExtension($urlGenerator)); $this->twig->addExtension(new HttpKernelExtension()); - /** - * @psalm-suppress InternalClass - * @psalm-suppress InternalMethod - */ $this->twig->addExtension(new WebProfilerExtension()); $this->twig->addExtension(new DoctrineExtension()); diff --git a/tests/Repository/ServiceEntityRepositoryTest.php b/tests/Repository/ServiceEntityRepositoryTest.php index cffe0c32d..bd4fdc3fc 100644 --- a/tests/Repository/ServiceEntityRepositoryTest.php +++ b/tests/Repository/ServiceEntityRepositoryTest.php @@ -30,7 +30,7 @@ public function testConstructorThrowsExceptionWhenNoManagerFound(): void $this->expectExceptionMessage(<<<'EXCEPTION' Could not find the entity manager for class "Doctrine\Bundle\DoctrineBundle\Tests\Repository\TestEntity". Check your Doctrine configuration to make sure it is configured to load this entity’s metadata. EXCEPTION); - /** @psalm-suppress UndefinedClass */ + /* @phpstan-ignore class.notFound */ $repo = new ServiceEntityRepository($registry, TestEntity::class); $repo->getClassName(); } @@ -41,7 +41,7 @@ public function testConstructInitializesWhenImplementingLazyObjectInterface(): v $registry = $this->getMockBuilder(ManagerRegistry::class)->getMock(); $this->expectException(LogicException::class); - /** @psalm-suppress UndefinedClass */ + /* @phpstan-ignore class.notFound */ new class ($registry, TestEntity::class) extends ServiceEntityRepository implements LazyObjectInterface { use LazyGhostTrait; };