[PHP-DEV] [RFC] use-from syntax for namespace use declarations

Hello internals,

I am writing to open the discussion for the RFC “use-from syntax for namespace use declarations”:
https://wiki.php.net/rfc/use-from

This proposal introduces an alternative syntax for namespace imports:

use Name from Prefix;
use {A, B} from Prefix;

This form is purely syntactic sugar for the traditional use Prefix\Name; syntax. The primary motivation is to improve readability and ergonomic sorting of imports by placing the imported symbol name first (e.g. use User from App\Models), similar to import styles in other languages like Python or JavaScript.

The implementation introduces from as a contextual keyword in use declarations, ensuring backward compatibility for existing uses of from as method names or identifiers.

You can find the proof-of-concept implementation here:
https://github.com/php/php-src/pull/20844

I look forward to your thoughts and feedback.

Best regards,
Stuardo Rodríguez
str@maphpia.com

···

Stuardo Rodríguez Mercenary Web Developer La Maphpia
:globe_showing_americas: maphpia.com :envelope: str@maphpia.com :telephone_receiver: +502 3462-7169