Sort route keys in reverse length order before replacing to prevent incorrect matching
Added a test case
Removed comparison method
Fixed key sorting
Use array_keys instead of array_flip
Test if keys are empty before sorting
Made it slightly neater
Fixed PHPCS error
Changed if statement to force Travis rebuild
Merge pull request #2991 from mikegibson/route_params

Fixed incorrect replacement of route elements beginning with same string