1.2.949. PSR-11 Usage

PSR-11 describes a common interface for dependency injection containers.

It is supported by an set of interfaces, that one may use in the code.

<?php

namespace MyNamespace;

// MyContainerInterface implements the PSR-7 ServerRequestInterface.
// MyContainerInterface is more of a black hole than a real Container.
class MyContainerInterface implements \Psr\Container\ContainerInterface {
    public function get($id) {}
    public function has($id) {}
}

?>

See also PSR-11 : Dependency injection container.

1.2.949.1. Specs

Short name

Psr/Psr11Usage

Rulesets

All, Appinfo, CE

Exakat since

0.11.5

PHP Version

All

Severity

Time To Fix

Precision

Very high

Features

psr

Available in

Entreprise Edition, Community Edition, Exakat Cloud