1 | <?php |
||
31 | final class Property extends AbstractFactory implements ProjectFactoryStrategy |
||
32 | { |
||
33 | /** |
||
34 | * @var PrettyPrinter |
||
35 | */ |
||
36 | private $valueConverter; |
||
37 | |||
38 | /** |
||
39 | * Initializes the object. |
||
40 | * |
||
41 | * @param PrettyPrinter $prettyPrinter |
||
42 | */ |
||
43 | 6 | public function __construct(PrettyPrinter $prettyPrinter) |
|
47 | |||
48 | /** |
||
49 | * Returns true when the strategy is able to handle the object. |
||
50 | * |
||
51 | * @param object $object object to check. |
||
52 | * @return boolean |
||
53 | */ |
||
54 | 1 | public function matches($object) |
|
58 | |||
59 | /** |
||
60 | * Creates an PropertyDescriptor out of the given object. |
||
61 | * Since an object might contain other objects that need to be converted the $factory is passed so it can be |
||
62 | * used to create nested Elements. |
||
63 | * |
||
64 | * @param PropertyIterator $object object to convert to an PropertyDescriptor |
||
65 | * @param StrategyContainer $strategies used to convert nested objects. |
||
66 | * @param Context $context |
||
67 | * @return PropertyDescriptor |
||
68 | */ |
||
69 | 4 | protected function doCreate($object, StrategyContainer $strategies, Context $context = null) |
|
80 | |||
81 | /** |
||
82 | * Converts the visibility of the property to a valid Visibility object. |
||
83 | * |
||
84 | * @param PropertyIterator $node |
||
85 | * @return Visibility |
||
86 | */ |
||
87 | 4 | private function buildVisibility(PropertyIterator $node) |
|
97 | } |
||
98 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.