vbresults
Well-known member
I have some opinions on the syntax of the latest RC. If I understand correctly, it went from this:
To this:
To this:
To this:
For me, this is the best one because it's explicit, but at the same time, it's redundant:
Since PHP has late static binding, this would be the most streamlined -- there is no redundancy, and it obviates renaming the classes:
That said, I think it's cool that little things like this are being given attention.
PHP:
$userRepo = \XF::app()->repository('XF:User');
To this:
PHP:
$userRepo = \XF::app()->repository(\XF\Repository\User::class);
To this:
PHP:
$userRepo = \XF::repository(\XF\Repository\User::class);
To this:
PHP:
use XF\Repository\UserRepository;
$userRepo = \XF::repository(UserRepository::class);
For me, this is the best one because it's explicit, but at the same time, it's redundant:
PHP:
$userRepo = \XF::repository(\XF\Repository\User::class);
Since PHP has late static binding, this would be the most streamlined -- there is no redundancy, and it obviates renaming the classes:
PHP:
$userRepo = \XF\Repository\User::instance();
That said, I think it's cool that little things like this are being given attention.
Upvote
0