Skip to content

Conversation

@lukasbestle
Copy link
Member

Describe the PR

The RegEx that was used for matching the parts of the query didn't account for nested method calls, so they only sometimes worked by accident.

E.g. this worked before:

object.method('test', object.method('test'))

But this didn't:

object.method('test', object.method('test').anotherMethod, 'test')

This is now fixed by always parsing method calls from the outside in and not from left to right. The only edge-case that doesn't work is an opening parenthesis inside a string:

object.method(object.method('('))

That's hard to fix however because it's hard to express that in a regular expression. However I think that this is not going to affect many queries in practice, so this PR is "a lot better than nothing". Maybe we'll find a solution for that last remaining edge-case in the future.

Related issues

Ready?

  • Added unit tests for fixed bug/feature
  • Passing all unit tests
  • Fixed code style issues with CS fixer and composer fix
  • Added in-code documentation (if needed)

@lukasbestle lukasbestle added this to the 3.4.0 milestone Jun 13, 2020
@lukasbestle lukasbestle self-assigned this Jun 13, 2020
@lukasbestle lukasbestle linked an issue Jun 13, 2020 that may be closed by this pull request
@bastianallgeier bastianallgeier self-requested a review June 23, 2020 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Query has unexpected behavior with add()

3 participants