Skip to content

Commit

Permalink
Merge pull request #10205 from greg0ire/avoid-references-to-annotations
Browse files Browse the repository at this point in the history
Avoid references to annotations
  • Loading branch information
greg0ire authored Nov 6, 2022
2 parents 5d88dc9 + edb6332 commit 2b7485a
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 21 deletions.
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/AssociationOverride.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Doctrine\ORM\Mapping;

/**
* This annotation is used to override association mapping of property for an entity relationship.
* This attribute is used to override association mapping of property for an entity relationship.
*
* @Annotation
* @NamedArgumentConstructor
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/AssociationOverrides.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use function is_array;

/**
* This annotation is used to override association mappings of relationship properties.
* This attribute is used to override association mappings of relationship properties.
*
* @Annotation
* @NamedArgumentConstructor()
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/AttributeOverride.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Doctrine\ORM\Mapping;

/**
* This annotation is used to override the mapping of a entity property.
* This attribute is used to override the mapping of a entity property.
*
* @Annotation
* @NamedArgumentConstructor
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/AttributeOverrides.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use function is_array;

/**
* This annotation is used to override the mapping of a entity property.
* This attribute is used to override the mapping of a entity property.
*
* @Annotation
* @NamedArgumentConstructor()
Expand Down
7 changes: 5 additions & 2 deletions lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -546,8 +546,9 @@ public function loadMetadataForClass($className, PersistenceClassMetadata $metad
}

/**
* @param mixed[] $joinColumns
* @psalm-param array<string, mixed> $mapping
* @param mixed[] $joinColumns
* @param class-string $className
* @param array<string, mixed> $mapping
*/
private function loadRelationShipMapping(
ReflectionProperty $property,
Expand Down Expand Up @@ -660,6 +661,8 @@ private function loadRelationShipMapping(
/**
* Attempts to resolve the fetch mode.
*
* @param class-string $className
*
* @psalm-return ClassMetadata::FETCH_* The fetch mode as defined in ClassMetadata.
*
* @throws MappingException If the fetch mode is not valid.
Expand Down
4 changes: 2 additions & 2 deletions lib/Doctrine/ORM/Mapping/Driver/AttributeDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -566,8 +566,8 @@ public function loadMetadataForClass($className, PersistenceClassMetadata $metad
/**
* Attempts to resolve the fetch mode.
*
* @param string $className The class name.
* @param string $fetchMode The fetch mode.
* @param class-string $className The class name.
* @param string $fetchMode The fetch mode.
*
* @return ClassMetadata::FETCH_* The fetch mode as defined in ClassMetadata.
*
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ private function getCascadeMappings(SimpleXMLElement $cascadeElement): array
foreach ($cascadeElement->children() as $action) {
// According to the JPA specifications, XML uses "cascade-persist"
// instead of "persist". Here, both variations
// are supported because both YAML and Annotation use "persist"
// are supported because YAML, Annotation and Attribute use "persist"
// and we want to make sure that this driver doesn't need to know
// anything about the supported cascading actions
$cascades[] = str_replace('cascade-', '', $action->getName());
Expand Down
4 changes: 2 additions & 2 deletions lib/Doctrine/ORM/Mapping/EntityListeners.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;

/**
* The EntityListeners annotation specifies the callback listener classes to be used for an entity or mapped superclass.
* The EntityListeners annotation may be applied to an entity class or mapped superclass.
* The EntityListeners attribute specifies the callback listener classes to be used for an entity or mapped superclass.
* The EntityListeners attribute may be applied to an entity class or mapped superclass.
*
* @Annotation
* @NamedArgumentConstructor()
Expand Down
15 changes: 5 additions & 10 deletions lib/Doctrine/ORM/Mapping/MappingException.php
Original file line number Diff line number Diff line change
Expand Up @@ -813,20 +813,15 @@ public static function duplicateEntityListener($listenerName, $methodName, $clas
return new self(sprintf('Entity Listener "%s#%s()" in "%s" was already declared, but it must be declared only once.', $listenerName, $methodName, $className));
}

/**
* @param string $className
* @param string $annotation
*
* @return MappingException
*/
public static function invalidFetchMode($className, $annotation)
/** @param class-string $className */
public static function invalidFetchMode(string $className, string $fetchMode): self
{
return new self("Entity '" . $className . "' has a mapping with invalid fetch mode '" . $annotation . "'");
return new self("Entity '" . $className . "' has a mapping with invalid fetch mode '" . $fetchMode . "'");
}

public static function invalidGeneratedMode(string $annotation): MappingException
public static function invalidGeneratedMode(string $generatedMode): self
{
return new self("Invalid generated mode '" . $annotation . "'");
return new self("Invalid generated mode '" . $generatedMode . "'");
}

/**
Expand Down

0 comments on commit 2b7485a

Please sign in to comment.