Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[HttpFoundation] Make ResponseHeaderBag::makeDisposition static #28807

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
Oct 15, 2018

Conversation

fabpot
Copy link
Member

@fabpot fabpot commented Oct 10, 2018

Q A
Branch? master
Bug fix? no
New feature? yes-ish
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #27851
License MIT
Doc PR n/a

* @throws \InvalidArgumentException
*
* @see RFC 6266
* @see HeaderUtils::makeDisposition()
*/
public function makeDisposition($disposition, $filename, $filenameFallback = '')
Copy link
Member

Choose a reason for hiding this comment

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

shall we deprecate then?

Copy link
Member Author

Choose a reason for hiding this comment

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

not sure it's worth it.

*
* @see RFC 6266
*/
public static function makeDisposition($disposition, $filename, $filenameFallback = '')
Copy link
Contributor

Choose a reason for hiding this comment

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

why not using null as default here?

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've just moved the code and don't want to make other changes.

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense 👍
Thank you!

Copy link
Contributor

Choose a reason for hiding this comment

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

IMO new code should have type declarations.

Copy link
Member Author

Choose a reason for hiding this comment

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

done

*
* @param string $disposition One of "inline" or "attachment"
* @param string $filename A unicode string
* @param string $filenameFallback A string containing only ASCII characters that
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO $fallback would be enough in this context

Copy link
Member

@javiereguiluz javiereguiluz left a comment

Choose a reason for hiding this comment

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

Totally unrelated to this PR, but I always find hard to understand what does "disposition attachment" and "disposition inline" mean. Normal people call this "download file" and "display file". Maybe we should add some helpers somewhere?

@fabpot fabpot force-pushed the makedisposition-static branch from 4c4ad02 to 03471a3 Compare October 11, 2018 10:56
@nicolas-grekas nicolas-grekas added this to the next milestone Oct 14, 2018
@fabpot fabpot force-pushed the makedisposition-static branch from 03471a3 to d29b410 Compare October 15, 2018 14:53
@fabpot fabpot merged commit d29b410 into symfony:master Oct 15, 2018
fabpot added a commit that referenced this pull request Oct 15, 2018
…on static (fabpot)

This PR was merged into the 4.2-dev branch.

Discussion
----------

[HttpFoundation] Make ResponseHeaderBag::makeDisposition static

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes-ish
| BC breaks?    | no
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes
| Fixed tickets | #27851
| License       | MIT
| Doc PR        | n/a

<!--
Write a short README entry for your feature/bugfix here (replace this comment block.)
This will help people understand your PR and can be used as a start of the Doc PR.
Additionally:
 - Bug fixes must be submitted against the lowest branch where they apply
   (lowest branches are regularly merged to upper ones so they get the fixes too).
 - Features and deprecations must be submitted against the master branch.
-->

Commits
-------

d29b410 [HttpFoundation] made ResponseHeaderBag::makeDisposition static
fabpot added a commit that referenced this pull request Oct 15, 2018
This PR was merged into the 4.2-dev branch.

Discussion
----------

[HttpFoundation] Publicify new consts

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | #...   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

Continuation of #28807

I think it's reasonable to enforce visibility for new consts, ideally solved by PHP-CS-Fixer. This makes it explicit for the consts to be consumed as part of public API.

Commits
-------

ce95d0d [HttpFoundation] Publicify new consts
@nicolas-grekas nicolas-grekas modified the milestones: next, 4.2 Nov 1, 2018
This was referenced Nov 3, 2018
@fabpot fabpot deleted the makedisposition-static branch January 14, 2019 11:01
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