Changes in namespace importing

From: Date: Fri, 24 Nov 2017 07:05:52 +0000
Subject: Changes in namespace importing
Groups: php.internals 
Request: Send a blank email to internals+get-101150@lists.php.net to get a copy of this message
We use 'use' keyword to import other namespaces, namespace classes, namespace functions, and namespace constants. Example 1) use abc; (Import abc namespace) 2) use abc\ClassB; (Import ClassB from abc namespace) 3) use function abc\sayhello; (Import sayhello function from abc namespace) 4) use const abc\name; (Import name constant from abc namespace) In (1) we are importing whole namespace and in (2) we are just importing class. But there is no difference in syntax like when we import function we use 'use function'. We should change (2) to 'use class abc\ClassB'. It will make syntax more clear and remove any confusion and also match with other syntax like use function and use const. Current syntax will also work so there will be no backward compatibility break.

« previous php.internals (#101150) next »