We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
A compact assignment syntax for member initialization in constructors and methods will be added.
Less $this.member= $member; typing - especially in value objects.
$this.member= $member;
The $this.member notation is used to describe the argument passed to this parameter will end up in the member variable named member.
$this.member
public class Person { protected string $name; public __construct($this.name) { } } // Equivalent of public class Person { protected string $name; public __construct(string $name) { $this.name= $name; } }
This notation may be combined with regular parameters:
public class Person { protected static int $nextId= 0; protected int $id; protected string $name; public __construct($this.name, int $id= -1) { $this.id= -1 === $id ? ++self::$nextId : $id; } }
n/a
None, resolved during compile time.
The text was updated successfully, but these errors were encountered:
+1 Less typing = more fun!
Sorry, something went wrong.
No branches or pull requests
Scope of Change
A compact assignment syntax for member initialization in constructors and methods will be added.
Rationale
Less
$this.member= $member;
typing - especially in value objects.Functionality
The
$this.member
notation is used to describe the argument passed to this parameter will end up in the member variable named member.This notation may be combined with regular parameters:
Security considerations
n/a
Speed impact
None, resolved during compile time.
Dependencies
n/a
Related documents
The text was updated successfully, but these errors were encountered: