Symfony Bundles


从PHP7开始,可以使用单个use语句从同一个命名空间导入类,函数和常量,而不是使用多个use语句。

<?php
   // Before PHP 7
   use com\codingdict\ClassA;
   use com\codingdict\ClassB;
   use com\codingdict\ClassC as C;

   use function com\codingdict\fn_a;
   use function com\codingdict\fn_b;
   use function com\codingdict\fn_c;

   use const com\codingdict\ConstA;
   use const com\codingdict\ConstB;
   use const com\codingdict\ConstC;

   // PHP 7+ code
   use com\codingdict\{ClassA, ClassB, ClassC as C};
   use function com\codingdict\{fn_a, fn_b, fn_c};
   use const com\codingdict\{ConstA, ConstB, ConstC};

?>