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

Migrate ClassMetadata to PHP 8 syntax #10503

Merged
merged 1 commit into from
Feb 7, 2023
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
14 changes: 7 additions & 7 deletions lib/Doctrine/ORM/Mapping/ClassMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ class ClassMetadata implements PersistenceClassMetadata, Stringable

private InstantiatorInterface|null $instantiator = null;

private TypedFieldMapper $typedFieldMapper;
private readonly TypedFieldMapper $typedFieldMapper;

/**
* Initializes a new ClassMetadata instance that will hold the object-relational mapping
Expand Down Expand Up @@ -1162,7 +1162,7 @@ public function validateLifecycleCallbacks(ReflectionService $reflService): void
*
* Can return null when using static reflection, in violation of the LSP
*/
public function getReflectionClass()
public function getReflectionClass(): ReflectionClass|null
{
return $this->reflClass;
}
Expand Down Expand Up @@ -1486,7 +1486,7 @@ protected function validateAndCompleteFieldMapping(array $mapping): array
*
* @throws MappingException If something is wrong with the mapping.
*/
protected function _validateAndCompleteAssociationMapping(array $mapping)
protected function _validateAndCompleteAssociationMapping(array $mapping): array
{
if (! isset($mapping['mappedBy'])) {
$mapping['mappedBy'] = null;
Expand Down Expand Up @@ -1640,7 +1640,7 @@ protected function _validateAndCompleteAssociationMapping(array $mapping)
* @throws RuntimeException
* @throws MappingException
*/
protected function _validateAndCompleteOneToOneMapping(array $mapping)
protected function _validateAndCompleteOneToOneMapping(array $mapping): array
{
$mapping = $this->_validateAndCompleteAssociationMapping($mapping);

Expand Down Expand Up @@ -1745,7 +1745,7 @@ protected function _validateAndCompleteOneToOneMapping(array $mapping)
* @throws MappingException
* @throws InvalidArgumentException
*/
protected function _validateAndCompleteOneToManyMapping(array $mapping)
protected function _validateAndCompleteOneToManyMapping(array $mapping): array
{
$mapping = $this->_validateAndCompleteAssociationMapping($mapping);

Expand Down Expand Up @@ -1795,7 +1795,7 @@ protected function _validateAndCompleteOneToManyMapping(array $mapping)
*
* @throws InvalidArgumentException
*/
protected function _validateAndCompleteManyToManyMapping(array $mapping)
protected function _validateAndCompleteManyToManyMapping(array $mapping): array
{
$mapping = $this->_validateAndCompleteAssociationMapping($mapping);

Expand Down Expand Up @@ -1970,7 +1970,7 @@ public function getColumnNames(array|null $fieldNames = null): array
return array_keys($this->fieldNames);
}

return array_values(array_map([$this, 'getColumnName'], $fieldNames));
return array_values(array_map($this->getColumnName(...), $fieldNames));
}

/**
Expand Down
5 changes: 0 additions & 5 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,6 @@ parameters:
count: 2
path: lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php

-
message: "#^Expression on left side of \\?\\? is not nullable\\.$#"
count: 1
path: lib/Doctrine/ORM/Mapping/Driver/AttributeDriver.php

-
message: "#^Empty array passed to foreach\\.$#"
count: 1
Expand Down
2 changes: 1 addition & 1 deletion psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@
<code>$overrideMapping</code>
</InvalidArgument>
<InvalidNullableReturnType>
<code>getReflectionClass</code>
<code>ReflectionClass|null</code>
<code>string</code>
</InvalidNullableReturnType>
<InvalidPropertyAssignmentValue>
Expand Down