@@ -40,8 +40,6 @@ public function __construct(StreamInterface $stream)
4040
4141 /**
4242 * Returns the next token from the stream.
43- *
44- * @throws ImapParseException
4543 */
4644 public function nextToken (): ?Token
4745 {
@@ -51,7 +49,7 @@ public function nextToken(): ?Token
5149
5250 $ char = $ this ->currentChar ();
5351
54- if (empty ( $ char) ) {
52+ if ($ char === null || $ char === '' ) {
5553 return null ;
5654 }
5755
@@ -161,8 +159,6 @@ protected function skipWhitespace(): void
161159 * Reads a quoted string token.
162160 *
163161 * Quoted strings are enclosed in double quotes and may contain escaped characters.
164- *
165- * @throws ImapParseException
166162 */
167163 protected function readQuotedString (): QuotedString
168164 {
@@ -220,10 +216,8 @@ protected function readQuotedString(): QuotedString
220216 * Reads a literal token.
221217 *
222218 * Literal blocks in IMAP have the form {<length>}\r\n<data>.
223- *
224- * @throws ImapParseException
225219 */
226- protected function readLiteral (): ? Literal
220+ protected function readLiteral (): Literal
227221 {
228222 // Skip the opening '{'.
229223 $ this ->advance ();
@@ -305,15 +299,13 @@ protected function readLiteral(): ?Literal
305299 ));
306300 }
307301
308- return empty ( $ literal ) ? null : new Literal ($ literal );
302+ return new Literal ($ literal );
309303 }
310304
311305 /**
312306 * Reads an atom token.
313- *
314- * Atoms are unquoted strings ending at whitespace or a delimiter.
315307 */
316- protected function readAtom (): ? Atom
308+ protected function readAtom (): Atom
317309 {
318310 $ value = '' ;
319311
@@ -335,13 +327,11 @@ protected function readAtom(): ?Atom
335327 $ this ->advance ();
336328 }
337329
338- return empty ( $ value ) ? null : new Atom ($ value );
330+ return new Atom ($ value );
339331 }
340332
341333 /**
342334 * Reads an email address token enclosed in angle brackets.
343- *
344- * @throws ImapParseException
345335 */
346336 protected function readEmailAddress (): ?EmailAddress
347337 {
0 commit comments