zephir-lang / zephir

Zephir is a compiled high-level language aimed to ease the creation of C-extensions for PHP
https://zephir-lang.com
MIT License
3.3k stars 466 forks source link

Invalid default value #2396

Closed xqkeji closed 5 months ago

xqkeji commented 1 year ago

PHP 8.1 Invalid default value

for example:

class Test{ public function t1(int i=0) { } }

var t; let t=new Test(); t->t1();

Since the call does not take a parameter, it usually passes a null value, so the default value of the parameter cannot be used.

The default value can only be used if the type is changed to var i=0.

Jeckerson commented 5 months ago

I added some tests and it works fine - https://github.com/zephir-lang/zephir/pull/2430/commits/02d088e7d66b924d38b492a1edf9e3852142c691

Please provide example when it occur and what type of error happens. Closing for now, open if needed.