Skip to content

Upgrade to Laravel 7.x #4482

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

Closed
wants to merge 34 commits into from
Closed

Upgrade to Laravel 7.x #4482

wants to merge 34 commits into from

Conversation

nolanpro
Copy link
Contributor

@nolanpro nolanpro commented Aug 23, 2022

Issues
https://processmaker.atlassian.net/browse/FOUR-6564
https://processmaker.atlassian.net/browse/FOUR-6565

Upgrade to Laravel 7

Package PRs

Note: PMQL was locked to version <=6 so I temporarily specified dev-develop until there's a new release. I would recommend doing a release then updating this composer.json, then running composer update and committing composer.lock, before merging this PR.

Testing:

  • Install all packages and use the feature/FOUR-6565 branch for the above packages.
  • Skim the code changes and identify areas that may be affected
  • Try out a bunch of different features of the app

Original Laravel Shift PR text below

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

Before merging, you need to:

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

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.
@nolanpro
Copy link
Contributor 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.0.

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.

@nolanpro
Copy link
Contributor 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.

@nolanpro
Copy link
Contributor 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.

@nolanpro
Copy link
Contributor 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.

@nolanpro
Copy link
Contributor 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.

@nolanpro
Copy link
Contributor 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 76726389 and make the config file changes manually.

@nolanpro
Copy link
Contributor 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.

@nolanpro
Copy link
Contributor 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.

@nolanpro
Copy link
Contributor 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

@nolanpro
Copy link
Contributor 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.

@nolanpro
Copy link
Contributor 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.

@nolanpro
Copy link
Contributor 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.

@nolanpro
Copy link
Contributor 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.

@nolanpro
Copy link
Contributor 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 version (Laravel 9.x).

For tips on running multiple Shifts effectively, watch upgrading old Laravel applications.

@nolanpro nolanpro changed the title Laravel 7.x Shift Upgrade to Laravel 7.x Aug 23, 2022
@caleeli caleeli self-requested a review August 24, 2022 19:59
@nolanpro
Copy link
Contributor Author

@caleeli Made those changes, thanks!

@caleeli
Copy link
Contributor

caleeli commented Aug 30, 2022

@nolanpro please include Package-versions PR to description https://github.com/ProcessMaker/package-versions/pull/54

@caleeli caleeli self-requested a review August 30, 2022 19:05
@nolanpro
Copy link
Contributor Author

Closing in favor of #4483

@nolanpro nolanpro closed this Oct 14, 2022
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