Problem/Motivation
We should follow coding standards and use proper camelCase for our method names: "Ids", not "IDs".
PHP is case-insensitive, so the code will work with or without this change. Anyone searching for getConnectionId with a case-sensitive search will miss getConnectionID, so fixing this will save some headaches. It is also possible that, at some point, we will do a bulk search-and-replace involving these method names.
The getConnectionId() method is defined in ConnectionUnitTest.php, but we should change it wherever it is used. Currently, I do not see any use outside of that test.
Proposed resolution
Search for all instances of the incorrect capitalization and replace them with the correct capitalization. Something like this should be effective:
grep -rni getConnectionId core | grep -v getConnectionId
grep -rni 'getConnectionId.*getConnectionId' core
For those less familiar with grep:
- The
-roption means to search recursively (insidecore/). - The
-noption asksgrepto show the line numbers. - The
-ioption means to ignore case, so search for all variants. - The
|(pipe) operator sends the output of the first command to the input of the second. - The
-voption inverts the results, filtering out any lines that match. - The second and fourth commands are there just in case there are lines that have the string more than once, and one of them has the correct capitalization. Any such lines would be missed by the first and third command.
Remaining tasks
User interface changes
None
API changes
None
Data model changes
None
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | cs-method-2960981-2.patch | 2.13 KB | jtriguero |
Comments
Comment #2
jtriguero commentedHi, here is the patch.
Comment #3
benjifisher@jtriguero: It looks as though this is your first contribution to Drupal core. Congratulations!
I ran the
grepcommands in the issue summary before and after applying the patch, with the expected results.I also viewed the patch with my text editor and checked that the only changes are replacing an incorrectly capitalized method name with a correctly capitalized one.
In short, it all looks good. Thanks!
Comment #4
jtriguero commentedThanks @benjifisher, I hope it will not be the last.
Comment #5
alexpottCrediting @benjifisher for creating the issue and reviewing the patch.
Comment #6
alexpottCommitted 927e9f0 and pushed to 8.6.x. Thanks!
Committed 426f811 and pushed to 8.5.x. Thanks!
Backported to 8.5.x since this is test only.