@@ -551,6 +551,44 @@ private function compareFunctions(Node\FunctionLike $old, Node\FunctionLike $new
551
551
if (count ($ old ->getParams ()) !== count ($ new ->getParams ())) {
552
552
return $ this ->stmtDiff ($ old , $ new , $ updateTo );
553
553
}
554
+ $ oldAttribGroups = $ old ->getAttrGroups ();
555
+ $ newAttribGroups = $ new ->getAttrGroups ();
556
+ if (count ($ oldAttribGroups ) !== count ($ newAttribGroups )) {
557
+ return $ this ->stmtDiff ($ old , $ new , $ updateTo );
558
+ }
559
+ foreach ($ oldAttribGroups as $ groupN => $ oldGroups ) {
560
+ $ oldAttribs = $ oldGroup ->attrs ;
561
+ $ newAttribs = $ newAttribGroups [$ groupN ]->attrs ;
562
+ if (count ($ oldAttribs ) !== count ($ newAttribs )) {
563
+ return $ this ->stmtDiff ($ old , $ new , $ updateTo );
564
+ }
565
+ foreach ($ oldAttribs as $ attribIdx => $ oldAttrib ) {
566
+ $ newAttrib = $ newAttribs [$ attribIdx ];
567
+ if ($ oldAttrib ->name ->name !== $ newAttrib ->name ->name ) {
568
+ return $ this ->stmtDiff ($ old , $ new , $ updateTo );
569
+ }
570
+ $ oldArgs = $ oldAttrib ->args ;
571
+ $ newArgs = $ newAttrib ->args ;
572
+ if (count ($ oldArgs ) !== count ($ newArgs )) {
573
+ return $ this ->stmtDiff ($ old , $ new , $ updateTo );
574
+ }
575
+ foreach ($ oldArgs as $ argIdx => $ oldArg ) {
576
+ $ newArg = $ newArgs [$ argIdx ];
577
+ if ($ oldArg ->name !== null && $ newArg ->name !== null ) {
578
+ if ($ oldArg ->name ->name !== $ newArg ->name ->name ) {
579
+ return $ this ->stmtDiff ($ old , $ new , $ updateTo );
580
+ }
581
+ } elseif ($ oldArg ->name !== null || $ newArg ->name !== null ) {
582
+ return $ this ->stmtDiff ($ old , $ new , $ updateTo );
583
+ }
584
+ $ oldArgValue = $ this ->printer ->prettyPrintExpr ($ oldArg ->expr );
585
+ $ newArgValue = $ this ->printer ->prettyPrintExpr ($ newArg ->expr );
586
+ if ($ oldArgValue !== $ newArgValue ) {
587
+ return $ this ->stmtDiff ($ old , $ new , $ updateTo );
588
+ }
589
+ }
590
+ }
591
+ }
554
592
555
593
foreach ($ old ->getParams () as $ i => $ oldParam ) {
556
594
$ newParam = $ new ->getParams ()[$ i ];
0 commit comments