Skip to content

fix: correct multi-argument parsing in TEMPORAL tokens#3

Merged
abkrim merged 1 commit intomainfrom
issue/parsing-muti-argument
Dec 12, 2025
Merged

fix: correct multi-argument parsing in TEMPORAL tokens#3
abkrim merged 1 commit intomainfrom
issue/parsing-muti-argument

Conversation

@abkrim
Copy link
Contributor

@abkrim abkrim commented Dec 12, 2025

Summary

  • Fixed TokenClassifier.createTemporalToken() incorrectly capturing all function arguments as a single string
  • Now properly parses multiple arguments using parseFunctionArgs()
  • Affected functions: TEMPORAL:isNthWeekday('saturday', 1) and TEMPORAL:isLastWeekday('friday')

Changes

  • Fix: src/Core/Token/TokenClassifier.php - Use parseFunctionArgs() for TEMPORAL, NOW, and TODAY tokens
  • Tests: Updated unit tests to use real TokenClassifier instead of manually created tokens
  • Tests: Added 14 new TokenClassifier tests for TEMPORAL parsing
  • Tests: Added 7 new integration tests for isNthWeekday and isLastWeekday
  • Docs: Updated CHANGELOG.md for v1.1.1

Test plan

  • All 814 tests pass
  • PHPStan analysis passes
  • Pint formatting passes
  • Verified TEMPORAL:isNthWeekday('saturday', 1) now parses to ['saturday', 1]
  • Verified TEMPORAL:isLastWeekday('friday') now parses to ['friday']

TokenClassifier.createTemporalToken() was incorrectly capturing all
function arguments as a single string. Now uses parseFunctionArgs()
to properly parse multiple arguments.

Affected functions:
- TEMPORAL:isNthWeekday('saturday', 1) → ['saturday', 1]
- TEMPORAL:isLastWeekday('friday') → ['friday']

Updated tests to use real TokenClassifier instead of manually created
tokens, ensuring the parsing is properly validated.
@abkrim abkrim merged commit 2dae88d into main Dec 12, 2025
13 checks passed
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