smarty icon indicating copy to clipboard operation
smarty copied to clipboard

Support nullsafe operator

Open SlowFox71 opened this issue 1 year ago • 2 comments

PHP supports the nullsafe operator ?-> since version 8, so it would be fine, if this were reflected in Smarty as well. A rather simple patch should suffice, see attachment (but I am not a parser expert, as in the suggestions a couple of days ago).

patch.txt

SlowFox71 avatar May 13 '24 14:05 SlowFox71

More thought needs to put into this. For one thing, the patch above is wrong: The lexer needs to be touched, too as otherwise whitespace would be permitted ? -> which is wrong; this is corrected by using the files attached here.

The other thing is that I did not consider registered objects, which I should have done. However, this needs changes in ObjectMethodCallCompiler.php which is beyond my confidence. lexer.txt parser.txt

SlowFox71 avatar May 13 '24 15:05 SlowFox71

Also see #633 and the related PR

wisskid avatar May 15 '24 06:05 wisskid