laravel new prints a Deprecated return-type warning from Symfony Process
Deprecated: Return type of Symfony\Component\Process\Process::getIterator(int $flags = 0)Short answer
This warning means the global Laravel installer is running an old copy of symfony/process on a newer PHP. PHP 8.1 and later warn when a class overrides an internal method without a matching return type. Update the installer and its dependencies with Composer, or reinstall it with the official script.
Fix it fast
1Find out which cause you have
See which versions of the installer and of symfony/process sit in Composer's global directory.
composer global show laravel/installer symfony/process php -v2Match what you see, then jump to its fix
What does the error look like?
Deprecated: Return type of Symfony\Component\Process\Process::getIterator(int $flags = 0)laravel new still creates the project, but prints the notice above first
Cause 1 of 2
The global installer carries an old symfony/process
1Check
PHP 8.1 and later emit a deprecation notice when a class overrides an internal method such as getIterator() without a compatible return type. An old copy of symfony/process in the global directory does exactly that.
composer global show symfony/process2Fix
Update the installer together with its dependencies, so Composer can move symfony/process to a release that works on your PHP.
composer global update laravel/installer --with-dependencies3Verify
Run laravel new again; the notice no longer prints.
laravel new example-appConfirmed by php.net
Cause 2 of 2
The installer was installed a long time ago and never updated
1Check
The Laravel docs install the installer with composer global require. A global package stays at the version it was installed at until you update it.
composer global outdated2Fix
Update it with the global command, or reinstall PHP, Composer and the installer through php.new, which the docs say can be re-run to update them.
composer global update laravel/installer3Verify
The installer prints its new version.
laravel --versionConfirmed by laravel.com
How do I stop it coming back?
- Run composer global update every few weeks, or re-run php.new, so global tools follow PHP.
- After every PHP upgrade, update the global Composer packages.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Back end
Composer says the gd extension is missing on a Laravel project
composer install or composer update stops on a package that requires ext-gd
Composer refuses to install a package that requires ext-gd when the PHP binary running Composer has no GD extension.
4 causes, each with a fixBack end
composer require maatwebsite/excel fails to install
Composer says the package needs an older PHP than the one installed
Composer refuses maatwebsite/excel when the PHP version or a PHP extension does not match what the package and PhpSpreadsheet need.
3 causes, each with a fixBack end
composer install says the lock file is not compatible and asks for update
Your lock file does not contain a compatible set of packages. Please run composer update.
composer install checked the locked packages against this machine's PHP and extensions and found a conflict.
3 causes, each with a fixBack end
composer require laravel/horizon fails: ext-pcntl is missing
laravel/horizon v1.1.0 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system
Horizon needs the pcntl extension, and Composer refuses to install it where PHP lacks that extension.
3 causes, each with a fixBack end
composer require laravel/passport stops with 'requirements could not be resolved'
... but these were not loaded, likely because it conflicts with another require.
Composer found no Passport release that fits your project at once.
4 causes, each with a fixBack end
Composer says the root composer.json requires a PHP version your PHP does not satisfy
Your requirements could not be resolved to an installable set of packages.
Composer compares the php constraint in your composer.json, or in a package, with the PHP that runs Composer.
3 causes, each with a fix