With Symfony I'm taking the habit of using the class name resolver ::class
(since php5.5):
use AppBundle\Entity\Product;
// ...
$resolver->setDefaults(array(
'data_class' => Product::class
));
instead of the FQN string:
$resolver->setDefaults(array(
'data_class' => 'AppBundle\Entity\Product'
));
I'm doing that for readability purpose and because it's handy to introscpect in some smart IDEs.
However, I'm seeing not so much examples of this practice in official docs. So I'm wondering if this is because of the compatibility concern (< php5.5) or because it would not be good to systematically import all the classes we need to reference.
My question is: Is it a good practice to use ::class
everywhere we need to reference a FQN ?