Skip to content

Conversation

@zero-to-prod
Copy link
Owner

@zero-to-prod zero-to-prod commented Jan 9, 2026

Description

  • Fix ArgumentCountError when using built-in PHP functions (like strtolower) as cast callables
  • Add reflection-based parameter count detection to pass appropriate number of arguments to cast functions

Before: Cast functions always received 4 arguments, causing built-in functions to fail:
ArgumentCountError: strtolower() expects exactly 1 argument, 4 given

After: Functions with 1 parameter receive only the value; others receive all 4 arguments:

#[Describe(['cast' => 'strtolower'])]
public string $name; // Now works

@zero-to-prod zero-to-prod self-assigned this Jan 9, 2026
@zero-to-prod zero-to-prod added the bug Something isn't working label Jan 9, 2026
@zero-to-prod zero-to-prod merged commit 883a8cc into main Jan 9, 2026
2 checks passed
@zero-to-prod zero-to-prod deleted the bugfix/function-casting branch January 9, 2026 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants