1 | <?php |
||
23 | class Object2ArrayBuilder extends AbstractBuilder |
||
24 | { |
||
25 | use NamingStrategyAwareTrait; |
||
26 | use IgnoreNullsTrait; |
||
27 | |||
28 | /** |
||
29 | * @var PropertyReaderInterface |
||
30 | */ |
||
31 | private $reader; |
||
32 | |||
33 | /** |
||
34 | * @return PropertyReaderInterface |
||
35 | */ |
||
36 | public function getReader() |
||
40 | |||
41 | /** |
||
42 | * @param PropertyReaderInterface $reader |
||
43 | * |
||
44 | * @return $this |
||
45 | */ |
||
46 | public function setReader($reader) |
||
52 | |||
53 | /** |
||
54 | * Name array keys as "PropertyName". |
||
55 | * |
||
56 | * @return $this |
||
57 | */ |
||
58 | public function useUcFirstCamelCaseNamingStrategy() |
||
64 | |||
65 | /** |
||
66 | * Name array keys as "propertyName". |
||
67 | * |
||
68 | * @return $this |
||
69 | */ |
||
70 | public function useCamelCaseNamingStrategy() |
||
76 | |||
77 | /** |
||
78 | * Name array keys as "property_name". |
||
79 | * |
||
80 | * @return $this |
||
81 | */ |
||
82 | public function useUnderScoreNamingStrategy() |
||
88 | |||
89 | /** |
||
90 | * The array keys is identical to property name. |
||
91 | * |
||
92 | * @return $this |
||
93 | */ |
||
94 | public function useIdenticalNamingStrategy() |
||
100 | |||
101 | /** |
||
102 | * Use given callback to transform the array key. |
||
103 | * |
||
104 | * @param callable $callback |
||
105 | * |
||
106 | * @return $this |
||
107 | */ |
||
108 | public function useCallbackNamingStrategy(callable $callback) |
||
114 | |||
115 | /** |
||
116 | * Read the property directly without use getters. |
||
117 | * |
||
118 | * @param bool $onlyPublicProperties only public properties should be exported |
||
119 | * |
||
120 | * @return $this |
||
121 | */ |
||
122 | public function disableGetters($onlyPublicProperties = false) |
||
128 | |||
129 | /** |
||
130 | * Build custom Array2Object instance. |
||
131 | */ |
||
132 | public function build() |
||
144 | |||
145 | /** |
||
146 | * {@inheritdoc} |
||
147 | */ |
||
148 | protected function prepareContext(AbstractContext $context) |
||
158 | } |
||
159 |
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.