Skip to content

Commit 5b1cda8

Browse files
authored
Merge pull request #2 from cspray/adr/deprecate-configuration
Deprecate Configuration and ConfigurationAttribute
2 parents 6cfa0e1 + fe615c1 commit 5b1cda8

4 files changed

Lines changed: 47 additions & 33 deletions

File tree

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"license": ["MIT"],
55
"require": {
66
"php": "^8.1",
7-
"cspray/annotated-container-adr": "^1.0"
7+
"cspray/annotated-container-adr": "^2"
88
},
99
"autoload": {
1010
"psr-4": {

composer.lock

Lines changed: 31 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Configuration.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,21 @@
44

55
use Attribute;
66
use Cspray\AnnotatedContainer\ArchitecturalDecisionRecords\ConfigurationCannotBeAssignedProfiles;
7+
use Cspray\AnnotatedContainer\ArchitecturalDecisionRecords\DeprecateConfigurationInFavorOfCustomServiceAttribute;
8+
use JetBrains\PhpStorm\Deprecated;
79

810
/**
911
* An Attribute that defines a class as being a Configuration object.
1012
*
1113
* A Configuration object is expected to consist primarily of public readonly properties that have been annotated with
1214
* the Inject Attribute.
1315
*/
14-
#[ConfigurationCannotBeAssignedProfiles]
15-
#[Attribute(Attribute::TARGET_CLASS)]
16+
#[
17+
ConfigurationCannotBeAssignedProfiles,
18+
DeprecateConfigurationInFavorOfCustomServiceAttribute,
19+
Deprecated('Please see DeprecateConfigurationInFavorOfCustomServiceAttribute ADR'),
20+
Attribute(Attribute::TARGET_CLASS)
21+
]
1622
final class Configuration implements ConfigurationAttribute {
1723

1824
/**

src/ConfigurationAttribute.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,19 @@
22

33
namespace Cspray\AnnotatedContainer\Attribute;
44

5+
use Cspray\AnnotatedContainer\ArchitecturalDecisionRecords\DeprecateConfigurationInFavorOfCustomServiceAttribute;
6+
use JetBrains\PhpStorm\Deprecated;
7+
58
/**
69
* Can be implemented by your own classes to act as an Attribute for defining a Configuration.
710
*
811
* The class that implements this interface should also be marked as an Attribute; it should be non-repeatable and only
912
* able to target the class construct.
1013
*/
14+
#[
15+
DeprecateConfigurationInFavorOfCustomServiceAttribute,
16+
Deprecated('Please see DeprecateConfigurationInFavorOfCustomServiceAttribute ADR')
17+
]
1118
interface ConfigurationAttribute {
1219

1320
/**

0 commit comments

Comments
 (0)