1 | <?php |
||
14 | trait ManagesIocTrait |
||
15 | { |
||
16 | use DependsOnManagesItemsTrait; |
||
17 | |||
18 | /** |
||
19 | * Returns the request object with all dependencies |
||
20 | * |
||
21 | * Overrides the `get()` method on ManagesItemsTrait |
||
22 | * Use getRaw() to return the raw value |
||
23 | * |
||
24 | * string Full class name for a new object each time |
||
25 | * callable Factory to create new object (passed manager) |
||
26 | * object The exact object to be returned |
||
27 | * |
||
28 | * @param string $alias |
||
29 | * @param string|mixed $fallback |
||
30 | * @return mixed |
||
31 | * @throws \Exception |
||
32 | */ |
||
33 | public function get($alias, $fallback = '_michaels_no_fallback') |
||
60 | |||
61 | /** |
||
62 | * Alias of get() for backwards comparability |
||
63 | * |
||
64 | * @param string $alias |
||
65 | * @param string|mixed $fallback |
||
66 | * @return mixed |
||
67 | * @throws \Exception |
||
68 | */ |
||
69 | public function fetch($alias, $fallback = '_michaels_no_fallback') |
||
73 | |||
74 | /** |
||
75 | * Adds a dependency to the manager |
||
76 | * |
||
77 | * $factory can be a: |
||
78 | * string Full class name for a new object each time |
||
79 | * callable Factory to create new object (passed manager) |
||
80 | * object The exact object to be returned |
||
81 | * |
||
82 | * @param string $alias |
||
83 | * @param callable|string|object $factory |
||
84 | * @param array $declared |
||
85 | * @return $this |
||
86 | */ |
||
87 | public function add($alias, $factory = null, array $declared = null) |
||
112 | |||
113 | /** |
||
114 | * Turns a dependency into a singleton. |
||
115 | * @param $alias |
||
116 | * @return mixed |
||
117 | */ |
||
118 | public function share($alias) |
||
123 | |||
124 | /** |
||
125 | * Add a pipeline to to the que |
||
126 | * @param $alias |
||
127 | * @param $pipeline |
||
128 | * @return $this |
||
129 | */ |
||
130 | public function setup($alias, $pipeline) |
||
135 | |||
136 | /** |
||
137 | * Produces the object from an alias |
||
138 | * @param string $alias |
||
139 | * @param mixed|string $fallback |
||
140 | * @return mixed |
||
141 | * @throws ItemNotFoundException |
||
142 | * @throws \Exception |
||
143 | */ |
||
144 | protected function produceDependency($alias, $fallback = '_michaels_no_fallback') |
||
208 | } |
||
209 |
This check looks at variables that have been passed in as parameters and are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.