[php-src] PR #20844: Feature/use from

From: Date: Tue, 06 Jan 2026 01:48:35 +0000
Subject: [php-src] PR #20844: Feature/use from
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-34460@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/20844 Author: str The use ... from ... form makes it easier to scan and (optionally) sort import lists by imported symbol (class/function/const) rather than by namespace prefix. Placing the symbol immediately after use makes symbol-first ordering straightforward for humans and formatters, while projects that prefer namespace-first ordering can continue to do so. Example (symbol-first ordering): ```php use Carbon from Illuminate\Support; use Inertia from Inertia; use SettingService from App\Services; use Status from App\Models; use Task from App\Models; use TaskCreated from App\Events; use TaskRepository from App\Repositories; use TaskService from App\Services; use TaskUpdated from App\Events; use TaskUpdateData from App\DTOs; use User from App\Models; use ZipArchive; ``` This RFC is pure syntax sugar (no runtime behavior change). The design is intentionally localized: the only notable compatibility surface is the introduction of a contextual/soft keyword token for from in use declarations. Adding new syntax to PHP requires a clear and strong justification. The use ... from form meets that bar by reducing cognitive friction for developers who regularly move between languages that already use a similar form (e.g., JavaScript's import X from 'Y' and Python's from Y import X). Making PHP imports resemble these familiar patterns helps onboarding and code review across mixed-language teams and makes the import semantics immediately recognizable to a wider audience. The combination of improved cross-language familiarity, better symbol-first sorting ergonomics, and low implementation risk provides a compelling rationale for adoption.

« previous php.git-pulls (#34460) next »