Skip to content

[#hql] - Fix operator types, Token handling, bracket identifiers and join conditions#6

Merged
niden merged 1 commit intophalcon:1.0.xfrom
niden-code:1.0.x
Apr 11, 2026
Merged

[#hql] - Fix operator types, Token handling, bracket identifiers and join conditions#6
niden merged 1 commit intophalcon:1.0.xfrom
niden-code:1.0.x

Conversation

@niden
Copy link
Copy Markdown
Member

@niden niden commented Apr 10, 2026

Summary

  • Opcode.php — 11 single-character operator constants (+, -, *, /, %, >, !, &, |, ~, ^) were defined as PHP strings instead of their ASCII integer values, causing type fields in the parser AST to be characters instead of integers
  • parser.phpphql_ret_raw_qualified_name() — function accepted string $tokenA but the parser passes Token objects for CAST/CONVERT type names; changed to accept Token and call ->getValue()
  • Scanner.php — case 138 (bracket identifiers)[col\[0\]]-style escaped-bracket identifiers used $q+1 as the value start instead of $yymarker, which the C re2c scanner updates (via PPMARKER = ++PPCURSOR) when processing \] sequences
  • Scanner.php — case 41 (IDENTIFIER terminal) — identifiers that share a keyword prefix (e.g. Notes starting with NOT) returned the full identifier instead of the post-keyword suffix; fixed by initializing $yymarker = $yycursor at the start of each token scan and using $yymarker in case 41, matching the re2c PPMARKER overwrite behavior in the C scanner
  • parser.php — case 38 (empty join_conditions) — empty join_conditions rule returned [] instead of null, causing CROSS JOIN (and other conditionless joins) to include a spurious 'conditions' => [] in the AST

Test plan

  • All 148 tests in tests/unit/Mvc/Model/Query/Phql/ pass
  • No regressions in the existing test suite

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 11, 2026

Codecov Report

❌ Patch coverage is 63.15789% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 32.90%. Comparing base (be3df07) to head (801ce59).
⚠️ Report is 3 commits behind head on 1.0.x.

Files with missing lines Patch % Lines
resources/files/parser.php 16.66% 5 Missing ⚠️
src/Scanner/Scanner.php 84.61% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##              1.0.x       #6   +/-   ##
=========================================
  Coverage     32.90%   32.90%           
  Complexity     5600     5600           
=========================================
  Files             7        7           
  Lines          8683     8686    +3     
=========================================
+ Hits           2857     2858    +1     
- Misses         5826     5828    +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@niden niden marked this pull request as ready for review April 11, 2026 00:01
@niden niden merged commit 0634f46 into phalcon:1.0.x Apr 11, 2026
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