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

don't let GoAOP upgrade #149

Closed
wants to merge 1 commit into from

Conversation

JoeVieira
Copy link

@JoeVieira JoeVieira commented Mar 8, 2018

This PR is a proposal to limit the updating of goaop/framework so that the AST streaming issues

which are not totally resolved in 2.2.

I'd be happy to fix this the "right way" with AOP tokenStreams, but it doesn't look like that code has settled down yet in 2.2, so it seems like wasted effort.

…& would require a lot of updates to AspectMock to fix.
@JoeVieira JoeVieira closed this Mar 8, 2018
@JoeVieira JoeVieira reopened this Mar 8, 2018
@JoeVieira
Copy link
Author

So this fails travis, because it seems that phpunit, etc isn't a composer requirement?

Please advise how I can address the failure, I'd love to make sure this project is kept stable and maintained. Happy to help in anyway.

@lisachenko
Copy link
Contributor

@JoeVieira Hi, maybe it will be better to find out, why AspectMock won't work anymore with GoAOP 2.2? I think it's more correct way, because master version of GoAOP (aka 3.x) is based on 2.2.0 version. So, you will lock all new updates and fixes in base dependency.

I have a guess, that this is due to the old format of transformer class. New version of transformers should return status about transformation whether current file was processed or not, or it has changes, but they could be dropped if all other transformers vote to keep file as-is.

Here is a line: https://github.com/Codeception/AspectMock/blob/master/src/AspectMock/Intercept/BeforeMockTransformer.php#L90

And here are result codes that transformers should return now: https://github.com/Codeception/AspectMock/blob/master/src/AspectMock/Intercept/BeforeMockTransformer.php#L90

Probably returning self::RESULT_TRANSFORMED for each file will fix AspectMock, but there will be deprecation errors about accessing source code via string instead of AST. So, need to rework this transformer to use AST and doing it's job for functions.

@JoeVieira
Copy link
Author

JoeVieira commented Mar 9, 2018

@lisachenko I agree about that, but from the comments in GoAOP regarding this, it seemed to indicate that there was still a state of flux around the AST transformations, so I didn't want to embark on a refactor without that being solidified.

Especially as the public interface is what has changed in GoAOP.

As I said in the description of the PR, I think this is just a hack, and I'll be happy to fix it correctly, once GoAOP has the public interface to StreamMetaData settled out.

i.e setSource isn't adjusting the AST, which you've got marked as a todo: https://github.com/goaop/framework/blob/master/src/Instrument/Transformer/StreamMetaData.php#L154

FYI: Your examples referenced the same two lines.

@JoeVieira
Copy link
Author

@DavertMik or anyone else have thoughts on this?

AspectMock is currently broken due to this issue.

@AMRoche
Copy link

AMRoche commented Mar 16, 2018

@JoeVieira - I've just encountered this issue, and resolved it by modifying my own devDependencies in my project's composer file (not the AspectMock one).

Including your change before the include for AspectMock resolves this, as the version your change suggests is also covered by AspectMock's composer file.

@lisachenko
Copy link
Contributor

I have submitted PR with update to the newest GoAOP, please check it in #150

@DavertMik
Copy link
Member

Yes, PR #150 accepted, a new version is about to be released

@DavertMik DavertMik closed this Mar 20, 2018
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.

4 participants