Skip to content

#370 - rules: cast the result of a condition to bool - #377

Merged
njoubert-cleverage merged 2 commits into
mainfrom
370
Oct 23, 2026
Merged

njoubert-cleverage merged 2 commits into
mainfrom
370

Conversation

@njoubert-cleverage

Copy link
Copy Markdown
Member

Description

Fixes #370.

RulesTransformer::matchRule() is typed bool but returned the raw result of the expression, so a condition returning an int (preg_match()), a string, null or a single variable threw a TypeError. The result is now cast to bool (PHP truthiness) and the reference page documents it.

Requirements

  • Documentation updates
    • Reference
    • Cookbooks
    • Changelog
  • Unit tests

Breaking changes

None: only conditions that threw a TypeError are affected.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@njoubert-cleverage
njoubert-cleverage requested a review from a team as a code owner October 23, 2026 14:39
@njoubert-cleverage
njoubert-cleverage merged commit ed4f81f into main Oct 23, 2026
15 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.

rules: a condition that does not evaluate to a boolean throws a TypeError

1 participant