Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Laravel 10.x Shift #941

Merged
merged 22 commits into from
Sep 7, 2023
Merged

Laravel 10.x Shift #941

merged 22 commits into from
Sep 7, 2023

Conversation

driesvints
Copy link
Member

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

Before merging, you need to:

  • Checkout the shift-80567 branch
  • Review all pull request comments for additional changes
  • Run composer update (if the scripts fail, add --no-scripts)
  • Clear any config, route, or view cache
  • Thoroughly test your application (no tests?, no CI?)

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.

Laravel 10 removed the deprecated methods and functions:
- `getQueryBase`
- `dispatchNow` and `dispatch_now`
- `assertTimesSent`
- `Redirect::home()`
In an effort to make upgrading the constantly changing config files
easier, Shift defaulted them and merged your true customizations -
where ENV variables may not be used.
@driesvints
Copy link
Member Author

driesvints commented Feb 13, 2023

❌ 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:

  • app/Http/Middleware/Authenticate.php

@driesvints
Copy link
Member Author

⚠️ 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 5868c4e4 and make the config file changes manually.

@driesvints
Copy link
Member Author

driesvints commented Feb 13, 2023

ℹ️ 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.

@driesvints
Copy link
Member Author

ℹ️ 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.

@driesvints
Copy link
Member Author

ℹ️ 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.

@driesvints
Copy link
Member Author

ℹ️ Shift understand 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 899f19c3. Then undo the added type hints by running git revert 36fec152.

@driesvints
Copy link
Member Author

⚠️ In Laravel 10 you may no longer directly cast a DB:raw() expression to a string. Instead, you must retrieve the value from the expression using the getValue() method.

Shift detected calls to DB::raw(). You should review these instances to see if you are casting the result to a string.

  • app/Models/Thread.php

@driesvints
Copy link
Member Author

ℹ️ 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.

@driesvints
Copy link
Member Author

⚠️ Shift detected you are using a Laravel package like Horizon or Nova which may need to have its published assets regenerated after upgrading. Be sure to use artisan to republish these assets as well as php artisan view:clear to avoid any errors.

@driesvints
Copy link
Member Author

🎉 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:

  • Upgrade Checker ensures your application is fully upgraded by detecting any outdated code.
  • Laravel Fixer automatically updates your code to the latest Laravel conventions.
  • Tests Generator intelligently generates model factories, HTTP Tests, and configuration for your application.
  • CI Generator intelligently generates CI jobs to lint PHP, check code style, and run tests, including Dusk.

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

@driesvints
Copy link
Member Author

⚗️ This Shift is still being refined. Please report any issues or suggestions to [email protected]. Your feedback is what helps improve the experience for everyone.

@driesvints
Copy link
Member Author

driesvints commented Feb 13, 2023

❌ 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:

  • app/Http/Kernel.php

@driesvints driesvints merged commit 1d946e1 into main Sep 7, 2023
@driesvints driesvints deleted the shift-80567 branch September 7, 2023 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants