Skip to content
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

Merged
merged 12 commits into from
Dec 14, 2022
Merged

deprecate: spitNameByExtension, use splitNameByExtension instead #1338

merged 12 commits into from
Dec 14, 2022

Conversation

ockstadt
Copy link
Contributor

No description provided.

{
trigger_deprecation('vich/uploader-bundle', '2.0.2', '"%s()" is deprecated, use "splitNameByExtension()" instead.', __METHOD__);

return $this->splitNameByExtension($filename);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Method is static

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you, fixed it.

*/
public static function spitNameByExtension(string $filename): array
{
trigger_deprecation('vich/uploader-bundle', '2.0.2', '"%s()" is deprecated, use "splitNameByExtension()" instead.', __METHOD__);
Copy link
Collaborator

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

Copy link
Contributor Author

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.

Copy link
Collaborator

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

Copy link
Contributor Author

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?

Copy link
Collaborator

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.

Copy link
Contributor Author

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.

@ockstadt ockstadt requested a review from garak December 12, 2022 13:20
$transliterated = $this->slugger->slug($filename, $separator);
if ('' !== $extension) {
$transliterated .= '.'.$extension;
$transliterated .= '.' . $extension;
Copy link
Collaborator

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

Copy link
Contributor Author

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.
Copy link
Collaborator

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adapted documentation accordingly.

@ockstadt ockstadt requested a review from garak December 13, 2022 09:28
@garak garak merged commit ab657bc into dustin10:master Dec 14, 2022
@garak
Copy link
Collaborator

garak commented Dec 14, 2022

thank you @ockstadt

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.

None yet

2 participants