1 | <?php |
||
18 | abstract class CoffeeMaker implements CoffeeMakerInterface |
||
19 | { |
||
20 | |||
21 | /** |
||
22 | * Indicates that CoffeeMaker should construct a NEW entity instance from the provided arguments (if given) |
||
23 | */ |
||
24 | const BREW_NEW = 'new'; |
||
25 | |||
26 | /** |
||
27 | * Indicates that CoffeeMaker should always return a SHARED instance |
||
28 | */ |
||
29 | const BREW_SHARED = 'shared'; |
||
30 | |||
31 | /** |
||
32 | * Indicates that CoffeeMaker should only load the file/class/interface but NOT instantiate |
||
33 | */ |
||
34 | const BREW_LOAD_ONLY = 'load_only'; |
||
35 | |||
36 | |||
37 | /** |
||
38 | * @var CoffeePotInterface $coffee_pot |
||
39 | */ |
||
40 | private $coffee_pot; |
||
41 | |||
42 | /** |
||
43 | * @var DependencyInjector $injector |
||
44 | */ |
||
45 | private $injector; |
||
46 | |||
47 | |||
48 | /** |
||
49 | * @return array |
||
50 | */ |
||
51 | public static function getTypes() |
||
62 | |||
63 | |||
64 | /** |
||
65 | * @param $type |
||
66 | * @throws \EventEspresso\core\exceptions\InvalidIdentifierException |
||
67 | */ |
||
68 | public static function validateType($type) |
||
82 | |||
83 | |||
84 | /** |
||
85 | * CoffeeMaker constructor. |
||
86 | * |
||
87 | * @param CoffeePotInterface $coffee_pot |
||
88 | * @param InjectorInterface $injector |
||
89 | */ |
||
90 | public function __construct(CoffeePotInterface $coffee_pot, InjectorInterface $injector) |
||
95 | |||
96 | |||
97 | /** |
||
98 | * @return \EventEspresso\core\services\container\CoffeePotInterface |
||
99 | */ |
||
100 | protected function coffeePot() |
||
104 | |||
105 | |||
106 | /** |
||
107 | * @return \EventEspresso\core\services\container\DependencyInjector |
||
108 | */ |
||
109 | protected function injector() |
||
113 | |||
114 | |||
115 | /** |
||
116 | * Examines the constructor to determine which method should be used for instantiation |
||
117 | * |
||
118 | * @param \ReflectionClass $reflector |
||
119 | * @return mixed |
||
120 | * @throws InstantiationException |
||
121 | */ |
||
122 | protected function resolveInstantiationMethod(\ReflectionClass $reflector) |
||
141 | |||
142 | |||
143 | /** |
||
144 | * Ensures files for classes that are not PSR-4 compatible are loaded |
||
145 | * and then verifies that classes exist where applicable |
||
146 | * |
||
147 | * @param RecipeInterface $recipe |
||
148 | * @return bool |
||
149 | * @throws InvalidClassException |
||
150 | */ |
||
151 | protected function resolveClassAndFilepath(RecipeInterface $recipe) |
||
173 | } |
||
174 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.
Either this assignment is in error or an instanceof check should be added for that assignment.