Skip to content

Deprecate *Response::create() methods #34771

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

Merged
merged 1 commit into from
Dec 3, 2019

Conversation

fabpot
Copy link
Member

@fabpot fabpot commented Dec 3, 2019

Q A
Branch? master
Bug fix? no
New feature? no
Deprecations? yes
Tickets n/a
License MIT
Doc PR -

The ::create() methods of the Response class hierarchy are not needed anymore in modern PHP versions as we can use parenthesis around the new operator. So Response::create()->...() is equivalent to (new Response)->...().

Let's deprecate the static method. It's also good as the first parameter type changes depending on the sub-class.

@fabpot fabpot added this to the next milestone Dec 3, 2019
@fabpot fabpot force-pushed the chainability-method-deprecation branch from db949ec to ebb13e7 Compare December 3, 2019 06:30
fabpot added a commit that referenced this pull request Dec 3, 2019
This PR was merged into the 5.1-dev branch.

Discussion
----------

Deprecate *Response::create() methods

| Q             | A
| ------------- | ---
| Branch?       | master <!-- see below -->
| Bug fix?      | no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | yes <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | n/a<!-- prefix each issue number with "Fix #", if any -->
| License       | MIT
| Doc PR        | -

The `::create()` methods of the `Response` class hierarchy are not needed anymore in modern PHP versions as we can use parenthesis around the new operator. So `Response::create()->...()` is equivalent to `(new Response)->...()`.

Let's deprecate the static method. It's also good as the first parameter type changes depending on the sub-class.

Commits
-------

ebb13e7 Deprecate *Response::create() methods
@fabpot fabpot merged commit ebb13e7 into symfony:master Dec 3, 2019
HttpFoundation
--------------

* Deprecate `Response::create()`, `JsonResponse::create()`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be Deprecated for consistency (all messages are using the past in the upgrade guide)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm slowly moving to use more "modern" message patterns as use everywhere else.

OskarStark added a commit to symfony/symfony-docs that referenced this pull request Dec 4, 2019
This PR was merged into the 4.3 branch.

Discussion
----------

*Response::create() method is deprecated

@fabpot deprecated `*Response::create()` methods in symfony/symfony#34771

I think we can use `__construct` from the lowest version on (no occurences in `3.4`, so `4.3`) from now!
No need to mention the deprecation itself in the docs IMHO

Thats why I target `4.3`

Commits
-------

e930ea9 *Response::create() method is deprecated
@nicolas-grekas nicolas-grekas modified the milestones: next, 5.1 May 4, 2020
@fabpot fabpot mentioned this pull request May 5, 2020
@fabpot fabpot deleted the chainability-method-deprecation branch November 27, 2020 06:10
fabpot added a commit that referenced this pull request Nov 27, 2020
…) (derrabus)

This PR was merged into the 5.2 branch.

Discussion
----------

[HttpFoundation] Deprecate BinaryFileResponse::create()

| Q             | A
| ------------- | ---
| Branch?       | 5.2
| Bug fix?      | no
| New feature?  | no
| Deprecations? | yes
| Tickets       | N/A
| License       | MIT
| Doc PR        | N/A

Follows #34771. We've deprecated the static `::create()` methods on all response classes but `BinaryFileResponse`. This PR proposes to fix this inconsistency.

Commits
-------

9ce2e86 [HttpFoundation] Deprecate BinaryFileResponse::create().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants