-
-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added support for PHP 8.0 promoted parameters #114
Added support for PHP 8.0 promoted parameters #114
Conversation
ac34d26
to
901f0aa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed this review in a 1-on-1 session: PHP 8.1 is currently a bit out of reach.
<?php
interface Bar {}
class Baz implements Bar {}
class Foo
{
public function __construct(
public Bar $bar = new Baz()
) {}
public function doThing(Bar $bar = new Baz()) {
return $bar;
}
}
var_dump(new Foo());
var_dump((new Foo)->doThing());
In practice, we should stop this patch at only supporting initializers (and visibility thereof), while we will skip new_in_initializers
for now ( https://wiki.php.net/rfc/new_in_initializers ) because reflection for it does not give us enough information about the default value yet.
We will likely need AST-based reflector for that, and we're far from that: at that point, this library will either need phasing out, or a full rewrite.
91c0a44
to
54c1b6b
Compare
a33b3dc
to
ed09e59
Compare
Signed-off-by: Michael Petri <[email protected]>
ed09e59
to
793d9dd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, excellent work, @michaelpetri!
Description
Adds support for promoted parameters
Solves (partially) #104