Issues (1)

src/DI/DIMagicTrait.php (1 issue)

Labels
Severity
1
<?php
2
namespace Anax\DI;
3
4
use Anax\DI\Exception\Exception;
5
6
/**
7
 * Trait to use to make a DI container use magic for
8
 * getting services. A class using a DI container can
9
 * access $this->di->session; as an alternative to
10
 * $this->di->get("session");
11
 */
12
trait DIMagicTrait
13
{
14
    /**
15
     * Magic method to get a service.
16
     *
17
     * @param string $service name of the service.
18
     *
19
     * @return mixed as the service requested.
20
     */
21 1
    public function __get($service)
22
    {
23 1
        return $this->get($service);
0 ignored issues
show
The method get() does not exist on Anax\DI\DIMagicTrait. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

23
        return $this->/** @scrutinizer ignore-call */ get($service);
Loading history...
24
    }
25
26
27
28
    /**
29
     * Magic method to get and call a service.
30
     *
31
     * @param string $service name of the service.
32
     * @param array  $arguments currently NOT USED.
33
     *
34
     * @return mixed as the service requested.
35
     */
36 1
    public function __call($service, $arguments = [])
37
    {
38 1
        return $this->get($service);
39
    }
40
}
41