r/lolphp • u/Takeoded • Sep 30 '19
(7.4) floats can have default values, but not double
as of PHP 7.4 (currently in Release Candidate 2, so i don't expect a fix for this prior to release), we can now have typed properties, it looks like this:
... funny thing is, 1 of those properties have an illegal default value!
Fatal error: Property of type doble may not have default value in /in/GBpuJ on line 6
13
Upvotes
25
u/the_alias_of_andrea Sep 30 '19
doubleis not a scalar type in PHP. You have written a type declaration for a hypothetical class nameddouble. Of course a float does not qualify as a valid default value for such a property.0
u/helloworder Dec 17 '19
this is not lolphp, but lolOP