We've had var_dump and print_r for decades now. Time to add something more like dd() and dump() that also works really easily out of the box to send the dump to a separate panel or file to make it super easy when debugging APIs.
Given that a function in a php class is called a "method", it kinda makes sense to remove the word "function" from the definition given that the parentheses infer that it is a "method"
Arrow functions for methods: yes omitting the function keys: hell yes Multiline short closers: no, makes the difference between the 2 too subtle Expression as default value: no, inject your dependencies. dd() in core php: no. While really nice to always have available, it does _so much more_ than just dumping some data. Making it look pretty is just a bonus. The real strength lies within the frequency it gets updated and adjusted, and the amount of extra information it displays. It would simply not be a good fit in the core. Just write your own dd() if you don't want to install the Symfony dependency.
For the short public function xxx(): type => 'something'; proposal I would preffer to maintain PHP naming and more familiar structure and propose something more like public function xxxx(): type return 'something'; more like a if(bool) return; style.
Inline expressions in promoted properties would be a game changer, imho, otherwise you have to somewhat repeat the process in the constructor body, making the promoted property kind of a chore. I simply don't understand how out of all of those features you want that the least lmao. "Looks crazy"... new getters/setters look crazy dawg. "Too much logic in constructor" -> there will be too much logic if you do it the conventional way in the constructor body.
I dont like those changes. Make a pretty and readable language just shittier, for no discernible benefit. dd also feels outside the scope of a build in language command.
We've had var_dump and print_r for decades now. Time to add something more like dd() and dump() that also works really easily out of the box to send the dump to a separate panel or file to make it super easy when debugging APIs.
Given that a function in a php class is called a "method", it kinda makes sense to remove the word "function" from the definition given that the parentheses infer that it is a "method"
It works in Java and C# to name a few. I don't see why it wouldn't work in PHP. The function keyword is redundant in a class.
Arrow functions for methods: yes
omitting the function keys: hell yes
Multiline short closers: no, makes the difference between the 2 too subtle
Expression as default value: no, inject your dependencies.
dd() in core php: no. While really nice to always have available, it does _so much more_ than just dumping some data. Making it look pretty is just a bonus. The real strength lies within the frequency it gets updated and adjusted, and the amount of extra information it displays. It would simply not be a good fit in the core. Just write your own dd() if you don't want to install the Symfony dependency.
Native dd(); would be a quality of life addition. Yes for me.
Lets go!
For the short
public function xxx(): type => 'something';
proposal I would preffer to maintain PHP naming and more familiar structure and propose something more like
public function xxxx(): type return 'something';
more like a
if(bool) return;
style.
I agree. It's less code and the scoping is single line, so it shouldn't be a problem.
Inline expressions in promoted properties would be a game changer, imho, otherwise you have to somewhat repeat the process in the constructor body, making the promoted property kind of a chore. I simply don't understand how out of all of those features you want that the least lmao.
"Looks crazy"... new getters/setters look crazy dawg. "Too much logic in constructor" -> there will be too much logic if you do it the conventional way in the constructor body.
But I like my function keyword, I think Nuno wants to rewrite PHP to js 😂
ahahha
Default x debug or another thing in php
I dont like those changes. Make a pretty and readable language just shittier, for no discernible benefit. dd also feels outside the scope of a build in language command.
Diddy is not coming to PHP.
Lol 😂😂