1 | <?php |
||
25 | class LoggerAbstractFactory implements AbstractFactoryInterface |
||
26 | { |
||
27 | /** |
||
28 | * @var array |
||
29 | */ |
||
30 | protected $config; |
||
31 | |||
32 | /** |
||
33 | * Configuration key holding logger configuration |
||
34 | * |
||
35 | * @var string |
||
36 | */ |
||
37 | protected $configKey = 'log'; |
||
38 | |||
39 | /** |
||
40 | * Create a new Logger instance |
||
41 | * |
||
42 | * @param ContainerInterface $container |
||
43 | * @param string $requestedName |
||
44 | * @param array|null $options |
||
45 | * @return Logger |
||
46 | */ |
||
47 | public function __invoke(ContainerInterface $container, $requestedName, array $options = null) |
||
58 | |||
59 | /** |
||
60 | * Check if the factory can create an instance for the given $requestedName service |
||
61 | * |
||
62 | * @param ContainerInterface $container |
||
63 | * @param string $requestedName |
||
64 | * @param array|null $options |
||
65 | * @return bool |
||
66 | */ |
||
67 | public function canCreate(ContainerInterface $container, $requestedName, array $options = null) |
||
76 | |||
77 | /** |
||
78 | * Determines if we can create a Logger instance with give $requestedName |
||
79 | * |
||
80 | * @param ServiceLocatorInterface $services |
||
81 | * @param string $name |
||
82 | * @param string $requestedName |
||
83 | * @return bool |
||
84 | */ |
||
85 | public function canCreateServiceWithName(ServiceLocatorInterface $services, $name, $requestedName) |
||
89 | |||
90 | /** |
||
91 | * Create a Logger instance with given $requestedName service |
||
92 | * |
||
93 | * @param ServiceLocatorInterface $services |
||
94 | * @param string $name |
||
95 | * @param string $requestedName |
||
96 | * @return Logger |
||
97 | */ |
||
98 | public function createServiceWithName(ServiceLocatorInterface $services, $name, $requestedName) |
||
102 | |||
103 | /** |
||
104 | * Retrieve configuration for loggers, if any |
||
105 | * |
||
106 | * @param ServiceLocatorInterface $services |
||
107 | * @return array |
||
108 | */ |
||
109 | protected function getConfig(ServiceLocatorInterface $services) |
||
129 | |||
130 | protected function processConfig(&$config, ServiceLocatorInterface $services) |
||
159 | } |
||
160 |
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.
Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.