Skip to content
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

[1.x] Adds support for first class callable syntax #33

Merged
merged 1 commit into from
Jan 27, 2022

Conversation

nunomaduro
Copy link
Member

@nunomaduro nunomaduro commented Jan 27, 2022

This pull request adds support for first class callable syntax.

Because the first class callable syntax result does not "look" like a regular closure when serialised, this pull request attempts to transform the result of the code to a regular closure. Let me show you some examples:

// Assuming...
class Person {
    public function getName1() {}
    final public function getName2() {}
    public static function getName3() {}
}

// Assuming the following syntax, used within the Person class...
$1 = $this->getName1(...);
$2 = $this->getName2(...);
$2 = $this->getName3(...);

// The variables `$1`, `$2` and `$3`, when serialised / deserialised:
$1 = function () {} // bound to Person instance
$2 = function () {} // bound to Person instance
$3 = static function () {} // statically bound to Person instance

Fixes #32.

@taylorotwell taylorotwell merged commit e4970ee into master Jan 27, 2022
@taylorotwell taylorotwell deleted the feat/first-class-callable-syntax branch January 27, 2022 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exception: call to a member function bindTo() on null
2 participants