Skip to content

Laravel 10.x Shift#576

Merged
alexjustesen merged 24 commits intomainfrom
shift-90275
May 7, 2023
Merged

Laravel 10.x Shift#576
alexjustesen merged 24 commits intomainfrom
shift-90275

Conversation

@alexjustesen
Copy link
Owner

@alexjustesen alexjustesen commented May 7, 2023

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

Before merging, you need to:

  • Checkout the shift-90275 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.

Changelog

In addition to the Shift changes the follow has been changed.

Changed

  • refactored rule ValidateCronExpression to Cron
  • refactored Telegram test notification, this lays the groundwork and a pattern for the work planned for v0.19.0 (notification refactor)

@alexjustesen
Copy link
Owner Author

alexjustesen commented May 7, 2023

ℹ️ Laravel 10 deprecated the ImplicitRule, InvokableRule, and Rule contracts in favor of using the new, streamlined ValidationRule contract. These contracts will be removed in a future version of Laravel.

Given the change in the method names and return type, Shift can not reliably automate this change. At your convenience, you should review these custom validation rules and update them to implement the ValidationRule contract.

  • app/Rules/ValidCronExpression.php, refactored to app/Rules/Cron.php

@alexjustesen
Copy link
Owner 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 a2bf1a17 and make the config file changes manually.

@alexjustesen
Copy link
Owner Author

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

@alexjustesen
Copy link
Owner Author

⚠️ Shift detected you are running Laravel Sail. If you have not customized your stack, you should run php artisan sail:install to regenerate the latest docker-compose.yml. Otherwise, Shift attempted to update Sail for PHP 8.1. However, you should review your docker-compose.yml to ensure your stack is running PHP 8.1 or higher.

@alexjustesen
Copy link
Owner Author

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

@alexjustesen
Copy link
Owner Author

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

@alexjustesen
Copy link
Owner Author

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

  • app/Telegram/TelegramNotification.php

@alexjustesen
Copy link
Owner 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.

@alexjustesen
Copy link
Owner 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.

@alexjustesen
Copy link
Owner Author

ℹ️ 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 the changes relating to type hints, you may run:

  • git revert 2375f90 to revert the DocBlock changes.
  • git revert 470ac78 to revert the type hints added from DocBlocks.
  • git revert effc3bd to revert the type hints added for Laravel 10.

@alexjustesen
Copy link
Owner 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.

@alexjustesen
Copy link
Owner Author

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

@alexjustesen
Copy link
Owner 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.

@alexjustesen
Copy link
Owner Author

alexjustesen commented May 7, 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/Jobs/DeleteResultsData.php
  • app/Jobs/ExecSpeedtest.php

@alexjustesen alexjustesen marked this pull request as draft May 7, 2023 12:30
@alexjustesen alexjustesen self-assigned this May 7, 2023
@alexjustesen alexjustesen added the dependencies Pull requests that updates dependencies label May 7, 2023
@alexjustesen alexjustesen marked this pull request as ready for review May 7, 2023 14:50
@alexjustesen alexjustesen merged commit b292909 into main May 7, 2023
@alexjustesen alexjustesen deleted the shift-90275 branch May 7, 2023 15:22
@masterwishx
Copy link

Dont sure if it belog to here but a little mistake of "vv" instead of 'v' in version of laravel:
Laravel vv10.9.0

image

@alexjustesen
Copy link
Owner Author

Noticed that too, I opened a PR with the package that handles it awcodes/filament-versions#13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that updates dependencies

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants