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

Quick possible refactor? #1

Open
ghost opened this issue Jun 6, 2018 · 6 comments
Open

Quick possible refactor? #1

ghost opened this issue Jun 6, 2018 · 6 comments

Comments

@ghost
Copy link

ghost commented Jun 6, 2018

Love this example code!

Looking at: https://github.com/lzakrzewski/prooph-saga-playground/blob/master/src/Messaging/ReturnsPayload.php

Would it not be simpler to use get_object_vars($this); instead of the massive overhead of reflection?

@bweston92
Copy link

No because of use having to make private property members accessible.

@ghost
Copy link
Author

ghost commented Jun 6, 2018

It's being done via a trait in the implementing class though, so all properties will be visible in scope to get_object_vars surely?

@ghost
Copy link
Author

ghost commented Jun 6, 2018

I've just tested this and it is correct, as long as the trait is used in the highest most implementing class.

@bweston92
Copy link

It sure does, TIL :D

@lzakrzewski
Copy link
Owner

@johnrobertporter I've tested, get_object_vars($this) will work.

Please feel free to contribute!

@ghost
Copy link
Author

ghost commented Jun 7, 2018

A little later today :)

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

No branches or pull requests

2 participants