TypedExpressionToExpressionWithReturnTypeRector

Change deprecated TypedExpression to ExpressionWithReturnType, returning the DBAL type name instead of the Type instance

-use Doctrine\DBAL\Types\Type;
 use Doctrine\DBAL\Types\Types;
 use Doctrine\ORM\Query\AST\Functions\FunctionNode;
-use Doctrine\ORM\Query\AST\TypedExpression;

-class MyFunction extends FunctionNode implements TypedExpression
+class MyFunction extends FunctionNode implements \Doctrine\ORM\Query\AST\ExpressionWithReturnType
 {
-    public function getReturnType(): Type
+    public function getReturnTypeName(): string
     {
-        return Type::getType(Types::INTEGER);
+        return Types::INTEGER;
     }
 }

Configure your rector.php:

<?php

use Rector\Config\RectorConfig;
use Rector\Doctrine\Orm38\Rector\Class_\TypedExpressionToExpressionWithReturnTypeRector;

return RectorConfig::configure()
    ->withRules([
        TypedExpressionToExpressionWithReturnTypeRector::class,
    ]);
PACKAGE:  doctrine/orm >=3.8 <6.0

Other rules in the doctrine/orm set