1 | <?php |
||
26 | class Array2ObjectBuilder extends AbstractBuilder |
||
27 | { |
||
28 | use MatcherAwareTrait; |
||
29 | |||
30 | /** |
||
31 | * @var PropertyWriterInterface |
||
32 | */ |
||
33 | private $writer; |
||
34 | |||
35 | /** |
||
36 | * @return PropertyWriterInterface |
||
37 | */ |
||
38 | public function getWriter() |
||
42 | |||
43 | /** |
||
44 | * @param PropertyWriterInterface $writer |
||
45 | * |
||
46 | * @return $this |
||
47 | */ |
||
48 | public function setWriter($writer) |
||
54 | |||
55 | /** |
||
56 | * Array keys and property names are identical. |
||
57 | * |
||
58 | * @return $this |
||
59 | */ |
||
60 | public function useIdenticalMatcher() |
||
66 | |||
67 | /** |
||
68 | * Array keys and property names are compared using some property possible versions |
||
69 | * e.g, propertyName => property_name. |
||
70 | * |
||
71 | * @return $this |
||
72 | */ |
||
73 | public function useCamelizeMatcher() |
||
79 | |||
80 | /** |
||
81 | * Array keys and property names are compared using levenshtein algorithm to find similar strings. |
||
82 | * |
||
83 | * @return $this |
||
84 | */ |
||
85 | public function useLevenshteinMatcher() |
||
91 | |||
92 | /** |
||
93 | * Array keys and property names are compared using the given property and array key map. |
||
94 | * |
||
95 | * @param array $map |
||
96 | * |
||
97 | * @return $this |
||
98 | */ |
||
99 | public function useMapMatcher(array $map) |
||
105 | |||
106 | /** |
||
107 | * Array keys and property names are compared using custom function |
||
108 | * the given function receive two parameters \ReflectionProperty $property, $givenName. |
||
109 | * |
||
110 | * @param callable $callback |
||
111 | * |
||
112 | * @return $this |
||
113 | */ |
||
114 | public function useCallableMatcher(callable $callback) |
||
120 | |||
121 | /** |
||
122 | * Write the property directly without use setters. |
||
123 | * |
||
124 | * @param bool $onlyPublicProperties only public properties should be exported |
||
125 | * |
||
126 | * @return $this |
||
127 | */ |
||
128 | public function disableSetters($onlyPublicProperties = false) |
||
134 | |||
135 | /** |
||
136 | * Build custom Array2Object instance. |
||
137 | */ |
||
138 | public function build() |
||
150 | |||
151 | /** |
||
152 | * {@inheritdoc} |
||
153 | */ |
||
154 | protected function prepareContext(AbstractContext $context) |
||
163 | } |
||
164 |
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.