When learning to code, one of the most confusing things was using short variable names in documentation and other people's code.
$v instead of
$value within loops,
$i instead of
$e when working with Exceptions.
I've also seen slightly better names, such as
$idx for index or
$ctx for context.
But what does this achieve?
Why not write the full variable name and clarify what it refers to?
It would be easier to read and understand for anyone reading the code, including Junior Developers and people new to your team or application.
There are no limitations - at least in the languages I use - to force this, such as a maximum number of characters in a file, so why not write the full variable name?
The only reason I can think of is to save time by pressing fewer keys, but code is read more than written, so it should be optimised for readability.
Your tests and CI pipeline don't have a preference.
The people reading the code will.
P.S. Are you still using Drupal 7 and don’t know what’s involved to upgrade to Drupal 10? Book a Drupal 7 upgrade consultation call or an upgrade roadmap.