1 | <?php namespace Limoncello\Flute\Validation\Form\Execution; |
||
28 | class FormRulesSerializer extends RulesSerializer implements FormRulesSerializerInterface |
||
29 | { |
||
30 | /** |
||
31 | * @var array |
||
32 | */ |
||
33 | private $serializedRules = []; |
||
34 | |||
35 | /** Serialized indexes key */ |
||
36 | protected const SERIALIZED_RULES = 0; |
||
37 | |||
38 | /** Serialized rules key */ |
||
39 | protected const SERIALIZED_BLOCKS = self::SERIALIZED_RULES + 1; |
||
40 | |||
41 | /** |
||
42 | * @inheritdoc |
||
43 | */ |
||
44 | 30 | public function addRulesFromClass(string $rulesClass): FormRulesSerializerInterface |
|
54 | |||
55 | /** |
||
56 | * @inheritdoc |
||
57 | */ |
||
58 | 30 | public function addFormRules(string $name, ?array $attributeRules): FormRulesSerializerInterface |
|
67 | |||
68 | /** |
||
69 | * @inheritdoc |
||
70 | */ |
||
71 | 30 | public function getData(): array |
|
78 | |||
79 | /** |
||
80 | * @inheritdoc |
||
81 | */ |
||
82 | 3 | public static function readBlocks(array $serializedData): array |
|
86 | |||
87 | /** |
||
88 | * @inheritdoc |
||
89 | */ |
||
90 | 30 | public static function hasRules(string $name, array $serializedData): bool |
|
97 | |||
98 | /** |
||
99 | * @inheritdoc |
||
100 | */ |
||
101 | 3 | public static function readRules(string $rulesClass, array $serializedData): array |
|
107 | |||
108 | /** |
||
109 | * @inheritdoc |
||
110 | */ |
||
111 | 3 | public static function readRuleMainIndexes(array $ruleIndexes): ?array |
|
115 | |||
116 | /** |
||
117 | * @inheritdoc |
||
118 | */ |
||
119 | 3 | public static function readRuleStartIndexes(array $ruleIndexes): array |
|
123 | |||
124 | /** |
||
125 | * @inheritdoc |
||
126 | */ |
||
127 | 3 | public static function readRuleEndIndexes(array $ruleIndexes): array |
|
131 | |||
132 | /** |
||
133 | * @param string $rulesClass |
||
134 | * |
||
135 | * @return bool |
||
136 | */ |
||
137 | 30 | private static function isRulesClass(string $rulesClass): bool |
|
143 | } |
||
144 |
Let’s assume you have a class which uses late-static binding:
}
The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the
getSomeVariable()
on that sub-class, you will receive a runtime error:In the case above, it makes sense to update
SomeClass
to useself
instead: