1.2.581. Injectable Version

The Injectable Version attribute mark a class in a class hierarchy to be the one to use when giving a type to a parameter, return type or property.

For constructor, it is an implicit check. For other methods, the method has to be marked as CheckInjectableMethod to be checked. In case no attribute is provided, both for InjectableVersion and CheckInjectableVersion, no error is returned.

The InjectableVersion allows to mark a specific class in a class hierarchy as the class to use in injections.

The check applies to the whole method.

The specifications include namespaces which are exempt from checking the attribute, namely test. This is not supported yet.

<?php

#[InjectableVersion]
abstract class Injectable {}

class NotInjectable extends Injectable {}

class x {
     // CheckInjectableMethod is implicit for constructors
     function __construct(Injectable $good, NotInjectable $wrong) {}

     #[CheckInjectableVersion]
     function good(Injectable $good, NotInjectable $wrong) {}
}



?>

Name

Default

Type

Description

injectableVersion

injectableversion

string

The FQN for the InjectableVersion attribute. By default, it is in the global space

checkInjectableVersion

checkinjectableversion

string

The FQN for the CheckInjectableVersion attribute. By default, it is in the global space

1.2.581.1. Specs

Short name

Attributes/InjectableVersion

Rulesets

All, Changed Behavior

Exakat since

2.6.4

Severity

Minor

Time To Fix

Quick (30 mins)

Precision

High

Available in

Entreprise Edition, Exakat Cloud