Skip to content

Validate encodeDocument() semantics and tighten parser edge cases#6

Merged
dereuromark merged 2 commits intomasterfrom
fix/validate-encoded-documents
Mar 25, 2026
Merged

Validate encodeDocument() semantics and tighten parser edge cases#6
dereuromark merged 2 commits intomasterfrom
fix/validate-encoded-documents

Conversation

@dereuromark
Copy link
Contributor

Summary

  • validate AST semantics before encodeDocument() emits normalized or source-aware output
  • reject signed numeric-looking keys in parser key position
  • reject bare CR in multiline basic string line continuations
  • add regressions for all three cases

Verification

  • vendor/bin/phpunit tests/TomlTest.php tests/Lexer/LexerTest.php
  • vendor/bin/phpunit
  • vendor/bin/phpstan analyse
  • vendor/bin/phpcs --colors --parallel=16

TOML spec requires table headers to be "on a line by themselves".
This rejects invalid syntax like `[table] key = "value"` while
still allowing valid comments like `[table] # comment`.

Added checkTableHeaderTerminator() method that validates table
headers are followed only by newline, EOF, comment, or whitespace
leading to those.
@dereuromark dereuromark merged commit cabf3d1 into master Mar 25, 2026
3 checks passed
@dereuromark dereuromark deleted the fix/validate-encoded-documents branch March 25, 2026 06:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant