Skip to content
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
2 changes: 1 addition & 1 deletion src/Mapping/Driver/ClassNames.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ final class ClassNames implements ClassLocator
{
/** @param list<class-string> $classNames */
public function __construct(
private array $classNames,
private readonly array $classNames,
) {
}

Expand Down
6 changes: 1 addition & 5 deletions src/Mapping/Driver/DefaultFileLocator.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ class DefaultFileLocator implements FileLocator
*/
protected array $paths = [];

/** The file extension of mapping documents. */
protected string|null $fileExtension;

/**
* Initializes a new FileDriver that looks in the given path(s) for mapping
* documents and operates in the specified operating mode.
Expand All @@ -44,10 +41,9 @@ class DefaultFileLocator implements FileLocator
* @param string|null $fileExtension The file extension of mapping documents,
* usually prefixed with a dot.
*/
public function __construct(string|array $paths, string|null $fileExtension = null)
public function __construct(string|array $paths, protected string|null $fileExtension = null)
{
$this->addPaths((array) $paths);
$this->fileExtension = $fileExtension;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Mapping/Driver/FileClassLocator.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ final class FileClassLocator implements ClassLocator
{
/** @param iterable<SplFileInfo> $files An iterable of files to include. */
public function __construct(
private iterable $files,
private readonly iterable $files,
) {
}

Expand Down
8 changes: 4 additions & 4 deletions src/Mapping/Driver/MappingDriverChain.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

use function array_keys;
use function spl_object_id;
use function strpos;
use function str_starts_with;

/**
* The DriverChain allows you to add multiple other mapping drivers for
Expand Down Expand Up @@ -56,7 +56,7 @@ public function getDrivers(): array
public function loadMetadataForClass(string $className, ClassMetadata $metadata): void
{
foreach ($this->drivers as $namespace => $driver) {
if (strpos($className, $namespace) === 0) {
if (str_starts_with($className, $namespace)) {
$driver->loadMetadataForClass($className, $metadata);

return;
Expand Down Expand Up @@ -88,7 +88,7 @@ public function getAllClassNames(): array
}

foreach ($driverClasses[$oid] as $className) {
if (strpos($className, $namespace) !== 0) {
if (! str_starts_with($className, $namespace)) {
continue;
}

Expand All @@ -108,7 +108,7 @@ public function getAllClassNames(): array
public function isTransient(string $className): bool
{
foreach ($this->drivers as $namespace => $driver) {
if (strpos($className, $namespace) === 0) {
if (str_starts_with($className, $namespace)) {
return $driver->isTransient($className);
}
}
Expand Down
7 changes: 2 additions & 5 deletions src/Mapping/Driver/SymfonyFileLocator.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ class SymfonyFileLocator implements FileLocator
*/
protected array $prefixes = [];

/** File extension that is searched for. */
protected string|null $fileExtension;

/**
* Represents PHP namespace delimiters when looking for files
*/
Expand All @@ -62,11 +59,11 @@ class SymfonyFileLocator implements FileLocator
*/
public function __construct(
array $prefixes,
string $fileExtension = '',
/** File extension that is searched for. */
protected string|null $fileExtension = '',
string $nsSeparator = '.',
) {
$this->addNamespacePrefixes($prefixes);
$this->fileExtension = $fileExtension;

if ($nsSeparator === '') {
throw new InvalidArgumentException('Namespace separator should not be empty');
Expand Down