From 1669e8dfc0ecef15c7bace17f5df0e5585161dda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Tue, 22 Oct 2024 21:49:47 +0200 Subject: [PATCH] Drop Psalm --- .gitattributes | 3 - .github/workflows/static-analysis.yml | 2 +- composer.json | 3 +- psalm-baseline.xml | 24 ------- psalm.phpstub | 12 ---- psalm.xml | 72 ------------------- src/Persistence/AbstractManagerRegistry.php | 6 +- src/Persistence/Event/LifecycleEventArgs.php | 6 +- .../Event/LoadClassMetadataEventArgs.php | 10 +-- src/Persistence/Event/ManagerEventArgs.php | 6 +- src/Persistence/Event/OnClearEventArgs.php | 6 +- src/Persistence/Event/PreUpdateEventArgs.php | 2 +- src/Persistence/ManagerRegistry.php | 4 +- .../Mapping/AbstractClassMetadataFactory.php | 52 +++++++------- src/Persistence/Mapping/ClassMetadata.php | 6 +- .../Mapping/ClassMetadataFactory.php | 8 +-- .../Mapping/Driver/ColocatedMappingDriver.php | 6 +- .../Mapping/Driver/DefaultFileLocator.php | 2 +- src/Persistence/Mapping/Driver/FileDriver.php | 8 +-- .../Mapping/Driver/FileLocator.php | 2 +- .../Mapping/Driver/MappingDriver.php | 8 +-- src/Persistence/Mapping/Driver/PHPDriver.php | 2 +- .../Mapping/Driver/StaticPHPDriver.php | 2 +- .../Mapping/Driver/SymfonyFileLocator.php | 4 +- .../Mapping/ProxyClassNameResolver.php | 4 +- src/Persistence/Mapping/ReflectionService.php | 16 ++--- .../Mapping/RuntimeReflectionService.php | 4 +- src/Persistence/ObjectManager.php | 14 ++-- src/Persistence/ObjectManagerDecorator.php | 2 +- src/Persistence/ObjectRepository.php | 12 ++-- .../Reflection/EnumReflectionProperty.php | 30 -------- .../Event/PreUpdateEventArgsTest.php | 2 +- tests/Persistence/ManagerRegistryTest.php | 2 +- .../AbstractClassMetadataFactoryTest.php | 10 +-- .../Mapping/ClassMetadataFactoryTest.php | 6 +- .../Mapping/Fixtures/TestClassMetadata.php | 4 +- .../Mapping/StaticPHPDriverTest.php | 2 +- .../Mapping/TestClassMetadataFactory.php | 4 +- .../ObjectManagerDecoratorTest.php | 2 +- 39 files changed, 114 insertions(+), 256 deletions(-) delete mode 100644 psalm-baseline.xml delete mode 100644 psalm.phpstub delete mode 100644 psalm.xml diff --git a/.gitattributes b/.gitattributes index dc4ed6af..8cc3d67f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -12,7 +12,4 @@ /phpcs.xml.dist export-ignore /phpstan.neon export-ignore /phpstan-baseline.neon export-ignore -/psalm.xml export-ignore -/psalm-baseline.xml export-ignore -/psalm.phpstub export-ignore /composer.lock export-ignore diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 591ad180..6727a24d 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -12,6 +12,6 @@ on: jobs: static-analysis: name: "Static Analysis" - uses: "doctrine/.github/.github/workflows/static-analysis.yml@5.2.0" + uses: "doctrine/.github/.github/workflows/phpstan.yml@5.2.0" with: composer-root-version: "3.0" diff --git a/composer.json b/composer.json index 56cbf8a8..638a8c43 100644 --- a/composer.json +++ b/composer.json @@ -31,8 +31,7 @@ "doctrine/coding-standard": "^12", "doctrine/common": "^3.0", "phpunit/phpunit": "^8.5 || ^9.5", - "symfony/cache": "^4.4 || ^5.4 || ^6.0 || ^7.0", - "vimeo/psalm": "4.30.0 || 5.26.1" + "symfony/cache": "^4.4 || ^5.4 || ^6.0 || ^7.0" }, "conflict": { "doctrine/common": "<2.10" diff --git a/psalm-baseline.xml b/psalm-baseline.xml deleted file mode 100644 index c99afb10..00000000 --- a/psalm-baseline.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - nsSeparator, '\\', $fileName)]]> - - - - - - - - - - - - - - diff --git a/psalm.phpstub b/psalm.phpstub deleted file mode 100644 index 727effe9..00000000 --- a/psalm.phpstub +++ /dev/null @@ -1,12 +0,0 @@ - return - */ -function ltrim(string $string, string $characters = " \t\n\r\0\x0B") : string {} diff --git a/psalm.xml b/psalm.xml deleted file mode 100644 index bd5fbbf9..00000000 --- a/psalm.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Persistence/AbstractManagerRegistry.php b/src/Persistence/AbstractManagerRegistry.php index cc245ba6..ce27d99f 100644 --- a/src/Persistence/AbstractManagerRegistry.php +++ b/src/Persistence/AbstractManagerRegistry.php @@ -32,14 +32,14 @@ abstract class AbstractManagerRegistry implements ManagerRegistry /** * @var string - * @psalm-var class-string + * @phpstan-var class-string */ private $proxyInterfaceName; /** * @param array $connections * @param array $managers - * @psalm-param class-string $proxyInterfaceName + * @phpstan-param class-string $proxyInterfaceName */ public function __construct( string $name, @@ -255,7 +255,7 @@ public function resetManager(?string $name = null) return $this->getManager($name); } - /** @psalm-param class-string $persistentObject */ + /** @phpstan-param class-string $persistentObject */ private function selectManager( string $persistentObject, ?string $persistentManagerName = null diff --git a/src/Persistence/Event/LifecycleEventArgs.php b/src/Persistence/Event/LifecycleEventArgs.php index 1654de42..05a66a92 100644 --- a/src/Persistence/Event/LifecycleEventArgs.php +++ b/src/Persistence/Event/LifecycleEventArgs.php @@ -17,14 +17,14 @@ class LifecycleEventArgs extends EventArgs { /** * @var ObjectManager - * @psalm-var TObjectManager + * @phpstan-var TObjectManager */ private $objectManager; /** @var object */ private $object; - /** @psalm-param TObjectManager $objectManager */ + /** @phpstan-param TObjectManager $objectManager */ public function __construct(object $object, ObjectManager $objectManager) { $this->object = $object; @@ -45,7 +45,7 @@ public function getObject() * Retrieves the associated ObjectManager. * * @return ObjectManager - * @psalm-return TObjectManager + * @phpstan-return TObjectManager */ public function getObjectManager() { diff --git a/src/Persistence/Event/LoadClassMetadataEventArgs.php b/src/Persistence/Event/LoadClassMetadataEventArgs.php index aa92d5d7..cf2bf7f9 100644 --- a/src/Persistence/Event/LoadClassMetadataEventArgs.php +++ b/src/Persistence/Event/LoadClassMetadataEventArgs.php @@ -18,19 +18,19 @@ class LoadClassMetadataEventArgs extends EventArgs { /** * @var ClassMetadata - * @psalm-var TClassMetadata + * @phpstan-var TClassMetadata */ private $classMetadata; /** * @var ObjectManager - * @psalm-var TObjectManager + * @phpstan-var TObjectManager */ private $objectManager; /** - * @psalm-param TClassMetadata $classMetadata - * @psalm-param TObjectManager $objectManager + * @phpstan-param TClassMetadata $classMetadata + * @phpstan-param TObjectManager $objectManager */ public function __construct(ClassMetadata $classMetadata, ObjectManager $objectManager) { @@ -42,7 +42,7 @@ public function __construct(ClassMetadata $classMetadata, ObjectManager $objectM * Retrieves the associated ClassMetadata. * * @return ClassMetadata - * @psalm-return TClassMetadata + * @phpstan-return TClassMetadata */ public function getClassMetadata() { diff --git a/src/Persistence/Event/ManagerEventArgs.php b/src/Persistence/Event/ManagerEventArgs.php index 5156013f..d4874ae4 100644 --- a/src/Persistence/Event/ManagerEventArgs.php +++ b/src/Persistence/Event/ManagerEventArgs.php @@ -16,11 +16,11 @@ class ManagerEventArgs extends EventArgs { /** * @var ObjectManager - * @psalm-var TObjectManager + * @phpstan-var TObjectManager */ private $objectManager; - /** @psalm-param TObjectManager $objectManager */ + /** @phpstan-param TObjectManager $objectManager */ public function __construct(ObjectManager $objectManager) { $this->objectManager = $objectManager; @@ -30,7 +30,7 @@ public function __construct(ObjectManager $objectManager) * Retrieves the associated ObjectManager. * * @return ObjectManager - * @psalm-return TObjectManager + * @phpstan-return TObjectManager */ public function getObjectManager() { diff --git a/src/Persistence/Event/OnClearEventArgs.php b/src/Persistence/Event/OnClearEventArgs.php index 519a8876..b25d3d8a 100644 --- a/src/Persistence/Event/OnClearEventArgs.php +++ b/src/Persistence/Event/OnClearEventArgs.php @@ -16,13 +16,13 @@ class OnClearEventArgs extends EventArgs { /** * @var ObjectManager - * @psalm-var TObjectManager + * @phpstan-var TObjectManager */ private $objectManager; /** * @param ObjectManager $objectManager The object manager. - * @psalm-param TObjectManager $objectManager + * @phpstan-param TObjectManager $objectManager */ public function __construct(ObjectManager $objectManager) { @@ -33,7 +33,7 @@ public function __construct(ObjectManager $objectManager) * Retrieves the associated ObjectManager. * * @return ObjectManager - * @psalm-return TObjectManager + * @phpstan-return TObjectManager */ public function getObjectManager() { diff --git a/src/Persistence/Event/PreUpdateEventArgs.php b/src/Persistence/Event/PreUpdateEventArgs.php index 95ecbd45..60d07762 100644 --- a/src/Persistence/Event/PreUpdateEventArgs.php +++ b/src/Persistence/Event/PreUpdateEventArgs.php @@ -23,7 +23,7 @@ class PreUpdateEventArgs extends LifecycleEventArgs /** * @param array> $changeSet - * @psalm-param TObjectManager $objectManager + * @phpstan-param TObjectManager $objectManager */ public function __construct(object $entity, ObjectManager $objectManager, array &$changeSet) { diff --git a/src/Persistence/ManagerRegistry.php b/src/Persistence/ManagerRegistry.php index 46599a56..3c10f5e9 100644 --- a/src/Persistence/ManagerRegistry.php +++ b/src/Persistence/ManagerRegistry.php @@ -66,10 +66,10 @@ public function getManagerNames(); * * @param string $persistentObject The name of the persistent object. * @param string|null $persistentManagerName The object manager name (null for the default one). - * @psalm-param class-string $persistentObject + * @phpstan-param class-string $persistentObject * * @return ObjectRepository - * @psalm-return ObjectRepository + * @phpstan-return ObjectRepository * * @template T of object */ diff --git a/src/Persistence/Mapping/AbstractClassMetadataFactory.php b/src/Persistence/Mapping/AbstractClassMetadataFactory.php index e8f6acaa..45e7e1e1 100644 --- a/src/Persistence/Mapping/AbstractClassMetadataFactory.php +++ b/src/Persistence/Mapping/AbstractClassMetadataFactory.php @@ -47,7 +47,7 @@ abstract class AbstractClassMetadataFactory implements ClassMetadataFactory /** * @var array - * @psalm-var CMTemplate[] + * @phpstan-var CMTemplate[] */ private $loadedMetadata = []; @@ -74,7 +74,7 @@ final protected function getCache(): ?CacheItemPoolInterface * Returns an array of all the loaded metadata currently in memory. * * @return ClassMetadata[] - * @psalm-return CMTemplate[] + * @phpstan-return CMTemplate[] */ public function getLoadedMetadata() { @@ -122,7 +122,7 @@ abstract protected function getDriver(); /** * Wakes up reflection after ClassMetadata gets unserialized from cache. * - * @psalm-param CMTemplate $class + * @phpstan-param CMTemplate $class * * @return void */ @@ -134,7 +134,7 @@ abstract protected function wakeupReflection( /** * Initializes Reflection after ClassMetadata was constructed. * - * @psalm-param CMTemplate $class + * @phpstan-param CMTemplate $class * * @return void */ @@ -148,7 +148,7 @@ abstract protected function initializeReflection( * * This method should return false for mapped superclasses or embedded classes. * - * @psalm-param CMTemplate $class + * @phpstan-param CMTemplate $class * * @return bool */ @@ -157,9 +157,9 @@ abstract protected function isEntity(ClassMetadata $class); /** * Removes the prepended backslash of a class string to conform with how php outputs class names * - * @psalm-param class-string $className + * @phpstan-param class-string $className * - * @psalm-return class-string + * @phpstan-return class-string */ private function normalizeClassName(string $className): string { @@ -199,7 +199,7 @@ public function getMetadataFor(string $className) if ($this->cache !== null) { $cached = $this->cache->getItem($this->getCacheKey($realClassName))->get(); if ($cached instanceof ClassMetadata) { - /** @psalm-var CMTemplate $cached */ + /** @phpstan-var CMTemplate $cached */ $this->loadedMetadata[$realClassName] = $cached; $this->wakeupReflection($cached, $this->getReflectionService()); @@ -257,8 +257,8 @@ public function hasMetadataFor(string $className) * * NOTE: This is only useful in very special cases, like when generating proxy classes. * - * @psalm-param class-string $className - * @psalm-param CMTemplate $class + * @phpstan-param class-string $className + * @phpstan-param CMTemplate $class * * @return void */ @@ -270,10 +270,10 @@ public function setMetadataFor(string $className, ClassMetadata $class) /** * Gets an array of parent classes for the given entity class. * - * @psalm-param class-string $name + * @phpstan-param class-string $name * * @return string[] - * @psalm-return list + * @phpstan-return list */ protected function getParentClasses(string $name) { @@ -302,10 +302,10 @@ protected function getParentClasses(string $name) * should be used for reflection. * * @param string $name The name of the class for which the metadata should get loaded. - * @psalm-param class-string $name + * @phpstan-param class-string $name * * @return array - * @psalm-return list + * @phpstan-return list */ protected function loadMetadata(string $name) { @@ -366,7 +366,7 @@ protected function loadMetadata(string $name) * Override this method to implement a fallback strategy for failed metadata loading * * @return ClassMetadata|null - * @psalm-return CMTemplate|null + * @phpstan-return CMTemplate|null */ protected function onNotFoundMetadata(string $className) { @@ -378,8 +378,8 @@ protected function onNotFoundMetadata(string $className) * * @param bool $rootEntityFound True when there is another entity (non-mapped superclass) class above the current class in the PHP class hierarchy. * @param list $nonSuperclassParents All parent class names that are not marked as mapped superclasses, with the direct parent class being the first and the root entity class the last element. - * @psalm-param CMTemplate $class - * @psalm-param CMTemplate|null $parent + * @phpstan-param CMTemplate $class + * @phpstan-param CMTemplate|null $parent * * @return void */ @@ -393,10 +393,10 @@ abstract protected function doLoadMetadata( /** * Creates a new ClassMetadata instance for the given class name. * - * @psalm-param class-string $className + * @phpstan-param class-string $className * * @return ClassMetadata - * @psalm-return CMTemplate + * @phpstan-return CMTemplate * * @template T of object */ @@ -419,7 +419,7 @@ public function isTransient(string $className) throw MappingException::nonExistingClass($className); } - /** @psalm-var class-string $className */ + /** @phpstan-var class-string $className */ return $this->getDriver()->isTransient($className); } @@ -455,9 +455,9 @@ protected function getCacheKey(string $realClassName): string /** * Gets the real class name of a class name that could be a proxy. * - * @psalm-param class-string>|class-string $class + * @phpstan-param class-string>|class-string $class * - * @psalm-return class-string + * @phpstan-return class-string * * @template T of object */ @@ -476,9 +476,9 @@ private function createDefaultProxyClassNameResolver(): void { $this->proxyClassNameResolver = new class implements ProxyClassNameResolver { /** - * @psalm-param class-string>|class-string $className + * @phpstan-param class-string>|class-string $className * - * @psalm-return class-string + * @phpstan-return class-string * * @template T of object */ @@ -487,11 +487,11 @@ public function resolveClassName(string $className): string $pos = strrpos($className, '\\' . Proxy::MARKER . '\\'); if ($pos === false) { - /** @psalm-var class-string */ + /** @phpstan-var class-string */ return $className; } - /** @psalm-var class-string */ + /** @phpstan-var class-string */ return substr($className, $pos + Proxy::MARKER_LENGTH + 2); } }; diff --git a/src/Persistence/Mapping/ClassMetadata.php b/src/Persistence/Mapping/ClassMetadata.php index f407ba3b..c258aa2c 100644 --- a/src/Persistence/Mapping/ClassMetadata.php +++ b/src/Persistence/Mapping/ClassMetadata.php @@ -17,7 +17,7 @@ interface ClassMetadata * Gets the fully-qualified class name of this persistent class. * * @return string - * @psalm-return class-string + * @phpstan-return class-string */ public function getName(); @@ -27,7 +27,7 @@ public function getName(); * The returned structure is an array of the identifier field names. * * @return array - * @psalm-return list + * @phpstan-return list */ public function getIdentifier(); @@ -112,7 +112,7 @@ public function getTypeOfField(string $fieldName); * Returns the target class name of the given association. * * @return string|null - * @psalm-return class-string|null + * @phpstan-return class-string|null */ public function getAssociationTargetClass(string $assocName); diff --git a/src/Persistence/Mapping/ClassMetadataFactory.php b/src/Persistence/Mapping/ClassMetadataFactory.php index 28b83033..25c649e5 100644 --- a/src/Persistence/Mapping/ClassMetadataFactory.php +++ b/src/Persistence/Mapping/ClassMetadataFactory.php @@ -16,7 +16,7 @@ interface ClassMetadataFactory * mapping driver. * * @return ClassMetadata[] The ClassMetadata instances of all mapped classes. - * @psalm-return list + * @phpstan-return list */ public function getAllMetadata(); @@ -26,7 +26,7 @@ public function getAllMetadata(); * @param class-string $className The name of the class. * * @return ClassMetadata - * @psalm-return T + * @phpstan-return T */ public function getMetadataFor(string $className); @@ -43,7 +43,7 @@ public function hasMetadataFor(string $className); * Sets the metadata descriptor for a specific class. * * @param class-string $className - * @psalm-param T $class + * @phpstan-param T $class * * @return void */ @@ -53,7 +53,7 @@ public function setMetadataFor(string $className, ClassMetadata $class); * Returns whether the class with the specified name should have its metadata loaded. * This is only the case if it is either mapped directly or as a MappedSuperclass. * - * @psalm-param class-string $className + * @phpstan-param class-string $className * * @return bool */ diff --git a/src/Persistence/Mapping/Driver/ColocatedMappingDriver.php b/src/Persistence/Mapping/Driver/ColocatedMappingDriver.php index e85ba700..00bc9da2 100644 --- a/src/Persistence/Mapping/Driver/ColocatedMappingDriver.php +++ b/src/Persistence/Mapping/Driver/ColocatedMappingDriver.php @@ -54,7 +54,7 @@ trait ColocatedMappingDriver * Cache for getAllClassNames(). * * @var array|null - * @psalm-var list|null + * @phpstan-var list|null */ protected $classNames; @@ -128,7 +128,7 @@ public function setFileExtension(string $fileExtension) * Returns whether the class with the specified name is transient. Only non-transient * classes, that is entities and mapped superclasses, should have their metadata loaded. * - * @psalm-param class-string $className + * @phpstan-param class-string $className * * @return bool */ @@ -138,7 +138,7 @@ abstract public function isTransient(string $className); * Gets the names of all mapped classes known to this driver. * * @return string[] The names of all mapped classes known to this driver. - * @psalm-return list + * @phpstan-return list */ public function getAllClassNames() { diff --git a/src/Persistence/Mapping/Driver/DefaultFileLocator.php b/src/Persistence/Mapping/Driver/DefaultFileLocator.php index 9b00e744..1f48ddee 100644 --- a/src/Persistence/Mapping/Driver/DefaultFileLocator.php +++ b/src/Persistence/Mapping/Driver/DefaultFileLocator.php @@ -147,7 +147,7 @@ public function getAllClassNames(string $globalBasename) // NOTE: All files found here means classes are not transient! assert(is_string($fileName)); - /** @psalm-var class-string */ + /** @phpstan-var class-string */ $class = str_replace('.', '\\', $fileName); $classes[] = $class; } diff --git a/src/Persistence/Mapping/Driver/FileDriver.php b/src/Persistence/Mapping/Driver/FileDriver.php index c1162331..4c2d86d0 100644 --- a/src/Persistence/Mapping/Driver/FileDriver.php +++ b/src/Persistence/Mapping/Driver/FileDriver.php @@ -31,7 +31,7 @@ abstract class FileDriver implements MappingDriver /** * @var mixed[]|null - * @psalm-var array|null + * @phpstan-var array|null */ protected $classCache; @@ -78,7 +78,7 @@ public function getGlobalBasename() * Gets the element of schema meta data for the class from the mapping file. * This will lazily load the mapping file if it is not loaded yet. * - * @psalm-param class-string $className + * @phpstan-param class-string $className * * @return T The element of schema meta data. * @@ -137,7 +137,7 @@ public function getAllClassNames() return $this->locator->getAllClassNames($this->globalBasename); } - /** @psalm-var array> $classCache */ + /** @phpstan-var array> $classCache */ $classCache = $this->classCache; /** @var list $keys */ @@ -156,7 +156,7 @@ public function getAllClassNames() * @param string $file The mapping file to load. * * @return mixed[] - * @psalm-return array + * @phpstan-return array */ abstract protected function loadMappingFile(string $file); diff --git a/src/Persistence/Mapping/Driver/FileLocator.php b/src/Persistence/Mapping/Driver/FileLocator.php index e57d5398..0a338753 100644 --- a/src/Persistence/Mapping/Driver/FileLocator.php +++ b/src/Persistence/Mapping/Driver/FileLocator.php @@ -25,7 +25,7 @@ public function findMappingFile(string $className); * @param string $globalBasename Passed to allow excluding the basename. * * @return array - * @psalm-return list + * @phpstan-return list */ public function getAllClassNames(string $globalBasename); diff --git a/src/Persistence/Mapping/Driver/MappingDriver.php b/src/Persistence/Mapping/Driver/MappingDriver.php index 9b6f0c80..b59eb968 100644 --- a/src/Persistence/Mapping/Driver/MappingDriver.php +++ b/src/Persistence/Mapping/Driver/MappingDriver.php @@ -14,8 +14,8 @@ interface MappingDriver /** * Loads the metadata for the specified class into the provided container. * - * @psalm-param class-string $className - * @psalm-param ClassMetadata $metadata + * @phpstan-param class-string $className + * @phpstan-param ClassMetadata $metadata * * @return void * @@ -27,7 +27,7 @@ public function loadMetadataForClass(string $className, ClassMetadata $metadata) * Gets the names of all mapped classes known to this driver. * * @return array The names of all mapped classes known to this driver. - * @psalm-return list + * @phpstan-return list */ public function getAllClassNames(); @@ -35,7 +35,7 @@ public function getAllClassNames(); * Returns whether the class with the specified name should have its metadata loaded. * This is only the case if it is either mapped as an Entity or a MappedSuperclass. * - * @psalm-param class-string $className + * @phpstan-param class-string $className * * @return bool */ diff --git a/src/Persistence/Mapping/Driver/PHPDriver.php b/src/Persistence/Mapping/Driver/PHPDriver.php index 1c1ab9c8..052cafbf 100644 --- a/src/Persistence/Mapping/Driver/PHPDriver.php +++ b/src/Persistence/Mapping/Driver/PHPDriver.php @@ -16,7 +16,7 @@ class PHPDriver extends FileDriver { /** * @var ClassMetadata - * @psalm-var ClassMetadata + * @phpstan-var ClassMetadata */ protected $metadata; diff --git a/src/Persistence/Mapping/Driver/StaticPHPDriver.php b/src/Persistence/Mapping/Driver/StaticPHPDriver.php index bbcff757..f00a6398 100644 --- a/src/Persistence/Mapping/Driver/StaticPHPDriver.php +++ b/src/Persistence/Mapping/Driver/StaticPHPDriver.php @@ -35,7 +35,7 @@ class StaticPHPDriver implements MappingDriver * Map of all class names. * * @var array - * @psalm-var list + * @phpstan-var list */ private $classNames; diff --git a/src/Persistence/Mapping/Driver/SymfonyFileLocator.php b/src/Persistence/Mapping/Driver/SymfonyFileLocator.php index 428d5fbc..ff662d78 100644 --- a/src/Persistence/Mapping/Driver/SymfonyFileLocator.php +++ b/src/Persistence/Mapping/Driver/SymfonyFileLocator.php @@ -202,10 +202,10 @@ public function getAllClassNames(?string $globalBasename = null) '\\' ); - /** @psalm-var class-string */ + /** @phpstan-var class-string */ $class = $this->prefixes[$path] . str_replace(DIRECTORY_SEPARATOR, '\\', $nsSuffix) . '\\' . str_replace($this->nsSeparator, '\\', $fileName); } else { - /** @psalm-var class-string */ + /** @phpstan-var class-string */ $class = str_replace($this->nsSeparator, '\\', $fileName); } diff --git a/src/Persistence/Mapping/ProxyClassNameResolver.php b/src/Persistence/Mapping/ProxyClassNameResolver.php index 2801d909..59b8c98a 100644 --- a/src/Persistence/Mapping/ProxyClassNameResolver.php +++ b/src/Persistence/Mapping/ProxyClassNameResolver.php @@ -9,9 +9,9 @@ interface ProxyClassNameResolver { /** - * @psalm-param class-string>|class-string $className + * @phpstan-param class-string>|class-string $className * - * @psalm-return class-string + * @phpstan-return class-string * * @template T of object */ diff --git a/src/Persistence/Mapping/ReflectionService.php b/src/Persistence/Mapping/ReflectionService.php index 9484e1f3..9b30ee6f 100644 --- a/src/Persistence/Mapping/ReflectionService.php +++ b/src/Persistence/Mapping/ReflectionService.php @@ -18,10 +18,10 @@ interface ReflectionService /** * Returns an array of the parent classes (not interfaces) for the given class. * - * @psalm-param class-string $class + * @phpstan-param class-string $class * * @return string[] - * @psalm-return class-string[] + * @phpstan-return class-string[] * * @throws MappingException */ @@ -30,14 +30,14 @@ public function getParentClasses(string $class); /** * Returns the shortname of a class. * - * @psalm-param class-string $class + * @phpstan-param class-string $class * * @return string */ public function getClassShortName(string $class); /** - * @psalm-param class-string $class + * @phpstan-param class-string $class * * @return string */ @@ -46,10 +46,10 @@ public function getClassNamespace(string $class); /** * Returns a reflection class instance or null. * - * @psalm-param class-string $class + * @phpstan-param class-string $class * * @return ReflectionClass|null - * @psalm-return ReflectionClass|null + * @phpstan-return ReflectionClass|null * * @template T of object */ @@ -58,7 +58,7 @@ public function getClass(string $class); /** * Returns an accessible property (setAccessible(true)) or null. * - * @psalm-param class-string $class + * @phpstan-param class-string $class * * @return ReflectionProperty|null */ @@ -67,7 +67,7 @@ public function getAccessibleProperty(string $class, string $property); /** * Checks if the class have a public method with the given name. * - * @psalm-param class-string $class + * @phpstan-param class-string $class * * @return bool */ diff --git a/src/Persistence/Mapping/RuntimeReflectionService.php b/src/Persistence/Mapping/RuntimeReflectionService.php index 399e0575..2be1500c 100644 --- a/src/Persistence/Mapping/RuntimeReflectionService.php +++ b/src/Persistence/Mapping/RuntimeReflectionService.php @@ -67,10 +67,10 @@ public function getClassNamespace(string $class) } /** - * @psalm-param class-string $class + * @phpstan-param class-string $class * * @return ReflectionClass - * @psalm-return ReflectionClass + * @phpstan-return ReflectionClass * * @template T of object */ diff --git a/src/Persistence/ObjectManager.php b/src/Persistence/ObjectManager.php index efac5c31..cb2301d5 100644 --- a/src/Persistence/ObjectManager.php +++ b/src/Persistence/ObjectManager.php @@ -21,10 +21,10 @@ interface ObjectManager * * @param string $className The class name of the object to find. * @param mixed $id The identity of the object to find. - * @psalm-param class-string $className + * @phpstan-param class-string $className * * @return object|null The found object. - * @psalm-return T|null + * @phpstan-return T|null * * @template T of object */ @@ -98,9 +98,9 @@ public function flush(); /** * Gets the repository for a class. * - * @psalm-param class-string $className + * @phpstan-param class-string $className * - * @psalm-return ObjectRepository + * @phpstan-return ObjectRepository * * @template T of object */ @@ -112,9 +112,9 @@ public function getRepository(string $className); * The class name must be the fully-qualified class name without a leading backslash * (as it is returned by get_class($obj)). * - * @psalm-param class-string $className + * @phpstan-param class-string $className * - * @psalm-return ClassMetadata + * @phpstan-return ClassMetadata * * @template T of object */ @@ -123,7 +123,7 @@ public function getClassMetadata(string $className); /** * Gets the metadata factory used to gather the metadata of classes. * - * @psalm-return ClassMetadataFactory> + * @phpstan-return ClassMetadataFactory> */ public function getMetadataFactory(); diff --git a/src/Persistence/ObjectManagerDecorator.php b/src/Persistence/ObjectManagerDecorator.php index 8c038b8e..31f4d035 100644 --- a/src/Persistence/ObjectManagerDecorator.php +++ b/src/Persistence/ObjectManagerDecorator.php @@ -71,7 +71,7 @@ public function getClassMetadata(string $className) return $this->wrapped->getClassMetadata($className); } - /** @psalm-return ClassMetadataFactory> */ + /** @phpstan-return ClassMetadataFactory> */ public function getMetadataFactory() { return $this->wrapped->getMetadataFactory(); diff --git a/src/Persistence/ObjectRepository.php b/src/Persistence/ObjectRepository.php index a714731e..2af6246d 100644 --- a/src/Persistence/ObjectRepository.php +++ b/src/Persistence/ObjectRepository.php @@ -19,7 +19,7 @@ interface ObjectRepository * @param mixed $id The identifier. * * @return object|null The object. - * @psalm-return T|null + * @phpstan-return T|null */ public function find($id); @@ -27,7 +27,7 @@ public function find($id); * Finds all objects in the repository. * * @return array The objects. - * @psalm-return T[] + * @phpstan-return T[] */ public function findAll(); @@ -40,10 +40,10 @@ public function findAll(); * * @param array $criteria * @param array|null $orderBy - * @psalm-param array|null $orderBy + * @phpstan-param array|null $orderBy * * @return array The objects. - * @psalm-return T[] + * @phpstan-return T[] * * @throws UnexpectedValueException */ @@ -60,14 +60,14 @@ public function findBy( * @param array $criteria The criteria. * * @return object|null The object. - * @psalm-return T|null + * @phpstan-return T|null */ public function findOneBy(array $criteria); /** * Returns the class name of the object managed by the repository. * - * @psalm-return class-string + * @phpstan-return class-string */ public function getClassName(); } diff --git a/src/Persistence/Reflection/EnumReflectionProperty.php b/src/Persistence/Reflection/EnumReflectionProperty.php index 114b9dbb..01394270 100644 --- a/src/Persistence/Reflection/EnumReflectionProperty.php +++ b/src/Persistence/Reflection/EnumReflectionProperty.php @@ -32,31 +32,16 @@ public function __construct(ReflectionProperty $originalReflectionProperty, stri $this->enumType = $enumType; } - /** - * {@inheritDoc} - * - * @psalm-external-mutation-free - */ public function getDeclaringClass(): ReflectionClass { return $this->originalReflectionProperty->getDeclaringClass(); } - /** - * {@inheritDoc} - * - * @psalm-external-mutation-free - */ public function getName(): string { return $this->originalReflectionProperty->getName(); } - /** - * {@inheritDoc} - * - * @psalm-external-mutation-free - */ public function getType(): ?ReflectionType { return $this->originalReflectionProperty->getType(); @@ -149,31 +134,16 @@ private function toEnum($value) return $this->enumType::from($value); } - /** - * {@inheritDoc} - * - * @psalm-external-mutation-free - */ public function getModifiers(): int { return $this->originalReflectionProperty->getModifiers(); } - /** - * {@inheritDoc} - * - * @psalm-external-mutation-free - */ public function getDocComment(): string|false { return $this->originalReflectionProperty->getDocComment(); } - /** - * {@inheritDoc} - * - * @psalm-external-mutation-free - */ public function isPrivate(): bool { return $this->originalReflectionProperty->isPrivate(); diff --git a/tests/Persistence/Event/PreUpdateEventArgsTest.php b/tests/Persistence/Event/PreUpdateEventArgsTest.php index fcaa1f93..c48b816a 100644 --- a/tests/Persistence/Event/PreUpdateEventArgsTest.php +++ b/tests/Persistence/Event/PreUpdateEventArgsTest.php @@ -65,7 +65,7 @@ public function testSetNewValueThrowsInvalidArgumentExceptionOnInvalidField(): v $event->setNewValue('does_not_exist', 'new value'); } - /** @psalm-return PreUpdateEventArgs */ + /** @phpstan-return PreUpdateEventArgs */ private function createTestPreUpdateEventArgs(): PreUpdateEventArgs { $entity = new TestObject(); diff --git a/tests/Persistence/ManagerRegistryTest.php b/tests/Persistence/ManagerRegistryTest.php index 505fa5d6..96177557 100644 --- a/tests/Persistence/ManagerRegistryTest.php +++ b/tests/Persistence/ManagerRegistryTest.php @@ -185,7 +185,7 @@ class TestManagerRegistry extends AbstractManagerRegistry /** * {@inheritDoc} * - * @psalm-param class-string $proxyInterfaceName + * @phpstan-param class-string $proxyInterfaceName */ public function __construct( string $name, diff --git a/tests/Persistence/Mapping/AbstractClassMetadataFactoryTest.php b/tests/Persistence/Mapping/AbstractClassMetadataFactoryTest.php index 63d90f3e..862e9475 100644 --- a/tests/Persistence/Mapping/AbstractClassMetadataFactoryTest.php +++ b/tests/Persistence/Mapping/AbstractClassMetadataFactoryTest.php @@ -60,8 +60,8 @@ public function testItThrowsWhenAttemptingToGetMetadataForShortAlias(): void $cmf = $this->getMockForAbstractClass(AbstractClassMetadataFactory::class); $this->expectException(MappingException::class); /** - * @psalm-suppress ArgumentTypeCoercion - * @psalm-suppress UndefinedClass + * @phpstan-suppress ArgumentTypeCoercion + * @phpstan-suppress UndefinedClass */ // @phpstan-ignore-next-line $cmf->getMetadataFor('App:Test'); @@ -72,8 +72,8 @@ public function testItThrowsWhenAttemptingToCheckTransientForShortAlias(): void $cmf = $this->getMockForAbstractClass(AbstractClassMetadataFactory::class); $this->expectException(MappingException::class); /** - * @psalm-suppress ArgumentTypeCoercion - * @psalm-suppress UndefinedClass + * @phpstan-suppress ArgumentTypeCoercion + * @phpstan-suppress UndefinedClass */ // @phpstan-ignore-next-line $cmf->isTransient('App:Test'); @@ -89,7 +89,7 @@ public function testItGetsTheSameMetadataForBackslashedClassName(): void self::createStub(ClassMetadata::class) ); - /** @psalm-suppress ArgumentTypeCoercion */ + /** @phpstan-suppress ArgumentTypeCoercion */ self::assertSame($cmf->getMetadataFor(SomeOtherEntity::class), $cmf->getMetadataFor('\\' . SomeOtherEntity::class)); } } diff --git a/tests/Persistence/Mapping/ClassMetadataFactoryTest.php b/tests/Persistence/Mapping/ClassMetadataFactoryTest.php index 1e1b37db..0b7ab2c0 100644 --- a/tests/Persistence/Mapping/ClassMetadataFactoryTest.php +++ b/tests/Persistence/Mapping/ClassMetadataFactoryTest.php @@ -21,7 +21,7 @@ class ClassMetadataFactoryTest extends DoctrineTestCase { /** * @var TestClassMetadataFactory - * @psalm-var TestClassMetadataFactory> + * @phpstan-var TestClassMetadataFactory> */ private $cmf; @@ -29,7 +29,7 @@ protected function setUp(): void { $driver = $this->createMock(MappingDriver::class); - /** @psalm-var ClassMetadata */ + /** @phpstan-var ClassMetadata */ $metadata = $this->createMock(ClassMetadata::class); $this->cmf = new TestClassMetadataFactory($driver, $metadata); } @@ -192,7 +192,7 @@ public function testWillNotCacheFallbackMetadata(): void self::assertSame($metadata, $this->cmf->getMetadataFor(Foo::class)); } - /** @psalm-param AbstractClassMetadataFactory> $classMetadataFactory */ + /** @phpstan-param AbstractClassMetadataFactory> $classMetadataFactory */ private static function getCache(AbstractClassMetadataFactory $classMetadataFactory): ?CacheItemPoolInterface { $method = new ReflectionMethod($classMetadataFactory, 'getCache'); diff --git a/tests/Persistence/Mapping/Fixtures/TestClassMetadata.php b/tests/Persistence/Mapping/Fixtures/TestClassMetadata.php index 753a944f..95654f46 100644 --- a/tests/Persistence/Mapping/Fixtures/TestClassMetadata.php +++ b/tests/Persistence/Mapping/Fixtures/TestClassMetadata.php @@ -16,11 +16,11 @@ final class TestClassMetadata implements ClassMetadata { /** * @var string - * @psalm-var class-string + * @phpstan-var class-string */ private $className; - /** @psalm-param class-string $className */ + /** @phpstan-param class-string $className */ public function __construct(string $className) { $this->className = $className; diff --git a/tests/Persistence/Mapping/StaticPHPDriverTest.php b/tests/Persistence/Mapping/StaticPHPDriverTest.php index d3ac1870..9519c069 100644 --- a/tests/Persistence/Mapping/StaticPHPDriverTest.php +++ b/tests/Persistence/Mapping/StaticPHPDriverTest.php @@ -30,7 +30,7 @@ public function testGetAllClassNames(): void class TestEntity { - /** @psalm-param ClassMetadata $metadata */ + /** @phpstan-param ClassMetadata $metadata */ public static function loadMetadata(ClassMetadata $metadata): void { $metadata->getFieldNames(); diff --git a/tests/Persistence/Mapping/TestClassMetadataFactory.php b/tests/Persistence/Mapping/TestClassMetadataFactory.php index 75af8047..27154586 100644 --- a/tests/Persistence/Mapping/TestClassMetadataFactory.php +++ b/tests/Persistence/Mapping/TestClassMetadataFactory.php @@ -20,14 +20,14 @@ class TestClassMetadataFactory extends AbstractClassMetadataFactory /** * @var ClassMetadata - * @psalm-var CMTemplate + * @phpstan-var CMTemplate */ public $metadata; /** @var callable|null */ public $fallbackCallback; - /** @psalm-param CMTemplate $metadata */ + /** @phpstan-param CMTemplate $metadata */ public function __construct(MappingDriver $driver, ClassMetadata $metadata) { $this->driver = $driver; diff --git a/tests/Persistence/ObjectManagerDecoratorTest.php b/tests/Persistence/ObjectManagerDecoratorTest.php index b2ccb1d2..fd32f595 100644 --- a/tests/Persistence/ObjectManagerDecoratorTest.php +++ b/tests/Persistence/ObjectManagerDecoratorTest.php @@ -160,7 +160,7 @@ public function testContains(): void /** @extends ObjectManagerDecorator */ class NullObjectManagerDecorator extends ObjectManagerDecorator { - /** @psalm-param ObjectManager&MockObject $wrapped */ + /** @phpstan-param ObjectManager&MockObject $wrapped */ public function __construct(ObjectManager $wrapped) { $this->wrapped = $wrapped;