Skip to content

Commit 4206f01

Browse files
authored
Use FieldMapping array shape even more (#10430)
I experimented on converting FieldMapping to a DTO, and it allowed me to find more places where it should be used.
1 parent 7d4052c commit 4206f01

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -2868,7 +2868,7 @@ public function addInheritedAssociationMapping(array $mapping/*, $owningClassNam
28682868
* Adds a field mapping without completing/validating it.
28692869
* This is mainly used to add inherited field mappings to derived classes.
28702870
*
2871-
* @psalm-param array<string, mixed> $fieldMapping
2871+
* @psalm-param FieldMapping $fieldMapping
28722872
*
28732873
* @return void
28742874
*/

lib/Doctrine/ORM/Tools/SchemaTool.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Doctrine\Deprecations\Deprecation;
1818
use Doctrine\ORM\EntityManagerInterface;
1919
use Doctrine\ORM\Mapping\ClassMetadata;
20+
use Doctrine\ORM\Mapping\ClassMetadataInfo;
2021
use Doctrine\ORM\Mapping\MappingException;
2122
use Doctrine\ORM\Mapping\QuoteStrategy;
2223
use Doctrine\ORM\Tools\Event\GenerateSchemaEventArgs;
@@ -46,6 +47,8 @@
4647
* <tt>ClassMetadata</tt> class descriptors.
4748
*
4849
* @link www.doctrine-project.org
50+
*
51+
* @psalm-import-type FieldMapping from ClassMetadataInfo
4952
*/
5053
class SchemaTool
5154
{
@@ -468,7 +471,7 @@ private function gatherColumns(ClassMetadata $class, Table $table): void
468471
* Creates a column definition as required by the DBAL from an ORM field mapping definition.
469472
*
470473
* @param ClassMetadata $class The class that owns the field mapping.
471-
* @psalm-param array<string, mixed> $mapping The field mapping.
474+
* @psalm-param FieldMapping $mapping The field mapping.
472475
*/
473476
private function gatherColumn(
474477
ClassMetadata $class,

psalm-baseline.xml

+1-2
Original file line numberDiff line numberDiff line change
@@ -696,12 +696,11 @@
696696
<code>$table</code>
697697
<code>$tableGeneratorDefinition</code>
698698
</PropertyNotSetInConstructor>
699-
<PropertyTypeCoercion occurrences="12">
699+
<PropertyTypeCoercion occurrences="11">
700700
<code>$identifier</code>
701701
<code>$this-&gt;associationMappings</code>
702702
<code>$this-&gt;associationMappings</code>
703703
<code>$this-&gt;entityListeners</code>
704-
<code>$this-&gt;fieldMappings</code>
705704
<code>$this-&gt;fullyQualifiedClassName($repositoryClassName)</code>
706705
<code>$this-&gt;table</code>
707706
<code>$this-&gt;table</code>

0 commit comments

Comments
 (0)