LoginSignup
15
15

More than 5 years have passed since last update.

PHP7調査(10)名前空間のuseをまとめて書けるようになった

Last updated at Posted at 2015-04-11

PHP7から、名前空間を使うときに複数のuseを中カッコでまとめて書くことができます。

具体的には次のように書けるようになりました。

<?php
use Symfony\Component\Console\{
    Input\InputInterface,
    Input\InputArgument,
    Input\InputOption,
    Output\OutputInterface,
    Output\ConsoleOutputInterface
};

これまで、特に大物ライブラリを使うときにuseが長大になる傾向があったので、これは良い変更ですね。

ちなみに中カッコのネストはできません。

参照

15
15
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
15
15