The error you're encountering is related to a deprecated PHP feature in the Laravel Valet codebase. This is likely due to using a version of PHP that is not yet fully supported by Valet. Here are some steps you can take to resolve this issue:
-
Check PHP Version Compatibility: Ensure that the version of PHP you are using is compatible with Laravel Valet. As of my last update, PHP 8.4 does not exist, so you might be using a version that is not officially released or supported. Consider downgrading to a stable version like PHP 8.1 or 8.0.
-
Switch PHP Versions: Use Homebrew to switch to a different PHP version. You can do this by unlinking the current version and linking a different one. For example, to switch to PHP 8.1:
brew unlink php brew install [email protected] brew link --force --overwrite [email protected] -
Update Composer and Valet: Make sure you have the latest versions of Composer and Laravel Valet. Run the following commands to update them:
composer global update -
Reinstall Valet: If the issue persists, try reinstalling Valet:
composer global remove laravel/valet composer global require laravel/valet valet install -
Check for Valet Updates: Sometimes, the issue might be resolved in a newer version of Valet. Check the Valet GitHub repository for any updates or patches that address this issue.
-
Modify the Code (Temporary Fix): If you're comfortable with PHP, you can temporarily modify the
find-usable-php.phpfile to explicitly declare the nullable type. However, this is not recommended for long-term use as it might break with future updates.
If none of these solutions work, consider checking the Laravel Valet GitHub issues page or forums for any similar issues and potential fixes.