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 7.x Shift #1

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open

Laravel 7.x Shift #1

wants to merge 8 commits into from

Conversation

CircusMusic
Copy link
Owner

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

Before merging, you need to:

  • Checkout the shift-52811 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?)

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.

Shift automatically applies the Laravel coding style - which uses the PSR-2 coding style as a base with some minor additions.

You may customize the adopted coding style by adding a [PHP CS Fixer][1] or [PHP CodeSniffer][2] config to your project root. Feel free to use [Shift's Laravel ruleset][3] to help you get started.

For more information on customizing the code style applied by Shift, [watch this short video][4].

[1]: https://github.com/FriendsOfPHP/PHP-CS-Fixer
[2]: https://github.com/squizlabs/PHP_CodeSniffer
[3]: https://gist.github.com/laravel-shift/cab527923ed2a109dda047b97d53c200
[4]: https://laravelshift.com/videos/shift-code-style
Since PHP 5.4 the short array syntax `[]` may be used instead of `array()`.
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.
@CircusMusic
Copy link
Owner Author

⚠️ Shift detected a custom namespace. Laravel now recommends keeping the default App namespace. While it was available to customize in previous versions using app:name, this command was removed in Laravel 6.

Shift recommends changing this to align with Laravel and improve its automation. After doing so, you are welcome to request a rerun of this Shift.

@CircusMusic
Copy link
Owner Author

❌ Shift was unable to find your Exception Handler. Laravel 7 upgraded to Symfony 5 which passes instances of the Throwable interface instead of Exception.

You should compare your app/Exceptions/Handler.php with the default Laravel 7 version to finalize any changes.

@CircusMusic
Copy link
Owner Author

ℹ️ Laravel 7 moved the Authentication components into a separate laravel/ui package, which includes the make commands as well as the traits related to authentication.

Shift added this dependency for convenience. However, if you do not plan to use the Authentication components, you may remove this dependency as well as the Auth controllers from your application.

@CircusMusic
Copy link
Owner Author

⚠️ Laravel 7 removed "factory types". While available, this was undocumented since Laravel 5.2. Since then the preferred method has been factory states.

Shift converted usages of $factory->defineAs() to $factory->state(). However, you should review this commit and run your tests to see if any additional changes to your factory states are necessary.

@CircusMusic
Copy link
Owner Author

⚠️ The MAIL_DRIVER environment variable was renamed in Laravel 7 to MAIL_MAILER in order to support multiple mail configurations.

Shift attempted to automate this change, but you should review any additional environment configuration and update to the new variable name.

@CircusMusic
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 bb227d25 and make the config file changes manually.

@CircusMusic
Copy link
Owner Author

ℹ️ Shift updated your dependencies for Laravel 7. 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 7.

Watch dealing with dependencies for tips on handling any additional package incompatibilities.

@CircusMusic
Copy link
Owner Author

ℹ️ Laravel 7 removed some of the PHPUnit configuration in favor of the defaults. While this is not a required changed, it is a good opportunity to compare your phpunit.xml with the default Laravel 7 version to modernize your configuration.

@CircusMusic
Copy link
Owner Author

⚠️ In Laravel 7, all of the assertSee methods now automatically escape the expected values.

If you were manually escaping the values passed to these methods, you no longer need do so. If you were asserting values containing HTML that should not be escaped, you may set the new escaped argument to false.

Shift found the instances of these assertions within:

  • tests/Browser/RequestsTest.php
  • tests/Feature/AboutTest.php
  • tests/Feature/Admin/GroupTest.php
  • tests/Feature/Admin/UserTest.php
  • tests/Feature/Api/ChangePasswordTest.php
  • tests/Feature/Api/GroupsTest.php
  • tests/Feature/Api/ProcessRequestsTest.php
  • tests/Feature/Api/ScriptsTest.php
  • tests/Feature/Api/UsersTest.php
  • tests/Feature/EditDataTest.php
  • tests/Feature/FlashMessageTest.php
  • tests/Feature/Processes/EnvironmentVariablesTest.php
  • tests/Feature/Processes/ScreenTest.php
  • tests/Feature/Processes/ScriptsTest.php
  • tests/Feature/ProcessesTest.php
  • tests/Feature/RequestTest.php
  • tests/Feature/TasksTest.php

@CircusMusic
Copy link
Owner Author

⚠️ Shift found potential uses of the different validation rule. In Laravel 7, this rule will fail if one of the specified parameters is missing from the request. As this was likely the expected behavior, it should not affect your validation. Nonetheless you should be aware of this change.

@CircusMusic
Copy link
Owner Author

⚠️ Laravel 7 uses a new date format when serializing models. The previous format was 2019-12-02 20:01:00. Now, dates are serialized using an ISO-8601 compatible date format of 2019-12-02T20:01:00.283041Z in UTC.

This does not affect how dates are stored. Only how they are serialized when using the toArray or toJson Eloquent methods.

If you need to preserve the previous format, you may override the serializeDate method on your model. Review the Date Serialization section of the Upgrade Guide for more details.

@CircusMusic
Copy link
Owner Author

ℹ️ All of the underlying Symfony components used by Laravel have been upgraded to Symfony 5. If you are directly interacting with any Symfony component, you should review the Symfony change log for additional changes.

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

@CircusMusic
Copy link
Owner Author

⚠️ Laravel 7.x has reached end of life. It no longer receives bug fixes or security updates. Shift recommends continuing to upgrade to the latest stable version (Laravel 8.x).

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