Skip to content

Conversation

@mvorisek
Copy link
Member

@mvorisek mvorisek commented May 9, 2025

fix #2286


return new JsToast('This country name can be added.');
}, ['args' => [$nameInput->jsInput()->val()]]);
}, ['args' => [new JsCallbackLoadableValue($nameInput->jsInput()->val(), static fn ($v) => $v)]]);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO for myself - can this be detected using phpstan or no lately on runtime?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works for me, but looks like black magic, not low code :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Low code, but still we require explicit code to enforce strong typecasting. Here we indicate we want to keep string type.

With improve method param type PHPStan should be able to detect the issue.

Also we should throw if the type is not JsCallbackLoadableValue in JsCallback. The reason you got "argument error" is passed JsExpression implements __call. I will work on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

"form/form2.php" demo addAction is broken

3 participants