final |
|---|
Locates the distributed turbo extension binary matching the current runtime
so it can be loaded via -d extension= — into spawned worker processes
(ProcessHelper), or into the restarted main process (the turbo row of
PHPStan\Process\Restart\ExtensionRegistry) whose pcntl_fork()ed workers then
inherit it.
The binaries are committed to the phpstan/phpstan repository next to phpstan.phar (turbo-ext/<platform>/phpstan_turbo-<minor>.so, .dll on Windows) by the phar.yml commit job, so they only exist for phar-based installations. Each is a thin per-PHP-version library loading the platform's shared core from its own directory (phpstan_turbo_core.so; phpstan_turbo_core.dll and phpstan_turbo_core-zts.dll on Windows, whose thread-safe PHP is a different DLL to link against), so both must be there — a source checkout loads its locally built extension through php.ini instead. Only non-debug builds for PHP >= MINIMUM_PHP_VERSION_ID are shipped; a ZTS variant (-zts filename suffix) exists for Windows, where XAMPP, WampServer and Scoop default to thread-safe PHP, and for Linux, where the official Docker images are thread-safe from 8.6 on (and the php:*-zts ones before) — a thread-safe PHP on macOS finds no binary and runs without the extension. Workers run the regular entrypoint, so TurboExtensionEnabler still gates activation on the expected extension version.
bin/phpstan loads this class before the Composer autoloader (for the process restart), so it must only call functions native to PHP 7.4 - the symfony polyfills are not registered yet. PreAutoloadFilesTest guards this.
| Methods | ||
|---|---|---|
public
static
|
findExtensionForWorkers(?string $pharPath = null): ?string
|
# |