Skip to content

Comments

Detect errors directive#36

Merged
ganyicz merged 1 commit intomainfrom
filip/fix-errors-directive
Feb 19, 2026
Merged

Detect errors directive#36
ganyicz merged 1 commit intomainfrom
filip/fix-errors-directive

Conversation

@ganyicz
Copy link
Collaborator

@ganyicz ganyicz commented Feb 19, 2026

The scenario

Using @error directive inside a Blaze component template.

<input @error('name') invalid @enderror >

The problem

This throws an exception because we only inject the $errors variable when we detect its usage.

However, we only check for $errors, not @error.

The solution

Also check for @error in the source string:

str_contains($source, '$errors') || str_contains($source, '@error') ? '$errors = $__blaze->errors;'."\n" : null,

Added tests for both $errors and @error detection in WrapperTest.php.

@ganyicz ganyicz merged commit ddf097f into main Feb 19, 2026
6 checks passed
@joshhanley joshhanley deleted the filip/fix-errors-directive branch February 19, 2026 00:32
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