1 | <?php |
||
20 | class StringValueNode extends Rule implements AstValueInterface |
||
21 | { |
||
22 | /** |
||
23 | * @var string |
||
24 | */ |
||
25 | private const UTF_SEQUENCE_PATTERN = '/(?<!\\\\)\\\\u([0-9a-f]{4})/ui'; |
||
26 | |||
27 | /** |
||
28 | * @var string |
||
29 | */ |
||
30 | private const CHAR_SEQUENCE_PATTERN = '/(?<!\\\\)\\\\(b|f|n|r|t)/u'; |
||
31 | |||
32 | /** |
||
33 | * @return ValueInterface |
||
34 | */ |
||
35 | public function unpack(): ValueInterface |
||
39 | |||
40 | /** |
||
41 | * @return string |
||
42 | */ |
||
43 | public function toPHPString(): string |
||
47 | |||
48 | /** |
||
49 | * @return string |
||
50 | */ |
||
51 | private function getValue(): string |
||
58 | |||
59 | /** |
||
60 | * @return string |
||
61 | */ |
||
62 | private function parse(): string |
||
81 | |||
82 | /** |
||
83 | * @param string $value |
||
84 | * @return string |
||
85 | */ |
||
86 | private function encodeSlashes(string $value): string |
||
90 | |||
91 | /** |
||
92 | * Method for parsing and decode utf-8 character |
||
93 | * sequences like "\uXXXX" type. |
||
94 | * |
||
95 | * @see http://facebook.github.io/graphql/October2016/#sec-String-Value |
||
96 | * @param string $body |
||
97 | * @return string |
||
98 | */ |
||
99 | private function renderUtfSequences(string $body): string |
||
113 | |||
114 | /** |
||
115 | * @param string $body |
||
116 | * @return string |
||
117 | */ |
||
118 | private function forwardRenderUtfSequences(string $body): string |
||
122 | |||
123 | /** |
||
124 | * @param string $body |
||
125 | * @return string |
||
126 | */ |
||
127 | private function fallbackRenderUtfSequences(string $body): string |
||
141 | |||
142 | /** |
||
143 | * Method for parsing special control characters. |
||
144 | * |
||
145 | * @see http://facebook.github.io/graphql/October2016/#sec-String-Value |
||
146 | * @param string $body |
||
147 | * @return string |
||
148 | */ |
||
149 | private function renderSpecialCharacters(string $body): string |
||
172 | |||
173 | /** |
||
174 | * @param string $value |
||
175 | * @return string |
||
176 | */ |
||
177 | private function decodeSlashes(string $value): string |
||
181 | } |
||
182 |
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.