nicolasgrekas

nicolasgrekas

Contributor Directory

RFCs

Language and policy proposals from this contributor
RFCs are part of the process by which decisions are made about PHP. For more information about the RFC process as well as viewing a full list of RFCs please visit the RFC section.

Serializable closures, by reference to the code that declares them

Author
PHP 8.5 allowed closures inside constant expressions: anonymous static function () {} and first-class callables foo(...), in attribute arguments and parameter d...

Deprecate Fuzzy Type Casts and Allow Stringable in Strict Mode

Author
Target
8.6
PHP's type conversion system contains differences between explicit casts and scalar type checks. This RFC addresses two issues:

Nullable and Non-Nullable Cast Operators

Author
Target
8.6
PHP's type casting operators currently almost always convert values to the target type even if it cannot be represented from the original value. For example nul...

Lazy Objects

Author
Target
8.4
Transparent lazy-initialization of objects is an important part of many PHP applications. However, achieving this kind of laziness in userland is complex, limit...

Add lazy-objects as described to the engine

Yes
No
Yes
26 Votes (84%)
No
5 Votes (16%)

Readonly amendments

Author
Target
8.3
PHP 8.1 added support for readonly properties via PHP RFC: Readonly properties 2.0, and PHP 8.2 added support for readonly classes via PHP RFC: Readonly classes...

Should non-readonly classes be able to extend readonly-classes?

Yes
No
Yes
7 Votes (37%)
No
12 Votes (63%)

Should it be possible to reinitialize readonly properties during cloning?

Yes
No
Yes
26 Votes (100%)
No
0 Votes (0%)

Add Stringable interface

Author
Target
8.0
This RFC introduces a new Stringable interface that is automatically added to classes that implement the __toString() method.

Adopt the Stringable interface as proposed in this RFC?

Yes
No
Yes
29 Votes (76%)
No
9 Votes (24%)

__exists(), a magic method for distinguishing "missing" from "set to null"

Author
PHP's __isset() magic method has a structural ambiguity: it returns one bit but is asked two questions (does it exist? and is it non-null?). The language constr...

Add __exists() magic method?

Yes
No
Abstain
Yes
2 Votes (9%)
No
13 Votes (59%)
Abstain
7 Votes (32%)

Allow Reassignment of Promoted Readonly Properties in Constructor

Author
Readonly properties and Constructor Property Promotion (CPP) don't mix well: any post-processing forces opting out of CPP.

Allow Reassignment of Promoted Readonly Properties in Constructor?

Yes
No
Abstain
Yes
11 Votes (41%)
No
10 Votes (37%)
Abstain
6 Votes (22%)

Nullable Intersection types

Author
Intersection types as currently accepted for PHP 8.1 are not nullable. This RFC proposes to make them so.

Make intersection types nullable

Yes
No
Yes
12 Votes (32%)
No
26 Votes (68%)

Preferred syntax

"?" prefix
"|null" suffix
"?" prefix
6 Votes (17%)
"|null" suffix
29 Votes (83%)

Intersections should be

without brackets around
with brackets around
allow both styles
without brackets around
1 Votes (3%)
with brackets around
27 Votes (77%)
allow both styles
7 Votes (20%)

Access Scope from Magic Accessors

Author
When using magic methods to access actual properties, respecting their declared visibility is often desired. Yet, accessing the calling scope to emulate the vis...

Auto-implement Stringable for string backed enums

Author
The engine currently doesn't allow enums to implement Stringable. This RFC proposes that string-backed enums auto-implement Stringable, while still disallowing ...

Allow casting closures into single-method interface implementations

Author
This RFC proposes a new method for the Closure class called castTo(). This method would allow developers to create an instance of a class that implements a spec...

Allow Closures to Declare Interfaces they Implement

Author
This RFC proposes the addition of a syntax that allows closures to declare one or more interfaces they implement. This would provide developers with a more expl...

Structural Typing for Closures

Author
This RFC proposes to introduce structural typing for closures when used with interfaces containing only an __invoke() method. This feature aims to simplify the ...