PHPORM-395: Fix autocompletion for compound search operators#2832
PHPORM-395: Fix autocompletion for compound search operators#2832alcaeus wants to merge 1 commit intodoctrine:2.12.xfrom
Conversation
|
I just verified that this fixes the autocompletion issue in PHPStorm. I understand why you didn't do this initially, as you shouldn't depend on an internal class in the API of a public class. Therefore, classes like NB: It seems we have a new range of errors to exclude from the phpstan analysis. |
Users shouldn't ever need to depend on those classes, unless they store the return value of somewhere within the chain, which I generally wouldn't recommend. No objection, I just don't think it's necessary.
Created #2833 to fix those separately. |
| */ | ||
| abstract protected function addOperator(SearchOperator $operator): SearchOperator; | ||
|
|
||
| /** return Autocomplete&CompoundSearchOperatorInterface */ |
There was a problem hiding this comment.
Just seen the missing @ before return.
|
Closing in favour of #2836. |
Summary
For some reason, PhpStorm didn't like the
@returnannotation on the method, which should've told it that the result of atext()operator is a specialTextinstance that allows calling other operators. To work around this, using the compounded classes is necessary, which is what's actually being returned. Since this effectively narrows the return type (as that class extends the original operator class but implements an extra interface) we can do this in the trait without running into issues.