Shared
Registry-managed shared class instances.
Purpose & processing
Marks a class as shared in the APPNETOS Registry. The same instance is returned by Registry::get() and Registry::getNew() during the runtime lifecycle.
Parameters
This attribute has no constructor parameters.
Example
#[Shared]
class ApplicationService extends \Core\Base {}
Behavior and considerations
- The concrete class and its parent hierarchy are considered when resolving shared metadata.
- This is a Registry-managed singleton, not a private-constructor PHP singleton.
- Direct construction with new is not equivalent to Registry-managed resolution.
Source
shared/src/Core/Annotation/Shared.php