tighten / onramp

Easing the onramp for new or non-PHP developers to become Laravel devs.
https://onramp.dev/
MIT License
157 stars 56 forks source link

Laravel 10.x Shift #554

Closed tammytee closed 1 year ago

tammytee commented 1 year ago

This pull request includes the changes for upgrading to Laravel 10.x. Feel free to commit any additional changes to the shift-83296 branch.

Before merging, you need to:

If you need help with your upgrade, check out the Human Shifts. You may also join the Shifty Coders Slack workspace to level-up your Laravel skills.

tammytee commented 1 year ago

:warning: Early versions of Laravel 9 included a lang/en.json file containing password validation messages. However, this file was quickly removed in favor of keeping this with the other validation rules within validation.php.

Shift detected your version differed from the default Laravel version. If you have customized the password validation messages, you should merge them with the password messages in validation.php and remove lang/en.json.

tammytee commented 1 year ago

:x: Shift could not upgrade the following files since they differed from the default Laravel version. You will need to compare these files against the default Laravel 10 versions and merge any changes:

tammytee commented 1 year ago

:warning: Shift upgraded your configuration files by defaulting them and merging your true customizations. These include values which are not changeable through core ENV variables.

You should review this commit for additional customizations or opportunities to use new ENV variables. If you have a lot of customizations, you may undo this commit with git revert 051f0681 and make the config file changes manually.

tammytee commented 1 year ago

:information_source: Shift updated your dependencies for Laravel 10. While many of the popular packages are reviewed, you may have to update additional packages in order for your application to be compatible with Laravel 10. Watch dealing with dependencies for tips on handling any Composer issues.

The following dependencies were updated by a major version and may have their own changes. You may check their changelog for any additional upgrade steps.

tammytee commented 1 year ago

:information_source: Laravel 9 adopted anonymous migrations. Shift automated this change to align with modern Laravel conventions and avoid naming migrations.

tammytee commented 1 year ago

:information_source: Laravel renamed the password_resets table to password_reset_tokens. While an optional change, Shift detected you have a migration for this table and created a migration to rename it as well as updated the reference in your config/auth.php file. Be sure to run php artisan migrate to complete your upgrade.

tammytee commented 1 year ago

:warning: Laravel 10 has added a return type of array to the Event broadcastOn and Notification via methods. However, you may still return a single channel from these methods.

Shift added the array return type to these methods in the following classes. You should review them to ensure you are returning an array, or remove the return type.

tammytee commented 1 year ago

:information_source: Laravel 10 added PHP type hints to all user-land code included in a new Laravel application. In an effort to modernize your code, Shift added type hints to any method which is used by Laravel, as well as any method which had types defined in its PHP DocBlock.

tammytee commented 1 year ago

:information_source: Now with type hints in your code, defining types within PHP DocBlocks is redundant. Laravel has removed all of the @param and @return tags from its DocBlocks where types are defined with PHP. Similarly, Shift removed these tags from any DocBlock where the code now has equivalent type hints.

tammytee commented 1 year ago

:information_source: Shift understands developers have different preferences when it comes to type hints. All of Shift's automation is done in nice, atomic commits. This makes it easier to undo any of the changes Shift makes.

If you wish to undo any of these changes, you may first revert the DocBlock changes by running git revert defb327. Then undo the added type hints by running git revert 286d73b.

tammytee commented 1 year ago

:information_source: All of the underlying Symfony components used by Laravel have been upgraded to Symfony 6.2. Shift detected references to Symfony classes within your application. You should review the Symfony change log for any additional changes.

tammytee commented 1 year ago

:warning: Laravel 10 requires Composer 2.2 or higher. You should verify the Composer version in your environments by running composer --version to ensure it meets this new requirement. If necessary, run composer self-update to update Composer.

tammytee commented 1 year ago

:tada: Congratulations, you're now running the latest version of Laravel!

Next, you may optionally run the following Shifts to ensure your application is fully upgraded, adopts the latest Laravel conventions, and easier to maintain in the future:

You may also use the Shift Workbench to automate common tasks for maintaining your Laravel and PHP applications.

tammytee commented 1 year ago

:x: PHP syntax errors were detected after running your Shift. Often these are simply differences between the PHP version on the Shift server (8.1) and your project. Occasionally they are misplaced lines or duplicate import statements.

You may quickly check the PHP syntax locally by running php -l on the following files: