@@ -393,7 +393,7 @@ class Criteria
393393 protected CombineOperatorManager $ filterOperatorManager ;
394394
395395 /**
396- * @var \Propel\Runtime\Util\PropelConditionalProxy|null
396+ * @var \Propel\Runtime\Util\PropelConditionalProxy<static> |null
397397 */
398398 protected $ conditionalProxy ;
399399
@@ -2273,15 +2273,20 @@ public function _and()
22732273 *
22742274 * @param mixed $cond Casts to bool for variable evaluation
22752275 *
2276- * @return \Propel\Runtime\ActiveQuery\Criteria|\Propel\Runtime\Util\PropelConditionalProxy
2276+ * @return static Actual return is static|PropelConditionalProxy<static>,
2277+ * but the proxy is transparent (delegates via __call),
2278+ * so we annotate as static for IDE/DX purposes.
22772279 */
22782280 public function _if ($ cond )
22792281 {
22802282 $ cond = (bool )$ cond ; // Intentionally not typing the param to allow for evaluation inside this function
22812283
22822284 $ this ->conditionalProxy = new PropelConditionalProxy ($ this , $ cond , $ this ->conditionalProxy );
22832285
2284- return $ this ->conditionalProxy ->getCriteriaOrProxy ();
2286+ /** @var static $queryOrProxy */
2287+ $ queryOrProxy = $ this ->conditionalProxy ->getCriteriaOrProxy ();
2288+
2289+ return $ queryOrProxy ;
22852290 }
22862291
22872292 /**
@@ -2292,7 +2297,9 @@ public function _if($cond)
22922297 *
22932298 * @throws \Propel\Runtime\Exception\LogicException
22942299 *
2295- * @return \Propel\Runtime\ActiveQuery\Criteria|\Propel\Runtime\Util\PropelConditionalProxy
2300+ * @return static Actual return is static|PropelConditionalProxy<static>,
2301+ * but the proxy is transparent (delegates via __call),
2302+ * so we annotate as static for IDE/DX purposes.
22962303 */
22972304 public function _elseif ($ cond )
22982305 {
@@ -2301,8 +2308,10 @@ public function _elseif($cond)
23012308 if (!$ this ->conditionalProxy ) {
23022309 throw new LogicException (__METHOD__ . ' must be called after _if() ' );
23032310 }
2311+ /** @var static $queryOrProxy */
2312+ $ queryOrProxy = $ this ->conditionalProxy ->_elseif ($ cond );
23042313
2305- return $ this -> conditionalProxy -> _elseif ( $ cond ) ;
2314+ return $ queryOrProxy ;
23062315 }
23072316
23082317 /**
@@ -2311,15 +2320,19 @@ public function _elseif($cond)
23112320 *
23122321 * @throws \Propel\Runtime\Exception\LogicException
23132322 *
2314- * @return \Propel\Runtime\ActiveQuery\Criteria|\Propel\Runtime\Util\PropelConditionalProxy
2323+ * @return static Actual return is static|PropelConditionalProxy<static>,
2324+ * but the proxy is transparent (delegates via __call),
2325+ * so we annotate as static for IDE/DX purposes.
23152326 */
23162327 public function _else ()
23172328 {
23182329 if (!$ this ->conditionalProxy ) {
23192330 throw new LogicException (__METHOD__ . ' must be called after _if() ' );
23202331 }
2332+ /** @var static $queryOrProxy */
2333+ $ queryOrProxy = $ this ->conditionalProxy ->_else ();
23212334
2322- return $ this -> conditionalProxy -> _else () ;
2335+ return $ queryOrProxy ;
23232336 }
23242337
23252338 /**
@@ -2328,7 +2341,9 @@ public function _else()
23282341 *
23292342 * @throws \Propel\Runtime\Exception\LogicException
23302343 *
2331- * @return \Propel\Runtime\ActiveQuery\Criteria|\Propel\Runtime\Util\PropelConditionalProxy
2344+ * @return static Actual return is static|PropelConditionalProxy<static>,
2345+ * but the proxy is transparent (delegates via __call),
2346+ * so we annotate as static for IDE/DX purposes.
23322347 */
23332348 public function _endif ()
23342349 {
@@ -2337,13 +2352,10 @@ public function _endif()
23372352 }
23382353
23392354 $ this ->conditionalProxy = $ this ->conditionalProxy ->getParentProxy ();
2355+ /** @var static $queryOrNestedProxy */
2356+ $ queryOrNestedProxy = $ this ->conditionalProxy ?->getCriteriaOrProxy() ?? $ this ;
23402357
2341- if ($ this ->conditionalProxy ) {
2342- return $ this ->conditionalProxy ->getCriteriaOrProxy ();
2343- }
2344-
2345- // reached last level
2346- return $ this ;
2358+ return $ queryOrNestedProxy ;
23472359 }
23482360
23492361 /**
0 commit comments