nikic · GitHub

@nikic

Copy link Copy Markdown

Member

This does not yet implement the syntax variant without method body.

@liverbool

Copy link Copy Markdown

Where are the type-hints?
Why not just check declared property name with name of arguments and then auto assign to them?
To keep Type Hinting:

class Foo {
    public $bar;
    public function __construct(User $bar) {
        // auto matching `public $bar` with `User $bar` with the named.
        // this just one rule for user to keep in mind:
        // You MUST matching the name to auto assign by yourself.
    }
}

@nikic

Copy link Copy Markdown

Member Author

Where are the type-hints?

Typehints are where they always are. You can write __construct(User $this->user) {} for example.

Why not just check declared property name with name of arguments and then auto assign to them?

That would break backwards compatibility and would be too much implicit magic.

@MartinStepar

Copy link Copy Markdown

Awesome, where is the "Vote for" button? =)

@JanTvrdik

Copy link Copy Markdown

I hope this will make it to PHP 5.6.

@nikic

Copy link Copy Markdown

Member Author

Closing as the RFC was declined.

Closed

Read the original on github.com ↗