-
Notifications
You must be signed in to change notification settings - Fork 519
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
deprecate: spitNameByExtension, use splitNameByExtension instead #1338
Conversation
src/Util/FilenameUtils.php
Outdated
{ | ||
trigger_deprecation('vich/uploader-bundle', '2.0.2', '"%s()" is deprecated, use "splitNameByExtension()" instead.', __METHOD__); | ||
|
||
return $this->splitNameByExtension($filename); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method is static
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, fixed it.
src/Util/FilenameUtils.php
Outdated
*/ | ||
public static function spitNameByExtension(string $filename): array | ||
{ | ||
trigger_deprecation('vich/uploader-bundle', '2.0.2', '"%s()" is deprecated, use "splitNameByExtension()" instead.', __METHOD__); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't add deprecation in patch versions. Please change this with 2.1.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to 2.1.0 as requested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On second thought, I realized that we don't need to deprecate this method, since the class is marked as "internal".
By the way, the class itself looks a bit overkill, since it's used only in our Transliterator
(that's internal too).
So, please change this PR (or open a new one, if you prefer) to remove the class and move the method as a private method of the Transliterator
class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't you want to give users the chance to remove this function call in case they just ignored that it is marked as "internal"? I could then change the comment to state that this function will be removed in the next major release?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want to wait for the next major release. We'll add a note about the breaking change in the UPGRADE file: if someone is using the internal class, it's up to them to use caution with upgrades.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved splitNameByExtension to /src/Util/Transliterator.php updated the UPGRADE.md, removed /src/Util/FilenameUtils.php and /tests/Util/FilenameUtilsTest.php.
src/Util/Transliterator.php
Outdated
$transliterated = $this->slugger->slug($filename, $separator); | ||
if ('' !== $extension) { | ||
$transliterated .= '.'.$extension; | ||
$transliterated .= '.' . $extension; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change breaks our coding standard
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adapted file to match coding standard.
UPGRADE.md
Outdated
@@ -1,3 +1,7 @@ | |||
# Upgrading from v2.0.1 to v2.1.0 | |||
|
|||
* the internal class src/Util/FilenameUtils.php has been removed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the name of the class should be like this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adapted documentation accordingly.
thank you @ockstadt |
No description provided.