1 | <?php |
||
21 | class Object2ArrayBuilder extends AbstractBuilder |
||
22 | { |
||
23 | use NamingStrategyAwareTrait; |
||
24 | |||
25 | /** |
||
26 | * @var PropertyReaderInterface |
||
27 | */ |
||
28 | private $reader; |
||
29 | |||
30 | /** |
||
31 | * @return PropertyReaderInterface |
||
32 | */ |
||
33 | public function getReader() |
||
37 | |||
38 | /** |
||
39 | * @param PropertyReaderInterface $reader |
||
40 | * |
||
41 | * @return $this |
||
42 | */ |
||
43 | public function setReader($reader) |
||
49 | |||
50 | /** |
||
51 | * Name array keys as "PropertyName" |
||
52 | * |
||
53 | * @return $this |
||
54 | */ |
||
55 | public function useUcFirstCamelCaseNamingStrategy() |
||
61 | |||
62 | /** |
||
63 | * Name array keys as "propertyName" |
||
64 | * |
||
65 | * @return $this |
||
66 | */ |
||
67 | public function useCamelCaseNamingStrategy() |
||
73 | |||
74 | /** |
||
75 | * Name array keys as "property_name" |
||
76 | * |
||
77 | * @return $this |
||
78 | */ |
||
79 | public function useUnderScoreNamingStrategy() |
||
85 | |||
86 | /** |
||
87 | * The array keys is identical to property name |
||
88 | * |
||
89 | * @return $this |
||
90 | */ |
||
91 | public function useIdenticalNamingStrategy() |
||
97 | |||
98 | /** |
||
99 | * Use given callback to transform the array key |
||
100 | * |
||
101 | * @param callable $callback |
||
102 | * |
||
103 | * @return $this |
||
104 | */ |
||
105 | public function useCallbackNamingStrategy(callable $callback) |
||
111 | |||
112 | /** |
||
113 | * Read the property directly without use getters |
||
114 | * |
||
115 | * @param boolean $onlyPublicProperties only public properties should be exported |
||
116 | * |
||
117 | * @return $this |
||
118 | */ |
||
119 | public function disableGetters($onlyPublicProperties = false) |
||
125 | |||
126 | /** |
||
127 | * Build custom Array2Object instance |
||
128 | */ |
||
129 | public function build() |
||
141 | |||
142 | /** |
||
143 | * @inheritDoc |
||
144 | */ |
||
145 | protected function prepareContext(AbstractContext $context) |
||
154 | } |
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.