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
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
6 changes: 2 additions & 4 deletions src/Cache/AssociationCacheEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
6 changes: 2 additions & 4 deletions src/Cache/CollectionCacheKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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)
{
Expand Down
6 changes: 2 additions & 4 deletions src/Cache/EntityCacheEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
6 changes: 2 additions & 4 deletions src/Cache/EntityCacheKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
40 changes: 14 additions & 26 deletions src/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand All @@ -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
*/
Expand All @@ -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
*/
Expand All @@ -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'])) {
Expand All @@ -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
*/
Expand All @@ -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)
{
Expand All @@ -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
*
Expand Down Expand Up @@ -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()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Decorator/EntityManagerDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function getExpressionBuilder()
/**
* {@inheritDoc}
*
* @psalm-param class-string<T> $className
* @param class-string<T> $className
*
* @psalm-return EntityRepository<T>
*
Expand Down
27 changes: 11 additions & 16 deletions src/EntityManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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
*/
Expand Down
22 changes: 9 additions & 13 deletions src/EntityManagerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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
*
Expand All @@ -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
*/
Expand Down Expand Up @@ -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>)
Expand Down
8 changes: 2 additions & 6 deletions src/EntityRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/Internal/Hydration/ObjectHydrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions src/Mapping/Builder/ClassMetadataBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
Loading
Loading