Laravel 10.x Shift #49

Merged
nomadjimbob merged 17 commits from shift-91885 into main 2023-05-24 21:47:14 +00:00
nomadjimbob commented 2023-05-24 21:33:24 +00:00 (Migrated from github.com)

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

Before merging, you need to:

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

This pull request includes the changes for upgrading to Laravel 10.x. Feel free to commit any additional changes to the `shift-91885` branch. **Before merging**, you need to: - Checkout the `shift-91885` 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?](https://laravelshift.com/laravel-test-generator), [no CI?](https://laravelshift.com/ci-generator)) If you need help with your upgrade, check out the [Human Shifts](https://laravelshift.com/human-shifts). You may also join the [Shifty Coders](https://laravelshift.com/shifty-coders) Slack workspace to level-up your Laravel skills.
nomadjimbob commented 2023-05-24 21:33:25 +00:00 (Migrated from github.com)

ℹ️ Shift noticed you have additional namespaces in your application. You may use the Consolidate Namespaces Shift to simplify your namespaces into the default Laravel App namespace.

:information_source: Shift noticed you have additional namespaces in your application. You may use the [Consolidate Namespaces Shift](https://laravelshift.com/laravel-consolidate-custom-namespaces) to simplify your namespaces into the default Laravel `App` namespace.
nomadjimbob commented 2023-05-24 21:33:26 +00:00 (Migrated from github.com)

ℹ️ 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/Recaptcha.php
  • app/Rules/UniqueFileName.php
  • app/Rules/Uniqueish.php
:information_source: 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/Recaptcha.php - [ ] app/Rules/UniqueFileName.php - [ ] app/Rules/Uniqueish.php
nomadjimbob commented 2023-05-24 21:33:27 +00:00 (Migrated from github.com)

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

: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](https://github.com/STEMMechanics/website/pull/49/commits/3ad2b2fb8e2500643a8dcc53364dae349b3e99e0?w=1) 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 3ad2b2fb` and make the [config file changes](https://github.com/laravel-shift/laravel-9.x/pull/4/commits/5401110f1f41793ecdce268495768abfa4a53dfe) manually.
nomadjimbob commented 2023-05-24 21:33:28 +00:00 (Migrated from github.com)

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

:information_source: Shift [updated your dependencies](https://github.com/STEMMechanics/website/pull/49/commits/40b265e1455ba78b6e3ca11604a6786f2b3babc5?w=1) 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](https://laravelshift.com/videos/update-incompatible-composer-dependencies) for tips on handling any Composer issues.
nomadjimbob commented 2023-05-24 21:33:29 +00:00 (Migrated from github.com)

ℹ️ Shift detected your application has a test suite. To make verifying the upgrade to Laravel 10 easier, Shift did not upgrade your test suite to PHPUnit 10. Once you have completed your upgrade, you may run the PHPUnit 10 Shift for free to upgrade your test suite to PHPUnit 10 separately.

:information_source: Shift detected your application has a test suite. To make verifying the upgrade to Laravel 10 easier, Shift did not upgrade your test suite to PHPUnit 10. Once you have completed your upgrade, you may run the [PHPUnit 10 Shift](https://laravelshift.com/upgrade-phpunit-10) for free to upgrade your test suite to PHPUnit 10 separately.
nomadjimbob commented 2023-05-24 21:33:30 +00:00 (Migrated from github.com)

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

:information_source: Laravel 9 adopted [anonymous migrations](https://laravel-news.com/laravel-anonymous-migrations). Shift [automated this change](https://github.com/STEMMechanics/website/pull/49/commits/c88630e9afcacc444074761cb104cba78aaa4f2b?w=1) to align with modern Laravel conventions and avoid naming migrations.
nomadjimbob commented 2023-05-24 21:33:31 +00:00 (Migrated from github.com)

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

: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](https://github.com/STEMMechanics/website/pull/49/commits/c83e21d588d7fb22e41aa99abb1e59507f75ca85?w=1) 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.
nomadjimbob commented 2023-05-24 21:33:31 +00:00 (Migrated from github.com)

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

: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](https://github.com/STEMMechanics/website/pull/49/commits/979b9f704c347e18fcc53e684d354df8fe8a2f93?w=1) to any method which is used by Laravel.
nomadjimbob commented 2023-05-24 21:33:32 +00:00 (Migrated from github.com)

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

: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](https://github.com/STEMMechanics/website/pull/49/commits/5faf49688dbb82e621432c33282b7dc134b6391f?w=1) from any DocBlock where the code now has _equivalent_ type hints.
nomadjimbob commented 2023-05-24 21:33:33 +00:00 (Migrated from github.com)

⚠️ 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. Query builder methods will continue to handle DB::raw() expressions directly. This likely only affects instances where you are using DB::raw() expression in your own code.

Shift detected calls to DB::raw(). You should review these instances to see if you are attempting to use them as a string.

  • database/migrations/2023_05_04_071954_remove_username_from_users_table.php
:warning: 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. Query builder methods will continue to handle `DB::raw()` expressions directly. This likely only affects instances where you are using `DB::raw()` expression in your own code. Shift detected calls to `DB::raw()`. You should review these instances to see if you are attempting to use them as a string. - [ ] database/migrations/2023_05_04_071954_remove_username_from_users_table.php
nomadjimbob commented 2023-05-24 21:33:33 +00:00 (Migrated from github.com)

ℹ️ 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 5faf496 to revert the DocBlock changes.
  • git revert 4d7d0ed to revert the type hints added from DocBlocks.
  • git revert 979b9f7 to revert the type hints added for Laravel 10.
: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 the changes relating to type hints, you may run: - `git revert 5faf496` to revert the DocBlock changes. - `git revert 4d7d0ed` to revert the type hints added from DocBlocks. - `git revert 979b9f7` to revert the type hints added for Laravel 10.
nomadjimbob commented 2023-05-24 21:33:34 +00:00 (Migrated from github.com)

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

: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](https://github.com/symfony/symfony/blob/6.2/UPGRADE-6.2.md) for any additional changes.
nomadjimbob commented 2023-05-24 21:33:35 +00:00 (Migrated from github.com)

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

: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.
nomadjimbob commented 2023-05-24 21:33:35 +00:00 (Migrated from github.com)

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

: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: - [Upgrade Checker](https://laravelshift.com/laravel-upgrade-checker) ensures your application is fully upgraded by detecting any outdated code. - [Laravel Fixer](https://laravelshift.com/laravel-code-fixer) automatically updates your code to the latest Laravel conventions. - [Tests Generator](https://laravelshift.com/laravel-test-generator) intelligently generates model factories, HTTP Tests, and configuration for your application. - [CI Generator](https://laravelshift.com/ci-generator) intelligently generates CI jobs to lint PHP, check code style, and run tests, including Dusk. You may also use the [Shift Workbench](https://laravelshift.com/workbench) to automate common tasks for maintaining your Laravel and PHP applications.
Sign in to join this conversation.