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

Merged
merged 18 commits into from
Aug 30, 2024
Merged

Laravel 10.x Shift #342

merged 18 commits into from
Aug 30, 2024

Conversation

thdebay
Copy link
Collaborator

@thdebay thdebay commented Aug 30, 2024

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

Before merging, you need to:

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

@thdebay
Copy link
Collaborator Author

thdebay commented Aug 30, 2024

ℹ️ Laravel 9 moved the resources/lang folder to the top level of the project. While Shift automated this change, you may have additional references to the previous folder which need to be updated.

@thdebay
Copy link
Collaborator Author

thdebay commented Aug 30, 2024

ℹ️ Starting with Laravel 10, the lang folder is no longer included in a default Laravel application. Laravel now recursively merges any customizations with framework defaults.

Shift streamlined your language files by removing options that matched the Laravel defaults and preserving your customizations. If you wish to keep the full set of language, Shift recommends running artisan config:publish --all --force to get the latest configuration files from Laravel 11, then reapplying the customizations Shift streamlined.

@thdebay
Copy link
Collaborator Author

thdebay commented Aug 30, 2024

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

@thdebay
Copy link
Collaborator Author

thdebay commented Aug 30, 2024

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

@thdebay
Copy link
Collaborator Author

thdebay commented Aug 30, 2024

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

@thdebay
Copy link
Collaborator Author

thdebay commented Aug 30, 2024

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

The following dependencies were not updated by Shift and may be incompatible. If Composer lists one of these packages as a problem, you should check for a newer version.

@thdebay
Copy link
Collaborator Author

thdebay commented Aug 30, 2024

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

@thdebay
Copy link
Collaborator Author

thdebay commented Aug 30, 2024

ℹ️ Shift detected your application has a test suite. To allow you 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.

@thdebay
Copy link
Collaborator Author

thdebay commented Aug 30, 2024

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

@thdebay
Copy link
Collaborator Author

thdebay commented Aug 30, 2024

ℹ️ Laravel renamed the password_resets table to password_reset_tokens. While an optional change, Shift detected you have a migration for the original table and created a migration to rename the table. You should check for any additional references to the password_resets table and run php artisan migrate to complete your upgrade.

@thdebay
Copy link
Collaborator Author

thdebay commented Aug 30, 2024

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

@thdebay
Copy link
Collaborator Author

thdebay commented Aug 30, 2024

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

@thdebay
Copy link
Collaborator Author

thdebay commented Aug 30, 2024

ℹ️ 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 38490e8 to revert the DocBlock changes.
  • git revert af5d1b2 to revert the type hints added from DocBlocks.
  • git revert 01fb83e to revert the type hints added for Laravel 10.

@thdebay
Copy link
Collaborator Author

thdebay commented Aug 30, 2024

⚠️ 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/2020_09_19_135356_upgrade_to_medialibrary8.php

@thdebay
Copy link
Collaborator Author

thdebay commented Aug 30, 2024

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

@thdebay
Copy link
Collaborator Author

thdebay commented Aug 30, 2024

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

@thdebay
Copy link
Collaborator Author

thdebay commented Aug 30, 2024

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

@thdebay
Copy link
Collaborator Author

thdebay commented Aug 30, 2024

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

@thdebay
Copy link
Collaborator Author

thdebay commented Aug 30, 2024

❌ PHP syntax errors were detected after running your Shift. Often these are simply differences between the PHP version on the Shift server (8.2) 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/Middleware/ForceUpdate.php

@thdebay thdebay merged commit e569436 into pro Aug 30, 2024
1 check failed
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.

2 participants