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