trongate / trongate-framework

The Trongate PHP framework
https://trongate.io
Other
1.11k stars 100 forks source link

change the out method to accept an empty string or null #169

Closed mjim closed 5 months ago

monxian commented 5 months ago

This is useful if you have a form that populates with no data then fills after a validation error or database query.
Other wise you'll get this error.

Fatal error: Uncaught TypeError: out(): Argument #1 ($input) must be of type string, null given

trongate commented 5 months ago

Thank you!

Instead of:

if ($input === null) { $input = ''; }

Could we not just have: function out(?string $input='', string $encoding = 'UTF-8', string $output_format = 'html'): string {

trongate commented 5 months ago

Ignore my stupid comment above (and thanks to Dafa for showing me the light).

mjim (Jim) - Thank you for this glorious contribution. We're all super grateful. Hail Jim!