Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove vendor prefix of PHPDoc referencing class-string #11643

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Remove vendor prefix of PHPDoc referencing class-string
derrabus committed Oct 9, 2024
commit 61775dd50bfcb512df750c2a1fea3318614bdc2e
2 changes: 1 addition & 1 deletion psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -305,7 +305,7 @@
<code><![CDATA[$persister->loadById($sortedId)]]></code>
</InvalidReturnStatement>
<InvalidReturnType>
<code><![CDATA[?T]]></code>
<code><![CDATA[T|null]]></code>
</InvalidReturnType>
<MissingReturnType>
<code><![CDATA[wrapInTransaction]]></code>
6 changes: 2 additions & 4 deletions src/Cache/AssociationCacheEntry.php
Original file line number Diff line number Diff line change
@@ -21,15 +21,13 @@ class AssociationCacheEntry implements CacheEntry
* The entity class name
*
* @readonly Public only for performance reasons, it should be considered immutable.
* @var string
* @psalm-var class-string
* @var class-string
*/
public $class;

/**
* @param string $class The entity class.
* @param class-string $class The entity class.
* @param array<string, mixed> $identifier The entity identifier.
* @psalm-param class-string $class
*/
public function __construct($class, array $identifier)
{
6 changes: 2 additions & 4 deletions src/Cache/CollectionCacheKey.php
Original file line number Diff line number Diff line change
@@ -26,8 +26,7 @@ class CollectionCacheKey extends CacheKey
* The owner entity class
*
* @readonly Public only for performance reasons, it should be considered immutable.
* @var string
* @psalm-var class-string
* @var class-string
*/
public $entityClass;

@@ -40,10 +39,9 @@ class CollectionCacheKey extends CacheKey
public $association;

/**
* @param string $entityClass The entity class.
* @param class-string $entityClass The entity class.
* @param string $association The field name that represents the association.
* @param array<string, mixed> $ownerIdentifier The identifier of the owning entity.
* @psalm-param class-string $entityClass
*/
public function __construct($entityClass, $association, array $ownerIdentifier)
{
6 changes: 2 additions & 4 deletions src/Cache/EntityCacheEntry.php
Original file line number Diff line number Diff line change
@@ -25,15 +25,13 @@ class EntityCacheEntry implements CacheEntry
* The entity class name
*
* @readonly Public only for performance reasons, it should be considered immutable.
* @var string
* @psalm-var class-string
* @var class-string
*/
public $class;

/**
* @param string $class The entity class.
* @param class-string $class The entity class.
* @param array<string,mixed> $data The entity data.
* @psalm-param class-string $class
*/
public function __construct($class, array $data)
{
6 changes: 2 additions & 4 deletions src/Cache/EntityCacheKey.php
Original file line number Diff line number Diff line change
@@ -26,15 +26,13 @@ class EntityCacheKey extends CacheKey
* The entity class name
*
* @readonly Public only for performance reasons, it should be considered immutable.
* @var string
* @psalm-var class-string
* @var class-string
*/
public $entityClass;

/**
* @param string $entityClass The entity class name. In a inheritance hierarchy it should always be the root entity class.
* @param class-string $entityClass The entity class name. In a inheritance hierarchy it should always be the root entity class.
* @param array<string, mixed> $identifier The entity identifier
* @psalm-param class-string $entityClass
*/
public function __construct($entityClass, array $identifier)
{
Original file line number Diff line number Diff line change
@@ -254,9 +254,8 @@ protected function evictCollectionCache(PersistentCollection $collection)
/**
* @deprecated This method is not used anymore.
*
* @param string $targetEntity
* @param object $element
* @psalm-param class-string $targetEntity
* @param class-string $targetEntity
* @param object $element
*
* @return void
*/
40 changes: 14 additions & 26 deletions src/Configuration.php
Original file line number Diff line number Diff line change
@@ -687,8 +687,7 @@ public function addCustomNumericFunction($name, $className)
*
* @param string $name
*
* @return string|callable|null
* @psalm-return class-string|callable|null
* @return class-string|callable|null
*/
public function getCustomNumericFunction($name)
{
@@ -705,7 +704,7 @@ public function getCustomNumericFunction($name)
*
* Any previously added numeric functions are discarded.
*
* @psalm-param array<string, class-string> $functions The map of custom
* @param array<string, class-string> $functions The map of custom
* DQL numeric functions.
*
* @return void
@@ -740,8 +739,7 @@ public function addCustomDatetimeFunction($name, $className)
*
* @param string $name
*
* @return string|callable|null
* @psalm-return class-string|callable|null
* @return class-string|callable|null
*/
public function getCustomDatetimeFunction($name)
{
@@ -807,8 +805,7 @@ public function setCustomHydrationModes($modes)
*
* @param string $modeName The hydration mode name.
*
* @return string|null The hydrator class name.
* @psalm-return class-string<AbstractHydrator>|null
* @return class-string<AbstractHydrator>|null The hydrator class name.
*/
public function getCustomHydrationMode($modeName)
{
@@ -818,9 +815,8 @@ public function getCustomHydrationMode($modeName)
/**
* Adds a custom hydration mode.
*
* @param string $modeName The hydration mode name.
* @param string $hydrator The hydrator class name.
* @psalm-param class-string<AbstractHydrator> $hydrator
* @param string $modeName The hydration mode name.
* @param class-string<AbstractHydrator> $hydrator The hydrator class name.
*
* @return void
*/
@@ -832,8 +828,7 @@ public function addCustomHydrationMode($modeName, $hydrator)
/**
* Sets a class metadata factory.
*
* @param string $cmfName
* @psalm-param class-string $cmfName
* @param class-string $cmfName
*
* @return void
*/
@@ -842,10 +837,7 @@ public function setClassMetadataFactoryName($cmfName)
$this->_attributes['classMetadataFactoryName'] = $cmfName;
}

/**
* @return string
* @psalm-return class-string
*/
/** @return class-string */
public function getClassMetadataFactoryName()
{
if (! isset($this->_attributes['classMetadataFactoryName'])) {
@@ -858,9 +850,8 @@ public function getClassMetadataFactoryName()
/**
* Adds a filter to the list of possible filters.
*
* @param string $name The name of the filter.
* @param string $className The class name of the filter.
* @psalm-param class-string<SQLFilter> $className
* @param string $name The name of the filter.
* @param class-string<SQLFilter> $className The class name of the filter.
*
* @return void
*/
@@ -874,9 +865,8 @@ public function addFilter($name, $className)
*
* @param string $name The name of the filter.
*
* @return string|null The class name of the filter, or null if it is not
* defined.
* @psalm-return class-string<SQLFilter>|null
* @return class-string<SQLFilter>|null The class name of the filter,
* or null if it is not defined.
*/
public function getFilterClassName($name)
{
@@ -886,8 +876,7 @@ public function getFilterClassName($name)
/**
* Sets default repository class.
*
* @param string $className
* @psalm-param class-string<EntityRepository> $className
* @param class-string<EntityRepository> $className
*
* @return void
*
@@ -915,8 +904,7 @@ public function setDefaultRepositoryClassName($className)
/**
* Get default repository class.
*
* @return string
* @psalm-return class-string<EntityRepository>
* @return class-string<EntityRepository>
*/
public function getDefaultRepositoryClassName()
{
2 changes: 1 addition & 1 deletion src/Decorator/EntityManagerDecorator.php
Original file line number Diff line number Diff line change
@@ -50,7 +50,7 @@ public function getExpressionBuilder()
/**
* {@inheritDoc}
*
* @psalm-param class-string<T> $className
* @param class-string<T> $className
*
* @psalm-return EntityRepository<T>
*
27 changes: 11 additions & 16 deletions src/EntityManager.php
Original file line number Diff line number Diff line change
@@ -30,7 +30,6 @@
use Doctrine\ORM\Query\ResultSetMapping;
use Doctrine\ORM\Repository\RepositoryFactory;
use Doctrine\Persistence\Mapping\MappingException;
use Doctrine\Persistence\ObjectRepository;
use InvalidArgumentException;
use Throwable;

@@ -407,25 +406,23 @@ public function flush($entity = null)
/**
* Finds an Entity by its identifier.
*
* @param string $className The class name of the entity to find.
* @param mixed $id The identity of the entity to find.
* @param int|null $lockMode One of the \Doctrine\DBAL\LockMode::* constants
* or NULL if no specific lock mode should be used
* during the search.
* @param int|null $lockVersion The version of the entity to find when using
* optimistic locking.
* @psalm-param class-string<T> $className
* @param class-string<T> $className The class name of the entity to find.
* @param mixed $id The identity of the entity to find.
* @param int|null $lockMode One of the \Doctrine\DBAL\LockMode::* constants
* or NULL if no specific lock mode should be used
* during the search.
* @param int|null $lockVersion The version of the entity to find when using
* optimistic locking.
* @psalm-param LockMode::*|null $lockMode
*
* @return object|null The entity instance or NULL if the entity can not be found.
* @psalm-return ?T
* @return T|null The entity instance or NULL if the entity can not be found.
*
* @throws OptimisticLockException
* @throws ORMInvalidArgumentException
* @throws TransactionRequiredException
* @throws ORMException
*
* @template T
* @template T of object
*/
public function find($className, $id, $lockMode = null, $lockVersion = null)
{
@@ -803,11 +800,9 @@ public function lock($entity, $lockMode, $lockVersion = null)
/**
* Gets the repository for an entity class.
*
* @param string $entityName The name of the entity.
* @psalm-param class-string<T> $entityName
* @param class-string<T> $entityName The name of the entity.
*
* @return ObjectRepository|EntityRepository The repository class.
* @psalm-return EntityRepository<T>
* @return EntityRepository<T> The repository class.
*
* @template T of object
*/
22 changes: 9 additions & 13 deletions src/EntityManagerInterface.php
Original file line number Diff line number Diff line change
@@ -29,9 +29,9 @@ interface EntityManagerInterface extends ObjectManager
/**
* {@inheritDoc}
*
* @psalm-param class-string<T> $className
* @param class-string<T> $className
*
* @psalm-return EntityRepository<T>
* @return EntityRepository<T>
*
* @template T of object
*/
@@ -172,12 +172,10 @@ public function createQueryBuilder();
* Gets a reference to the entity identified by the given type and identifier
* without actually loading it, if the entity is not yet loaded.
*
* @param string $entityName The name of the entity type.
* @param mixed $id The entity identifier.
* @psalm-param class-string<T> $entityName
* @param class-string<T> $entityName The name of the entity type.
* @param mixed $id The entity identifier.
*
* @return object|null The entity reference.
* @psalm-return T|null
* @return T|null The entity reference.
*
* @throws ORMException
*
@@ -202,12 +200,10 @@ public function getReference($entityName, $id);
*
* @deprecated 2.7 This method is being removed from the ORM and won't have any replacement
*
* @param string $entityName The name of the entity type.
* @param mixed $identifier The entity identifier.
* @psalm-param class-string<T> $entityName
* @param class-string<T> $entityName The name of the entity type.
* @param mixed $identifier The entity identifier.
*
* @return object|null The (partial) entity reference
* @psalm-return T|null
* @return T|null The (partial) entity reference
*
* @template T
*/
@@ -337,7 +333,7 @@ public function hasFilters();
/**
* {@inheritDoc}
*
* @psalm-param string|class-string<T> $className
* @param string|class-string<T> $className
*
* @return Mapping\ClassMetadata
* @psalm-return ($className is class-string<T> ? Mapping\ClassMetadata<T> : Mapping\ClassMetadata<object>)
8 changes: 2 additions & 6 deletions src/EntityRepository.php
Original file line number Diff line number Diff line change
@@ -42,8 +42,7 @@ class EntityRepository implements ObjectRepository, Selectable
/**
* @internal This property will be private in 3.0, call {@see getEntityName()} instead.
*
* @var string
* @psalm-var class-string<T>
* @var class-string<T>
*/
protected $_entityName;

@@ -287,10 +286,7 @@ public function __call($method, $arguments)
));
}

/**
* @return string
* @psalm-return class-string<T>
*/
/** @return class-string<T> */
protected function getEntityName()
{
return $this->_entityName;
2 changes: 1 addition & 1 deletion src/Internal/Hydration/ObjectHydrator.php
Original file line number Diff line number Diff line change
@@ -273,7 +273,7 @@ private function getEntity(array $data, string $dqlAlias)
}

/**
* @psalm-param class-string $className
* @param class-string $className
* @psalm-param array<string, mixed> $data
*
* @return mixed
10 changes: 5 additions & 5 deletions src/Mapping/Builder/ClassMetadataBuilder.php
Original file line number Diff line number Diff line change
@@ -218,11 +218,11 @@ public function setSingleTableInheritance()
/**
* Sets the discriminator column details.
*
* @param string $name
* @param string $type
* @param int $length
* @psalm-param class-string<BackedEnum>|null $enumType
* @psalm-param array<string, mixed> $options
* @param string $name
* @param string $type
* @param int $length
* @param class-string<BackedEnum>|null $enumType
* @param array<string, mixed> $options
*
* @return $this
*/
Loading
Loading