1 | <?php |
||
29 | final class Constant extends AbstractFactory implements ProjectFactoryStrategy |
||
30 | { |
||
31 | /** |
||
32 | * @var PrettyPrinter |
||
33 | */ |
||
34 | private $valueConverter; |
||
35 | |||
36 | /** |
||
37 | * Initializes the object. |
||
38 | * |
||
39 | * @param PrettyPrinter $prettyPrinter |
||
40 | */ |
||
41 | public function __construct(PrettyPrinter $prettyPrinter) |
||
45 | |||
46 | /** |
||
47 | * Returns true when the strategy is able to handle the object. |
||
48 | * |
||
49 | * @param object $object object to check. |
||
50 | * @return boolean |
||
51 | */ |
||
52 | public function matches($object) |
||
56 | |||
57 | /** |
||
58 | * Creates an Constant out of the given object. |
||
59 | * Since an object might contain other objects that need to be converted the $factory is passed so it can be |
||
60 | * used to create nested Elements. |
||
61 | * |
||
62 | * @param ClassConstantIterator $object object to convert to an Element |
||
63 | * @param StrategyContainer $strategies used to convert nested objects. |
||
64 | * @param Context $context of the created object |
||
65 | * @return Constant |
||
66 | */ |
||
67 | protected function doCreate($object, StrategyContainer $strategies, Context $context = null) |
||
77 | } |
||
78 |
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.