@@ -67,6 +67,44 @@ public function betweenNonLiteralString3(EntityManagerInterface $em): void
67
67
assertType ('string ' , $ result );
68
68
}
69
69
70
+ public function countDistinctLiteralString (EntityManagerInterface $ em ): void
71
+ {
72
+ $ result = $ em ->createQueryBuilder ()->expr ()->countDistinct ('A ' , 'B ' , 'C ' );
73
+ assertType ("'COUNT(DISTINCT A, B, C)' " , $ result ); // A ConstantStringType isLiteralString
74
+ }
75
+
76
+ public function countDistinctNonLiteralString1 (EntityManagerInterface $ em ): void
77
+ {
78
+ $ value = $ this ->nonLiteralString ('A ' );
79
+ $ result = $ em ->createQueryBuilder ()->expr ()->countDistinct ($ value );
80
+ assertType ('string ' , $ result );
81
+ }
82
+
83
+ public function countDistinctNonLiteralString2 (EntityManagerInterface $ em ): void
84
+ {
85
+ $ value = $ this ->nonLiteralString ('A ' );
86
+ $ result = $ em ->createQueryBuilder ()->expr ()->countDistinct ($ value , 'B ' , 'C ' );
87
+ assertType ('string ' , $ result );
88
+ }
89
+
90
+ // Disabled until Doctrine ORM 3.0.0, as the countDistinct() function definition does not use `countDistinct(...$x)`
91
+ // https://github.com/doctrine/orm/pull/9911
92
+ // https://github.com/phpstan/phpstan-doctrine/pull/352
93
+ //
94
+ // public function countDistinctNonLiteralString3(EntityManagerInterface $em): void
95
+ // {
96
+ // $value = $this->nonLiteralString('B');
97
+ // $result = $em->createQueryBuilder()->expr()->countDistinct('A', $value, 'C');
98
+ // assertType('string', $result);
99
+ // }
100
+ //
101
+ // public function countDistinctNonLiteralString4(EntityManagerInterface $em): void
102
+ // {
103
+ // $value = $this->nonLiteralString('C');
104
+ // $result = $em->createQueryBuilder()->expr()->countDistinct('A', 'B', $value);
105
+ // assertType('string', $result);
106
+ // }
107
+
70
108
// Might be a problem, as these do not return a 'literal-string'.
71
109
// As in, functions to support MOD() and ABS() return stringable value objects (Expr\Func).
72
110
public function isNullNonLiteralStringExprFunc (EntityManagerInterface $ em ): void
0 commit comments