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

Change $loop visibilty to allow inheritance use #27

Closed
wants to merge 1 commit into from

Conversation

Maxooo
Copy link

@Maxooo Maxooo commented Oct 14, 2015

It should be nice to have access to the loop variable in a child class that extends the Server one.

It should be nice to have access to the loop variable in a child class that extends the Server one.
@cboden
Copy link
Member

cboden commented Oct 14, 2015

This can be achieved via constructor overloading without having to change the React code base:

class MyServer extends \React\Socket\Server {
    private $loop;

    public function __construct(\React\EventLoop\LoopInterface $loop) {
        $this->loop = $loop;
        parent::__construct($loop);
    }
}

@cboden cboden closed this Oct 14, 2015
@Maxooo
Copy link
Author

Maxooo commented Oct 14, 2015

@cboden First of all thank you for your quick answer. This is exactly what I''ve done, but it looks more like a workaround than a real solution. I mean, "protected" visibility exists to avoid this kind of practice and make life and coding easier =)

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.

None yet

2 participants