Skip to content

Commit

Permalink
Merge pull request #10408 from greg0ire/field-mapping-improvements
Browse files Browse the repository at this point in the history
Field mapping improvements
  • Loading branch information
greg0ire authored Jan 17, 2023
2 parents 65a7c88 + c0a7317 commit a5bdc61
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
10 changes: 6 additions & 4 deletions lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@
* requireSQLConversion?: bool,
* declared?: class-string,
* declaredField?: string,
* options?: array<string, mixed>
* options?: array<string, mixed>,
* version?: string,
* default?: string|int,
* }
* @psalm-type JoinColumnData = array{
* name: string,
Expand Down Expand Up @@ -1631,9 +1633,9 @@ private function isTypedProperty(string $name): bool
/**
* Validates & completes the given field mapping based on typed property.
*
* @param array{fieldName: string, type?: mixed} $mapping The field mapping to validate & complete.
* @param array{fieldName: string, type?: string} $mapping The field mapping to validate & complete.
*
* @return array{fieldName: string, enumType?: string, type?: mixed} The updated mapping.
* @return array{fieldName: string, enumType?: class-string<BackedEnum>, type?: string} The updated mapping.
*/
private function validateAndCompleteTypedFieldMapping(array $mapping): array
{
Expand Down Expand Up @@ -1677,7 +1679,7 @@ private function validateAndCompleteTypedAssociationMapping(array $mapping): arr
* enumType?: class-string,
* } $mapping The field mapping to validate & complete.
*
* @return mixed[] The updated mapping.
* @return FieldMapping The updated mapping.
*
* @throws MappingException
*/
Expand Down
5 changes: 3 additions & 2 deletions lib/Doctrine/ORM/Mapping/TypedFieldMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@

namespace Doctrine\ORM\Mapping;

use BackedEnum;
use ReflectionProperty;

interface TypedFieldMapper
{
/**
* Validates & completes the given field mapping based on typed property.
*
* @param array{fieldName: string, enumType?: string, type?: mixed} $mapping The field mapping to validate & complete.
* @param array{fieldName: string, enumType?: class-string<BackedEnum>, type?: string} $mapping The field mapping to validate & complete.
*
* @return array{fieldName: string, enumType?: string, type?: mixed} The updated mapping.
* @return array{fieldName: string, enumType?: class-string<BackedEnum>, type?: string} The updated mapping.
*/
public function validateAndComplete(array $mapping, ReflectionProperty $field): array;
}
5 changes: 0 additions & 5 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -575,11 +575,6 @@ parameters:
count: 1
path: lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php

-
message: "#^Offset 'version' on array\\{type\\: string, fieldName\\: string, columnName\\: string, length\\?\\: int, id\\?\\: bool, nullable\\?\\: bool, notInsertable\\?\\: bool, notUpdatable\\?\\: bool, \\.\\.\\.\\} in isset\\(\\) does not exist\\.$#"
count: 1
path: lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php

-
message: "#^Parameter \\#1 \\$policy of method Doctrine\\\\ORM\\\\Tools\\\\Export\\\\Driver\\\\AbstractExporter\\:\\:_getChangeTrackingPolicyString\\(\\) expects 1\\|2\\|3, int given\\.$#"
count: 1
Expand Down
3 changes: 0 additions & 3 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2694,9 +2694,6 @@
<DeprecatedClass occurrences="1">
<code>AbstractExporter</code>
</DeprecatedClass>
<InvalidArrayOffset occurrences="1">
<code>$field['version']</code>
</InvalidArrayOffset>
<NonInvariantDocblockPropertyType occurrences="1">
<code>$_extension</code>
</NonInvariantDocblockPropertyType>
Expand Down

0 comments on commit a5bdc61

Please sign in to comment.