Skip to content

Commit 46bd34c

Browse files
committed
minor #60148 Remove non-final readonly classes (nicolas-grekas)
This PR was merged into the 7.3 branch. Discussion ---------- Remove non-final readonly classes | Q | A | ------------- | --- | Branch? | 7.3 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | - | License | MIT Those are just annoying from a maintainer PoV, without providing us any extra maintenance flexibility (quite the contrary). Commits ------- bbba700 Remove non-final readonly classes
2 parents 1d2d181 + bbba700 commit 46bd34c

File tree

4 files changed

+13
-24
lines changed

4 files changed

+13
-24
lines changed

src/Symfony/Component/ObjectMapper/Attribute/Map.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* @author Antoine Bluchet <soyuka@gmail.com>
2020
*/
2121
#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_PROPERTY | \Attribute::IS_REPEATABLE)]
22-
readonly class Map
22+
class Map
2323
{
2424
/**
2525
* @param string|class-string|null $source The property or the class to map from
@@ -28,10 +28,10 @@
2828
* @param (string|callable(mixed, object): mixed)|(string|callable(mixed, object): mixed)[]|null $transform A service id or a callable that transforms the value during mapping
2929
*/
3030
public function __construct(
31-
public ?string $target = null,
32-
public ?string $source = null,
33-
public mixed $if = null,
34-
public mixed $transform = null,
31+
public readonly ?string $target = null,
32+
public readonly ?string $source = null,
33+
public readonly mixed $if = null,
34+
public readonly mixed $transform = null,
3535
) {
3636
}
3737
}

src/Symfony/Component/ObjectMapper/Metadata/Mapping.php

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,15 @@
1111

1212
namespace Symfony\Component\ObjectMapper\Metadata;
1313

14+
use Symfony\Component\ObjectMapper\Attribute\Map;
15+
1416
/**
1517
* Configures a class or a property to map to.
1618
*
1719
* @internal
1820
*
1921
* @author Antoine Bluchet <soyuka@gmail.com>
2022
*/
21-
readonly class Mapping
23+
final class Mapping extends Map
2224
{
23-
/**
24-
* @param string|class-string|null $source The property or the class to map from
25-
* @param string|class-string|null $target The property or the class to map to
26-
* @param string|bool|callable(mixed, object): bool|null $if A boolean, Symfony service name or a callable that instructs whether to map
27-
* @param (string|callable(mixed, object): mixed)|(string|callable(mixed, object): mixed)[]|null $transform A service id or a callable that transform the value during mapping
28-
*/
29-
public function __construct(
30-
public ?string $target = null,
31-
public ?string $source = null,
32-
public mixed $if = null,
33-
public mixed $transform = null,
34-
) {
35-
}
3625
}

src/Symfony/Component/ObjectMapper/Tests/Fixtures/MapStruct/Map.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414
use Symfony\Component\ObjectMapper\Attribute\Map as AttributeMap;
1515

1616
#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
17-
readonly class Map extends AttributeMap
17+
class Map extends AttributeMap
1818
{
1919
}

src/Symfony/Component/Security/Http/Attribute/IsGrantedContext.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
use Symfony\Component\Security\Core\Authorization\Voter\AuthenticatedVoter;
1818
use Symfony\Component\Security\Core\User\UserInterface;
1919

20-
readonly class IsGrantedContext implements AuthorizationCheckerInterface
20+
class IsGrantedContext implements AuthorizationCheckerInterface
2121
{
2222
public function __construct(
23-
public TokenInterface $token,
24-
public ?UserInterface $user,
25-
private AuthorizationCheckerInterface $authorizationChecker,
23+
public readonly TokenInterface $token,
24+
public readonly ?UserInterface $user,
25+
private readonly AuthorizationCheckerInterface $authorizationChecker,
2626
) {
2727
}
2828

0 commit comments

Comments
 (0)