Skip to content

Commit bbdd530

Browse files
authored
Merge pull request #6 from cspray/task/readd-inject-property
Allow properties on Inject for constructor promotion
2 parents 5f78394 + 37d68c6 commit bbdd530

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Diff for: src/Inject.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Cspray\AnnotatedContainer\Attribute;
44

55
use Attribute;
6-
use UnitEnum;
76

87
/**
98
* Represents a value that should be injected into a method parameter.
@@ -12,8 +11,11 @@
1211
* which Inject attribute would be used if you do not specify unique profiles is intentionally undefined. It is possible
1312
* that any one of the attributes could be used, so it is highly recommended if you repeat an Inject Attribute you also
1413
* give it a profile!
14+
*
15+
* This Attribute can target properties to allow for constructor property promotion. It is not supported to annotate a
16+
* non-promoted property.
1517
*/
16-
#[Attribute(Attribute::TARGET_PARAMETER | Attribute::IS_REPEATABLE)]
18+
#[Attribute(Attribute::TARGET_PARAMETER | Attribute::TARGET_PROPERTY | Attribute::IS_REPEATABLE)]
1719
final class Inject implements InjectAttribute {
1820

1921
/**

0 commit comments

Comments
 (0)