Repository navigation
PHPStan level max; fix TypeError for buttons with array class - #20
Conversation
Html::addClass() stores the class attribute as an array, which made strpos() in render() throw a TypeError. Read it as a string of class names.
The expected HTML in tests/fixtures was rendered with the code from master (0b1b49f). Forms that crashed there (button class stored as an array) are compared with the old output of the same classes set as a string. Also covers rendering a form twice and part by part, which crashed before the fix.
|
Review summary Fix (8218718): correct. Added (8f3dd10): a PHPUnit suite ( Verification
🤖 Generated with Claude Code |
Raises PHPStan from level 8 to max. Reaching max needs one behaviour change, so it is a PR instead of a direct push:
render()passed the button's class attribute tostrpos(). After$button->getControlPrototype()->addClass(...)the attribute is an array and rendering threw aTypeError. It is now read as a space-separated string of class names, so a button that already has abtnclass keeps it and other buttons getbtn btn-primary/btn btn-defaultas before.🤖 Generated with Claude Code