Replies: 1 comment
-
AFAIK, It's instead calling a function named "Class" with no argument, and then on its returned value (assumed to be an object) calls a "chainMethod" method. The return value of "chainMethod" is then treated as the name of a class to instantiate (i.e. call its constructor). That said, yes. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
We've discussed this on IRC, but I'll put it here as a reminder as I'm sure you're busy.
Constructors should return void, this can be observed in two ways quite easily.
__construct()
method manually, you do not get an instance of the object.new Class()->chainMethod()
it will not work, if it returned self, it'd be instantly chainable. However, if you try(new Class())->chainMethod()
it will work as that's essentially the same as assigning it to a variable, except without the lingering pointer.Related JetBrains Topic
Beta Was this translation helpful? Give feedback.
All reactions