assertEquals( expected, actual, … ); assertSame( expected, actual, … );
This Yoda-conditional order is confusing and very frequently done incorrectly.
This is hard to catch in code review, as no matter how many times I fix it, it still "feels" right everytime I see it. (Selective memory loss?)
While it's hard to catch 100% of the cases where this is done incorrectly (e.g. if both are a variable), it is fairly easy to detect the majority of cases, which is where one of them is a literal.
assertSame( 42, $something ); # right assertSame( $something, 42 ); # wrong
We already do this for QUnit assertions (which btw, take their arguments in the other way around) in our ESLint configuration. Would be nice to do this for PHPUnit/PHPCS as well.
If the test is passing, it works both ways, given $foo == $bar and $bar == $foo produce the same result. Where it falls apart is when the test is failing. There will be a diff of Expected/Actual which would be the wrong way around. And, especially when that diff is optimised to only show the parts that are wrong, this could also omit information you might want to see.