Since version 2.2.0 of doctrine/collection, the constant Doctrine\Common\Collections\Criteria is deprecated in favor of new enum \Doctrine\Common\Collections\Order.
But this enum should only be used in invocations of Doctrine\Common\Collection\Criteria::orderBy method call. Other calls (in attributes, or for the same method name on object instantiating another class) should not be changed: the string 'ASC' and 'DESC' should be kept elsewhere.
This PR refactor the rule which, previously, replaced all the 'ASC' and 'DESC' by the Criteria::ASC|DESC.
After this MR:
all invocation of class constant Criteria::ASC and Criteria::DESC are replaced by, respectively, the string "ASC" ans "DESC";
in the method invocation Criteria::orderBy, the usage of the "ASC" (lowercase or uppercase), "DESC" (lowercase or uppercase), Criteria::ASC, Criteria::DESC is replaced by the new enum Order::Ascending, Order::Descending;
the rule is added to the new ruleset for Collection 2.2;
The previous rule, which changed the usage of the string "ASC" (lowercase or uppercase) or "DESC" (lowercase or uppercase) by the usage of Criteria::ASC and Criteria::DESC is, obviously, removed.
Since version 2.2.0 of
doctrine/collection
, the constantDoctrine\Common\Collections\Criteria
is deprecated in favor of new enum\Doctrine\Common\Collections\Order
.But this enum should only be used in invocations of
Doctrine\Common\Collection\Criteria::orderBy
method call. Other calls (in attributes, or for the same method name on object instantiating another class) should not be changed: the string'ASC'
and'DESC'
should be kept elsewhere.This PR refactor the rule which, previously, replaced all the
'ASC'
and'DESC'
by theCriteria::ASC|DESC
.After this MR:
Criteria::ASC
andCriteria::DESC
are replaced by, respectively, the string"ASC"
ans"DESC"
;Criteria::orderBy
, the usage of the"ASC"
(lowercase or uppercase),"DESC"
(lowercase or uppercase),Criteria::ASC
,Criteria::DESC
is replaced by the new enumOrder::Ascending
,Order::Descending
;The previous rule, which changed the usage of the string
"ASC"
(lowercase or uppercase) or"DESC"
(lowercase or uppercase) by the usage ofCriteria::ASC
andCriteria::DESC
is, obviously, removed.Comments and documentation supporting this change
Closes https://github.com/rectorphp/rector-doctrine/issues/325
EDIT list the changes in a more understandable (?) way.