Skip to content

Commit 4349780

Browse files
committed
chore: Add final, readonly, and internal if applicable to all classes.
1 parent 90ebc7a commit 4349780

File tree

98 files changed

+269
-67
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+269
-67
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* perf(`TypeResolver`): Optimize `getSimpleTypes`.
66
* fix(`MainTransformer`): Reduce GC interval to 500.
77
* build: Require PHP 8.2.
8+
* chore: Add `final`, `readonly`, and `internal` if applicable to all classes.
89

910
## 0.9.0
1011

src/Command/MappingCommand.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@
2222
use Symfony\Component\Console\Output\OutputInterface;
2323
use Symfony\Component\Console\Style\SymfonyStyle;
2424

25+
/**
26+
* @internal
27+
*/
2528
#[AsCommand(name: 'rekalogika:mapper:mapping', description: 'Dump mapping table')]
26-
class MappingCommand extends Command
29+
final class MappingCommand extends Command
2730
{
2831
public function __construct(
2932
private MappingFactoryInterface $mappingFactory

src/Command/MarkdownLikeTableStyle.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
/**
1919
* Markdown-like table style, for the ease of copy-paste to documentation.
2020
*/
21-
class MarkdownLikeTableStyle extends TableStyle
21+
final class MarkdownLikeTableStyle extends TableStyle
2222
{
2323
public function __construct()
2424
{

src/Command/TryCommand.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@
2525
use Symfony\Component\Console\Output\OutputInterface;
2626
use Symfony\Component\Console\Style\SymfonyStyle;
2727

28+
/**
29+
* @internal
30+
*/
2831
#[AsCommand(name: 'rekalogika:mapper:try', description: 'Gets the mapping result from a source and target type pair.')]
29-
class TryCommand extends Command
32+
final class TryCommand extends Command
3033
{
3134
public function __construct(
3235
private TransformerRegistryInterface $transformerRegistry,

src/Command/TryPropertyCommand.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@
2525
use Symfony\Component\Console\Style\SymfonyStyle;
2626
use Symfony\Component\PropertyInfo\PropertyInfoExtractorInterface;
2727

28+
/**
29+
* @internal
30+
*/
2831
#[AsCommand(name: 'rekalogika:mapper:tryproperty', description: 'Gets the mapping result by providing the class and property name of the source and target.')]
29-
class TryPropertyCommand extends Command
32+
final class TryPropertyCommand extends Command
3033
{
3134
public function __construct(
3235
private TransformerRegistryInterface $transformerRegistry,

src/CustomMapper/Exception/ObjectMapperNotFoundException.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515

1616
use Rekalogika\Mapper\Exception\UnexpectedValueException;
1717

18-
class ObjectMapperNotFoundException extends UnexpectedValueException
18+
/**
19+
* @internal
20+
*/
21+
final class ObjectMapperNotFoundException extends UnexpectedValueException
1922
{
2023
public function __construct(
2124
string $sourceClass,

src/CustomMapper/Implementation/CachingObjectMapperResolver.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@
1717
use Rekalogika\Mapper\CustomMapper\ObjectMapperResolverInterface;
1818
use Rekalogika\Mapper\ServiceMethod\ServiceMethodSpecification;
1919

20-
class CachingObjectMapperResolver implements ObjectMapperResolverInterface
20+
/**
21+
* @internal
22+
*/
23+
final class CachingObjectMapperResolver implements ObjectMapperResolverInterface
2124
{
2225
/**
2326
* @var array<class-string,array<class-string,ServiceMethodSpecification>>

src/CustomMapper/Implementation/ObjectMapperResolver.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@
1919
use Rekalogika\Mapper\CustomMapper\ObjectMapperTableFactoryInterface;
2020
use Rekalogika\Mapper\ServiceMethod\ServiceMethodSpecification;
2121

22-
class ObjectMapperResolver implements ObjectMapperResolverInterface
22+
/**
23+
* @internal
24+
*/
25+
final class ObjectMapperResolver implements ObjectMapperResolverInterface
2326
{
2427
private ?ObjectMapperTable $objectMapperTable = null;
2528

src/CustomMapper/Implementation/ObjectMapperTableFactory.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@
1717
use Rekalogika\Mapper\CustomMapper\ObjectMapperTableFactoryInterface;
1818
use Rekalogika\Mapper\ServiceMethod\ServiceMethodSpecification;
1919

20-
class ObjectMapperTableFactory implements ObjectMapperTableFactoryInterface
20+
/**
21+
* @internal
22+
*/
23+
final class ObjectMapperTableFactory implements ObjectMapperTableFactoryInterface
2124
{
2225
private ObjectMapperTable $objectMapperTable;
2326

src/CustomMapper/Implementation/ObjectMapperTableWarmer.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
use Symfony\Component\HttpKernel\KernelInterface;
1919
use Symfony\Component\VarExporter\VarExporter;
2020

21-
class ObjectMapperTableWarmer implements CacheWarmerInterface
21+
/**
22+
* @internal
23+
*/
24+
final readonly class ObjectMapperTableWarmer implements CacheWarmerInterface
2225
{
2326
public function __construct(
2427
private ObjectMapperTableFactoryInterface $objectMapperTableFactory,

src/CustomMapper/Implementation/PropertyMapperResolver.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
use Rekalogika\Mapper\CustomMapper\PropertyMapperResolverInterface;
1717
use Rekalogika\Mapper\ServiceMethod\ServiceMethodSpecification;
1818

19-
class PropertyMapperResolver implements PropertyMapperResolverInterface
19+
/**
20+
* @internal
21+
*/
22+
final class PropertyMapperResolver implements PropertyMapperResolverInterface
2023
{
2124
/**
2225
* @var array<class-string,array<string,array<class-string,ServiceMethodSpecification>>>

src/CustomMapper/Implementation/WarmableObjectMapperTableFactory.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@
2020
use Symfony\Component\HttpKernel\KernelInterface;
2121
use Symfony\Component\VarExporter\VarExporter;
2222

23-
class WarmableObjectMapperTableFactory implements
23+
/**
24+
* @internal
25+
*/
26+
final class WarmableObjectMapperTableFactory implements
2427
ObjectMapperTableFactoryInterface,
2528
CacheWarmerInterface
2629
{

src/CustomMapper/ObjectMapperResolverInterface.php

+3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
use Rekalogika\Mapper\CustomMapper\Exception\ObjectMapperNotFoundException;
1717
use Rekalogika\Mapper\ServiceMethod\ServiceMethodSpecification;
1818

19+
/**
20+
* @internal
21+
*/
1922
interface ObjectMapperResolverInterface
2023
{
2124
/**

src/CustomMapper/ObjectMapperTable.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717

1818
/**
1919
* @implements \IteratorAggregate<int,ObjectMapperTableEntry>
20+
* @internal
2021
*/
21-
class ObjectMapperTable implements \IteratorAggregate
22+
final class ObjectMapperTable implements \IteratorAggregate
2223
{
2324
/**
2425
* @var array<class-string,array<class-string,ServiceMethodSpecification>>

src/CustomMapper/ObjectMapperTableEntry.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515

1616
use Rekalogika\Mapper\ServiceMethod\ServiceMethodSpecification;
1717

18-
class ObjectMapperTableEntry
18+
/**
19+
* @internal
20+
*/
21+
final readonly class ObjectMapperTableEntry
1922
{
2023
/**
2124
* @param class-string $sourceClass

src/CustomMapper/ObjectMapperTableFactoryInterface.php

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313

1414
namespace Rekalogika\Mapper\CustomMapper;
1515

16+
/**
17+
* @internal
18+
*/
1619
interface ObjectMapperTableFactoryInterface
1720
{
1821
public function createObjectMapperTable(): ObjectMapperTable;

src/CustomMapper/PropertyMapperResolverInterface.php

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515

1616
use Rekalogika\Mapper\ServiceMethod\ServiceMethodSpecification;
1717

18+
/**
19+
* @internal
20+
*/
1821
interface PropertyMapperResolverInterface
1922
{
2023
/**

src/Debug/Helper.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
use Rekalogika\Mapper\Util\TypeUtil;
1818
use Symfony\Component\PropertyInfo\Type;
1919

20-
final class Helper
20+
final readonly class Helper
2121
{
2222
/**
2323
* @param Type|array<int,Type|MixedType> $type

src/Debug/MapperDataCollector.php

+3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
use Symfony\Component\HttpFoundation\Request;
2020
use Symfony\Component\HttpFoundation\Response;
2121

22+
/**
23+
* @internal
24+
*/
2225
final class MapperDataCollector extends AbstractDataCollector
2326
{
2427
public function getName(): string

src/Debug/TraceData.php

+3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
use Symfony\Component\PropertyInfo\Type;
2020
use Symfony\Component\VarExporter\LazyObjectInterface;
2121

22+
/**
23+
* @internal
24+
*/
2225
final class TraceData
2326
{
2427
private string $sourceType;

src/Debug/TraceableMappingFactory.php

+3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
use Rekalogika\Mapper\Mapping\Mapping;
1717
use Rekalogika\Mapper\Mapping\MappingFactoryInterface;
1818

19+
/**
20+
* @internal
21+
*/
1922
final class TraceableMappingFactory implements MappingFactoryInterface
2023
{
2124
private bool $mappingCollected = false;

src/Debug/TraceableObjectToObjectMetadataFactory.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
use Rekalogika\Mapper\Transformer\ObjectToObjectMetadata\ObjectToObjectMetadata;
1717
use Rekalogika\Mapper\Transformer\ObjectToObjectMetadata\ObjectToObjectMetadataFactoryInterface;
1818

19-
final class TraceableObjectToObjectMetadataFactory implements ObjectToObjectMetadataFactoryInterface
19+
/**
20+
* @internal
21+
*/
22+
final readonly class TraceableObjectToObjectMetadataFactory implements ObjectToObjectMetadataFactoryInterface
2023
{
2124
public function __construct(
2225
private ObjectToObjectMetadataFactoryInterface $decorated,

src/Debug/TraceableTransformer.php

+3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
use Rekalogika\Mapper\Transformer\Contracts\TransformerInterface;
2424
use Symfony\Component\PropertyInfo\Type;
2525

26+
/**
27+
* @internal
28+
*/
2629
final class TraceableTransformer extends AbstractTransformerDecorator implements
2730
TransformerInterface,
2831
MainTransformerAwareInterface

src/DependencyInjection/CompilerPass/DebugPass.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@
2020
use Symfony\Component\DependencyInjection\ContainerBuilder;
2121
use Symfony\Component\DependencyInjection\Reference;
2222

23-
final class DebugPass implements CompilerPassInterface
23+
/**
24+
* @internal
25+
*/
26+
final readonly class DebugPass implements CompilerPassInterface
2427
{
2528
public function process(ContainerBuilder $container): void
2629
{

src/DependencyInjection/CompilerPass/ObjectMapperPass.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
1919
use Symfony\Component\DependencyInjection\ContainerBuilder;
2020

21-
final class ObjectMapperPass implements CompilerPassInterface
21+
/**
22+
* @internal
23+
*/
24+
final readonly class ObjectMapperPass implements CompilerPassInterface
2225
{
2326
public function process(ContainerBuilder $container): void
2427
{

src/DependencyInjection/CompilerPass/PropertyMapperPass.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
1919
use Symfony\Component\DependencyInjection\ContainerBuilder;
2020

21-
final class PropertyMapperPass implements CompilerPassInterface
21+
/**
22+
* @internal
23+
*/
24+
final readonly class PropertyMapperPass implements CompilerPassInterface
2225
{
2326
public function process(ContainerBuilder $container): void
2427
{

src/DependencyInjection/CompilerPass/RemoveOptionalDefinitionPass.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
use Symfony\Component\DependencyInjection\ContainerBuilder;
1919
use Symfony\Component\Uid\Factory\UuidFactory;
2020

21-
final class RemoveOptionalDefinitionPass implements CompilerPassInterface
21+
/**
22+
* @internal
23+
*/
24+
final readonly class RemoveOptionalDefinitionPass implements CompilerPassInterface
2225
{
2326
public function process(ContainerBuilder $container): void
2427
{

src/DependencyInjection/RekalogikaMapperExtension.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@
2525
use Symfony\Component\DependencyInjection\Extension\Extension;
2626
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
2727

28-
class RekalogikaMapperExtension extends Extension
28+
/**
29+
* @internal
30+
*/
31+
final class RekalogikaMapperExtension extends Extension
2932
{
3033
public function load(array $configs, ContainerBuilder $container): void
3134
{

src/MainTransformer/MainTransformer.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@
3434
use Rekalogika\Mapper\Util\TypeGuesser;
3535
use Symfony\Component\PropertyInfo\Type;
3636

37-
class MainTransformer implements MainTransformerInterface
37+
/**
38+
* @internal
39+
*/
40+
final class MainTransformer implements MainTransformerInterface
3841
{
3942
public static int $manualGcInterval = 500;
4043
private static int $runCounter = 1;

src/MainTransformer/Model/DebugContext.php

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
/**
2020
* Debug context for main transformer. Used for tracing.
2121
*
22+
* @internal
2223
* @immutable
2324
*/
2425
final readonly class DebugContext

src/MainTransformer/Model/Path.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*
1919
* @immutable
2020
*/
21-
readonly class Path implements \Stringable
21+
final readonly class Path implements \Stringable
2222
{
2323
/**
2424
* @param list<string> $path

src/Mapper.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
use Rekalogika\Mapper\MainTransformer\MainTransformerInterface;
1919
use Rekalogika\Mapper\Util\TypeFactory;
2020

21-
final class Mapper implements MapperInterface
21+
/**
22+
* @internal
23+
*/
24+
final readonly class Mapper implements MapperInterface
2225
{
2326
public function __construct(
2427
private MainTransformerInterface $transformer,

src/MapperFactory/ServiceLocator.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
/**
2020
* Simple container for non-framework use
2121
*/
22-
final class ServiceLocator implements ContainerInterface
22+
final readonly class ServiceLocator implements ContainerInterface
2323
{
2424
/**
2525
* @param array<array-key,mixed> $services

src/Mapping/Implementation/MappingCacheWarmer.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515

1616
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface;
1717

18-
final class MappingCacheWarmer implements CacheWarmerInterface
18+
/**
19+
* @internal
20+
*/
21+
final readonly class MappingCacheWarmer implements CacheWarmerInterface
1922
{
2023
public function __construct(
2124
private WarmableMappingFactory $warmableMappingFactory,

src/Mapping/Implementation/MappingFactory.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
use Symfony\Component\PropertyInfo\Type;
2323

2424
/**
25-
* Initialize transformer mappings
25+
* @internal
2626
*/
2727
final class MappingFactory implements MappingFactoryInterface
2828
{

src/Mapping/Implementation/WarmableMappingFactory.php

+3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
use Symfony\Component\HttpKernel\KernelInterface;
2020
use Symfony\Component\VarExporter\VarExporter;
2121

22+
/**
23+
* @internal
24+
*/
2225
final class WarmableMappingFactory implements MappingFactoryInterface
2326
{
2427
public const CACHE_FILE = 'rekalogika_mapper_mapping.php';

0 commit comments

Comments
 (0)