Skip to content

Commit 3dc5c9c

Browse files
committed
self-review improvements
1 parent b2b858c commit 3dc5c9c

File tree

8 files changed

+19
-15
lines changed

8 files changed

+19
-15
lines changed

src/Symfony/Bridge/Doctrine/Attribute/Transactional.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use Symfony\Component\Decorator\Attribute\Decorate;
1616

1717
/**
18-
* Indicates that an object method should be wrapped within a single Doctrine transaction.
18+
* Wraps persistence method operations within a single Doctrine transaction.
1919
*
2020
* @author Yonel Ceruto <open@yceruto.dev>
2121
*/

src/Symfony/Bridge/Doctrine/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ CHANGELOG
55
---
66

77
* Accept `ReadableCollection` in `CollectionToArrayTransformer`
8-
* Add `DoctrineTransactionDecorator` and `Transactional` attribute
8+
* Add `Transactional` attribute and `DoctrineTransactionDecorator`
99

1010
7.1
1111
---

src/Symfony/Bridge/Doctrine/Decorator/DoctrineTransactionDecorator.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,12 @@
1616
use Symfony\Component\Decorator\DecoratorInterface;
1717

1818
/**
19-
* Wraps a persistence functionality in a single Doctrine transaction.
20-
*
2119
* @author Yonel Ceruto <open@yceruto.dev>
2220
*/
23-
final readonly class DoctrineTransactionDecorator implements DecoratorInterface
21+
class DoctrineTransactionDecorator implements DecoratorInterface
2422
{
2523
public function __construct(
26-
private ManagerRegistry $managerRegistry,
24+
private readonly ManagerRegistry $managerRegistry,
2725
) {
2826
}
2927

@@ -35,7 +33,7 @@ public function decorate(\Closure $func, ?string $name = null): \Closure
3533
throw new \RuntimeException(\sprintf('The manager "%s" is not an entity manager.', $name));
3634
}
3735

38-
return function (mixed ...$args) use ($func, $entityManager) {
36+
return static function (mixed ...$args) use ($func, $entityManager) {
3937
$entityManager->getConnection()->beginTransaction();
4038

4139
try {

src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ CHANGELOG
1212
* Deprecate making `cache.app` adapter taggable, use the `cache.app.taggable` adapter instead
1313
* Enable `json_decode_detailed_errors` in the default serializer context in debug mode by default when `seld/jsonlint` is installed
1414
* Register `Symfony\Component\Serializer\NameConverter\SnakeCaseToCamelCaseNameConverter` as a service named `serializer.name_converter.snake_case_to_camel_case` if available
15-
* Add Decorator component integration and controller decoration support
15+
* Add Decorator component integration
16+
* Add controller decoration support
1617

1718
7.1
1819
---

src/Symfony/Bundle/FrameworkBundle/EventListener/DecorateControllerListener.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
/**
2020
* @author Yonel Ceruto <open@yceruto.dev>
2121
*/
22-
final readonly class DecorateControllerListener implements EventSubscriberInterface
22+
class DecorateControllerListener implements EventSubscriberInterface
2323
{
2424
public function __construct(
25-
private DecoratorInterface $decorator,
25+
private readonly DecoratorInterface $decorator,
2626
) {
2727
}
2828

src/Symfony/Component/Decorator/Attribute/Decorate.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
namespace Symfony\Component\Decorator\Attribute;
1313

1414
/**
15-
* An attribute that specifies under which decorator a function or method should be wrapped.
15+
* Specifies the decorator to wrap a function or method.
1616
*
1717
* @author Yonel Ceruto <open@yceruto.dev>
1818
*
@@ -21,6 +21,10 @@
2121
#[\Attribute(\Attribute::TARGET_FUNCTION | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
2222
class Decorate
2323
{
24+
/**
25+
* @param string $id The decorator service id
26+
* @param array<string, mixed> $options The decorator options to pass through
27+
*/
2428
public function __construct(
2529
public string $id,
2630
public array $options = [],

src/Symfony/Component/Decorator/DecoratorChain.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020
*
2121
* @experimental
2222
*/
23-
readonly class DecoratorChain implements DecoratorInterface
23+
class DecoratorChain implements DecoratorInterface
2424
{
2525
/**
2626
* @param ContainerInterface $decorators Locator of decorators, keyed by service id
2727
*/
2828
public function __construct(
29-
private ContainerInterface $decorators,
29+
private readonly ContainerInterface $decorators,
3030
) {
3131
}
3232

src/Symfony/Component/Decorator/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
Decorator Component
22
===================
33

4-
Symfony Decorator modify the functionality of other functions or methods.
4+
The Symfony Decorator modifies a function's behavior by adding actions before
5+
and after its execution.
56

67
**This Component is experimental**.
78
[Experimental features](https://symfony.com/doc/current/contributing/code/experimental.html)
@@ -40,7 +41,7 @@ $decorator = DecoratorChain::from([
4041
DebugDecorator::class => fn () => new DebugDecorator(),
4142
]);
4243

43-
#[\Attribute(\Attribute::TARGET_FUNCTION | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
44+
#[\Attribute(\Attribute::TARGET_METHOD)]
4445
class Debug extends Decorate
4546
{
4647
public function __construct()

0 commit comments

Comments
 (0)