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 #499

Closed
wants to merge 13 commits into from
Closed

Laravel 10.x Shift #499

wants to merge 13 commits into from

Conversation

vaughnjones-marcus
Copy link

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

Before merging, you need to:

  • Checkout the shift-115113 branch
  • Review all pull request comments for additional changes
  • Run composer update (if the scripts fail, try with --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.

@vaughnjones-marcus
Copy link
Author

ℹ️ 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/ValidAmountForCurrentLocale.php

@vaughnjones-marcus
Copy link
Author

ℹ️ Laravel 10 increased the hashing cost from 10 to 12. However, the hashing cost defaults to 4 when testing. To ensure the lower hashing cost is respected when running testing, the default UserFactory now hashes the password instead of hardcoding the hashed value.

You should review your UserFactory and any other factory that may hardcode a hashed value. For more details, you may reference the original PR changes.

@vaughnjones-marcus
Copy link
Author

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

  • lang/en/validation.php

@vaughnjones-marcus
Copy link
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 6e4ba89d and make the config file changes manually.

@vaughnjones-marcus
Copy link
Author

ℹ️ Laravel 10 now verifies hashed values were created by the same hashing algorithm. If your application has hashed values created by different hashing algorithms, you may set the verify option to false in your hashing configuration. For more details, you may review the original PR.

@vaughnjones-marcus
Copy link
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.

@vaughnjones-marcus
Copy link
Author

ℹ️ Shift detected your application has a test suite. To allow your to verify the upgrade in isolation, Shift did not bump your testing dependencies for 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.

@vaughnjones-marcus
Copy link
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. You should check for any additional references to this table and run php artisan migrate to complete your upgrade.

@vaughnjones-marcus
Copy link
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/Notifications/CFPsAreOpen.php
  • app/Notifications/ConferenceImporterError.php
  • app/Notifications/ConferenceImporterInactive.php
  • app/Notifications/ConferenceIssueReported.php
  • app/Notifications/NewConference.php
  • app/Notifications/NewUser.php

@vaughnjones-marcus
Copy link
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.

@vaughnjones-marcus
Copy link
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.

@vaughnjones-marcus
Copy link
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 3d6aa86 to revert the DocBlock changes.
  • git revert 6176315 to revert the type hints added from DocBlocks.
  • git revert 0e9e90f to revert the type hints added for Laravel 10.

@vaughnjones-marcus
Copy link
Author

⚠️ In Laravel 10 you may no longer implicitly cast a DB::raw() expression to a string. Instead, you must retrieve the string value from the expression using the getValue() method. Query builder methods will continue to automatically handle DB::raw() expressions as before. This change only affects instances where you are using DB::raw() expressions 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/2019_04_19_142914_create_failed_jobs_table.php

@vaughnjones-marcus
Copy link
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. These are most likely type hints and can safely be ignored. If you are using Symfony classes directly or experience issues relating to Symfony, you should review the Symfony change log for any additional changes.

@vaughnjones-marcus
Copy link
Author

ℹ️ Laravel began using Vite to build frontend assets in Laravel 9.19. While you may continue to use Laravel Mix, it is no longer the default. If you wish to modernize your application to use Vite, you may run the Vite Converter for free.

@vaughnjones-marcus
Copy link
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.

@andrewmile andrewmile closed this Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants