1 | <?php |
||
29 | final class GlobalConstant extends AbstractFactory |
||
30 | { |
||
31 | /** |
||
32 | * @var PrettyPrinter |
||
33 | */ |
||
34 | private $valueConverter; |
||
35 | |||
36 | /** |
||
37 | * Initializes the object. |
||
38 | */ |
||
39 | public function __construct(PrettyPrinter $prettyPrinter) |
||
43 | |||
44 | public function matches($object): bool |
||
48 | |||
49 | /** |
||
50 | * Creates an Constant out of the given object. |
||
51 | * Since an object might contain other objects that need to be converted the $factory is passed so it can be |
||
52 | * used to create nested Elements. |
||
53 | * |
||
54 | * @param GlobalConstantIterator $object object to convert to an Element |
||
55 | * @param StrategyContainer $strategies used to convert nested objects. |
||
56 | * @param Context $context of the created object |
||
57 | * @return ConstantElement |
||
58 | */ |
||
59 | protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null) |
||
69 | } |
||
70 |
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.