Hi, Internals!

I hope this message finds you well. I would like to respectfully propose
single-expression functions for PHP:
https://wiki.php.net/rfc/single-expression-functions

I've had extensive experience working with Kotlin, which offers a modern
approach to Java development and enables cleaner, more intuitive code.
Through this experience, I've encountered various concise syntax features,
and I believe one of them—single-expression functions—could be a valuable
addition to PHP.

I'm aware that Larry Garfield previously proposed a similar feature several
years ago, though it unfortunately didn't pass the voting stage. I would
like to respectfully suggest that using "=" instead of "=>" to separate
declaration and implementation might be a better approach.

I believe this proposal aligns well with PHP's current modernization
efforts and the ongoing initiative to simplify various language constructs.
PHP has been consistently improving developer experience through features
like property promotion, arrow functions, the nullsafe operator,
getters/setters, and other syntax enhancements. This single-expression
function syntax would be a natural continuation of this trend, further
streamlining the developer workflow and making PHP more pleasant to write.

The primary motivation is to help streamline "data classes" by eliminating
the need for "{", "return", and "}", which can sometimes account for up to
30% of the code in such classes. This improvement would be particularly
timely as it directly enhances developer experience—a key focus of PHP's
recent evolution.

I would greatly appreciate your thoughts and feedback on this proposal, and
I'm looking forward to engaging in constructive discussion with the
community.

Thank you for your time and consideration.

---
Dmitriy Derepko

Reply via email to