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 files with the least changes to PHP 8 #10367

Merged
merged 1 commit into from
Jan 3, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Cache/DefaultCacheFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function setFileLockRegionDirectory(string $fileLockRegionDirectory): voi
$this->fileLockRegionDirectory = $fileLockRegionDirectory;
}

public function getFileLockRegionDirectory(): string
public function getFileLockRegionDirectory(): string|null
{
return $this->fileLockRegionDirectory;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/EntityRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ protected function getClassMetadata(): ClassMetadata
*
* @psalm-return AbstractLazyCollection<int, T>&Selectable<int, T>
*/
public function matching(Criteria $criteria): AbstractLazyCollection
public function matching(Criteria $criteria): AbstractLazyCollection&Selectable
{
$persister = $this->em->getUnitOfWork()->getEntityPersister($this->entityName);

Expand Down
4 changes: 1 addition & 3 deletions lib/Doctrine/ORM/Id/AssignedGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Exception\EntityMissingAssignedId;

use function get_class;

/**
* Special generator for application-assigned identifiers (doesn't really generate anything).
*/
Expand All @@ -23,7 +21,7 @@ class AssignedGenerator extends AbstractIdGenerator
*/
public function generateId(EntityManagerInterface $em, object|null $entity): array
{
$class = $em->getClassMetadata(get_class($entity));
$class = $em->getClassMetadata($entity::class);
$idFields = $class->getIdentifierFieldNames();
$identifier = [];

Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class ObjectHydrator extends AbstractHydrator
private array $initializedCollections = [];

/** @var array<string, PersistentCollection> */
private $uninitializedCollections = [];
private array $uninitializedCollections = [];

/** @var mixed[] */
private array $existingCollections = [];
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/ChainTypedFieldMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ final class ChainTypedFieldMapper implements TypedFieldMapper
* @readonly
* @var TypedFieldMapper[] $typedFieldMappers
*/
private array $typedFieldMappers;
private readonly array $typedFieldMappers;

public function __construct(TypedFieldMapper ...$typedFieldMappers)
{
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,8 @@ protected function initializeReflection(ClassMetadataInterface $class, Reflectio

protected function getDriver(): MappingDriver
{
assert($this->driver !== null);

return $this->driver;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/Driver/AttributeReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function getPropertyAttributes(ReflectionProperty $property): array
*
* @template T of MappingAttribute
*/
public function getPropertyAttribute(ReflectionProperty $property, $attributeName)
public function getPropertyAttribute(ReflectionProperty $property, string $attributeName)
{
if ($this->isRepeatable($attributeName)) {
throw new LogicException(sprintf(
Expand Down
3 changes: 2 additions & 1 deletion lib/Doctrine/ORM/Query/Filter/SQLFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Query\ParameterTypeInferer;
use InvalidArgumentException;
use Stringable;

use function array_map;
use function implode;
Expand All @@ -23,7 +24,7 @@
*
* @abstract
*/
abstract class SQLFilter
abstract class SQLFilter implements Stringable
{
/**
* Parameters for the filter.
Expand Down