pronskiy's avatar

Roman Pronskiy

pronskiy

Member since

1,138

Total Reputation

4

Total Arguments

10

Total Votes for Arguments

Arguments and votes

5

Every time I find myself typing new MyClass() and than returning back and adding those parentheses. It would be good to reduce this friction and make PHP coding flow smoother.

Share:
Read the RFC: new MyClass()->method() without parentheses pronskiy avatar
pronskiy
voted yes
3

Cleaner code

Share:
Read the RFC: new MyClass()->method() without parentheses tomsix avatar
tomsix
voted yes
10

Often, I add static methods to some classes in order to improve readability when I instantiate a new class; the ability of chaining methods directly to the constructor, without the unnecessary parenthesis boilerplate, would remove the need for that.

Share:
Read the RFC: new MyClass()->method() without parentheses reddalo avatar
reddalo
voted yes
3

It could be nice addition to creating DTOs objects in PHP with "virtual" properties:

readonly final class SomeDto
{
    public function __construct(
        public string $name,
        public string $surname,
        public string $fullName {
            get => ucfirst($this->name) . ' ' . ucfirst($this->surname);
        }
    ) {
    }
}

or even shorter version:

readonly final class SomeDto
{
    public function __construct(
        public string $name,
        public string $surname,
        public string $fullName => ucfirst($this->name) . ' ' . ucfirst($this->surname),
    ) {
    }
}
Share:
Read the RFC: Property Hooks bronek89 avatar
bronek89
voted yes
10

Thanks to readonly properties, I started relying more and more on properties alone. However, I actually often find the need for more fine-grained control over input and output, but adding methods feels so heavy-weight. Property hooks feels like the perfect solution for some of my use cases.

Share:
Read the RFC: Property Hooks Contributor brent avatar
brent
voted yes
17

In combination with Asymmetric visibility this will allow to replace all getters and setters with trivial properties and occasional hooks.

Share:
Read the RFC: Property Hooks pronskiy avatar
pronskiy
voted yes
83

With First-class callable syntax available since 8.1, it would now be possible to write it as below, which is much better then string names of functions:

$result = "Hello World"
    |> htmlentities(...)
    |> str_split(...)
    |> fn($x) => array_map(strtoupper(...), $x)
    |> fn($x) => array_filter($x, fn($v) => $v != 'O');
Share:
Read the RFC: The Pipe Operator pronskiy avatar
pronskiy
voted yes
2

Similar concept exists in Kotlin, Swift (extend protocols), Java, C#, and other languages, and it has proven to be quite useful in those ecosystems.

Share:
Read the RFC: Interface Default Methods pronskiy avatar
pronskiy
voted yes
121

At least once a week, I throw away an array_map because it ended up looking too bloated and go with a classic foreach instead. Short Closures 2.0 without the use(...) block would've solved this problem, just 2 votes...

Share:
Read the RFC: Short Closures 2.0 davi avatar
davi
voted yes
39

Creating traits for default implementation is just a pain. I want syntactic sugar

Share:
Read the RFC: Interface Default Methods marc avatar
marc
voted yes
RSS Feed Contribute Watch on YouTube Our License
© 2024 RFC Vote. This project is open source. Contribute and collaborate with us!