Skip to content

[HttpFoundation] Incorrect documentation and method name for UploadedFile::getClientSize() #25324

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

Conversation

Simperfit
Copy link
Contributor

@Simperfit Simperfit commented Dec 5, 2017

Q A
Branch? 4.1
Bug fix? no
New feature? no
BC breaks? no
Deprecations? yes
Tests pass? yes
Fixed tickets #23791
License MIT
Doc PR none

Replace the wrong named and documented method by another with better doc and better naming

@Simperfit Simperfit changed the title [HttpFoundation] Incorrect documentation and method name for Uploaded… [HttpFoundation] Incorrect documentation and method name for UploadedFile::getClientSize() Dec 5, 2017
@Simperfit Simperfit force-pushed the bugfix/incorrect-documentation-and-method-namefor-uploadedfile-get-client-size branch 2 times, most recently from 50794b6 to df51428 Compare December 5, 2017 06:50
@nicolas-grekas nicolas-grekas added this to the 4.1 milestone Dec 5, 2017
Copy link
Contributor

@ro0NL ro0NL left a comment

Choose a reason for hiding this comment

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

reasonable 👍

where's the picture/photo? 🤔

*/
public function getClientSize()
{
@trigger_error(sprintf('%s is deprecated since 4.1 and will be removed in 5.0 use %s::%s.', __METHOD__, __CLASS__, 'getSize'), E_USER_DEPRECATED);
Copy link
Contributor

Choose a reason for hiding this comment

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

"%s" ... 5.0. Use getFileSize() instead.

*
* @return int|null The file size
*/
public function getFileSize()
Copy link
Contributor

Choose a reason for hiding this comment

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

getClientSize becomes getSize?

Copy link
Contributor

Choose a reason for hiding this comment

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

which you are actually suggesting above :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not the same thing I guess, getSize already exists.

Copy link
Contributor

@ro0NL ro0NL Dec 5, 2017

Choose a reason for hiding this comment

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

Right, my bad. \SplFileInfo::getSize — Gets file size.

So what do we suggest here? Another file size? Or should we override getSize to avoid re-calculating / forward if $size is null.

getUploadedSize maybe? Would it make sense?

@Simperfit Simperfit force-pushed the bugfix/incorrect-documentation-and-method-namefor-uploadedfile-get-client-size branch from df51428 to eb469dc Compare December 5, 2017 17:17
@Simperfit
Copy link
Contributor Author

@ro0NL There are no picture on this one because i've pushed 2 PR this morning and didn't take the time to take one picture for this one ^^'.

*/
public function getClientSize()
{
@trigger_error(sprintf('%s is deprecated since 4.1 and will be removed in 5.0 use %s instead.', __METHOD__, 'getFileSize'), E_USER_DEPRECATED);
Copy link
Contributor

@ro0NL ro0NL Dec 5, 2017

Choose a reason for hiding this comment

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

We really want the first %s to be quoted i guess for HTML purpose (e.g. make it bold in the profiler log panel).

Also i suggested to start a new sentence as of 5.0. Use ... instead (no real reason to use a sprintf placeholder here also).

Sorry :) just following 3.x convention AFAIK.

@Simperfit Simperfit force-pushed the bugfix/incorrect-documentation-and-method-namefor-uploadedfile-get-client-size branch 5 times, most recently from 157f01a to f5a8168 Compare December 9, 2017 08:21
@@ -60,6 +60,9 @@ public function __construct(string $path, string $originalName, string $mimeType
$this->originalName = $this->getName($originalName);
$this->mimeType = $mimeType ?: 'application/octet-stream';
$this->size = $size;
if (null !== $size) {
@trigger_error('Passing a size in the constructor is deprecated since 4.1 and will be removed in 5.0. Use getSize instead.', E_USER_DEPRECATED);
Copy link
Member

Choose a reason for hiding this comment

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

"getSize()"

*/
public function getClientSize()
{
@trigger_error(sprintf('"%s" is deprecated since 4.1 and will be removed in 5.0. Use getSize instead.', __METHOD__), E_USER_DEPRECATED);
Copy link
Member

Choose a reason for hiding this comment

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

same here

@Simperfit Simperfit force-pushed the bugfix/incorrect-documentation-and-method-namefor-uploadedfile-get-client-size branch from f5a8168 to a8e4d7a Compare December 11, 2017 21:58
@Simperfit Simperfit force-pushed the bugfix/incorrect-documentation-and-method-namefor-uploadedfile-get-client-size branch from a8e4d7a to b136320 Compare December 11, 2017 21:58
@Simperfit
Copy link
Contributor Author

The PR has been fixed from review and rebased with current master.

@fabpot
Copy link
Member

fabpot commented Dec 11, 2017

Thank you @Simperfit.

@fabpot fabpot merged commit b136320 into symfony:master Dec 11, 2017
fabpot added a commit that referenced this pull request Dec 11, 2017
…me for UploadedFile::getClientSize() (Simperfit)

This PR was merged into the 4.1-dev branch.

Discussion
----------

[HttpFoundation] Incorrect documentation and method name for UploadedFile::getClientSize()

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

Replace the wrong named and documented method by another with better doc and better naming

Commits
-------

b136320 [HttpFoundation] Incorrect documentation and method name for UploadedFile::getClientSize()
@Simperfit Simperfit deleted the bugfix/incorrect-documentation-and-method-namefor-uploadedfile-get-client-size branch December 11, 2017 22:11
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.

5 participants