Skip to content

Commit

Permalink
Follow recommendation about multiline type
Browse files Browse the repository at this point in the history
Apparently, there is consensus about multiline types between:

- PHPStan
- Psalm
- Slevomat Coding Standard

See slevomat/coding-standard#1586 (comment)

Using parenthesis is less ambiguous, it makes it clear to the parser
where the type begins and where it ends.

The change has a positive impact on the Psalm baseline, showing
that psalm-return annotation was not really understood previously.
  • Loading branch information
greg0ire committed Jun 28, 2023
1 parent 4aadba6 commit c9c5157
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
5 changes: 2 additions & 3 deletions lib/Doctrine/ORM/Query/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -2566,16 +2566,15 @@ public function ConditionalPrimary()
* EmptyCollectionComparisonExpression | CollectionMemberExpression |
* InstanceOfExpression
*
* @return AST\Node
* @psalm-return AST\BetweenExpression|
* @return (AST\BetweenExpression|
* AST\CollectionMemberExpression|
* AST\ComparisonExpression|
* AST\EmptyCollectionComparisonExpression|
* AST\ExistsExpression|
* AST\InExpression|
* AST\InstanceOfExpression|
* AST\LikeExpression|
* AST\NullComparisonExpression
* AST\NullComparisonExpression)
*/
public function SimpleConditionalExpression()
{
Expand Down
9 changes: 0 additions & 9 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2008,19 +2008,10 @@
<code>$factors[0]</code>
<code>$primary</code>
<code>$terms[0]</code>
<code><![CDATA[$this->CollectionMemberExpression()]]></code>
<code><![CDATA[$this->ComparisonExpression()]]></code>
<code><![CDATA[$this->EmptyCollectionComparisonExpression()]]></code>
<code><![CDATA[$this->ExistsExpression()]]></code>
<code><![CDATA[$this->InExpression()]]></code>
<code><![CDATA[$this->InstanceOfExpression()]]></code>
<code><![CDATA[$this->LikeExpression()]]></code>
<code><![CDATA[$this->NullComparisonExpression()]]></code>
</InvalidReturnStatement>
<InvalidReturnType>
<code>AST\ArithmeticFactor</code>
<code>AST\ArithmeticTerm</code>
<code>AST\BetweenExpression|</code>
<code>AST\SimpleArithmeticExpression|AST\ArithmeticTerm</code>
</InvalidReturnType>
<InvalidStringClass>
Expand Down

0 comments on commit c9c5157

Please sign in to comment.