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
Move VersionParser::formatVersion() to BasePackage::getFullPrettyVersion() #4086
Conversation
| } | ||
|
|
||
| return $package->getPrettyVersion() . ' ' . $package->getSourceReference(); | ||
| return $package->getFullPrettyVersion($truncate); |
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.
It's ok for me to keep this around but I think it should do a trigger_error('VersionParser::formatVersion is deprecated, you should use $package->getFullPrettyVersion() instead', E_USER_DEPRECATED);
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.
Indeed. Along with a @deprecated annotation. That way you could easily catch it in Composer 2.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.
Done both.
| return $package->getPrettyVersion() . ' ' . $package->getSourceReference(); | ||
| trigger_error(__METHOD__.' is deprecated. Use '. | ||
| '\Composer\Package\PackageInterface::getFullPrettyVersion() instead', E_USER_DEPRECATED); | ||
| return $package->getFullPrettyVersion($truncate); |
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.
Empty line before return construct.
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.
Fixed.
…ion() Working towards composer#3545. formatVersion() does not belong in VersionParser since it depends upon a Package object, and is creating a more complete pretty formatted version, not parsing anything. The new getFullPrettyVersion() method can be seen as an extension to getPrettyVersion(), and is located in BasePackage as a result. Callers to VersionParser::formatVersion() were not updated in this commit to demonstrate that no functionality was changed in this refactor. They will be updated in a follow up commit.
Tests were moved to BasePackageTest.
With 1753c27, this will be handled nicely.
|
Fixed code style, rebased against master, and then fixed failing tests due to a missing namespace import. |
Move VersionParser::formatVersion() to BasePackage::getFullPrettyVersion()
|
Thanks :) |
Working towards #3545.
formatVersion() does not belong in VersionParser since it depends upon a
Package object, and is creating a more complete pretty formatted
version, not parsing anything.
The new getFullPrettyVersion() method can be seen as an extension to
getPrettyVersion(), and is located in BasePackage as a result.
I'm also not very good at naming things, and
getFullPrettyVersionwas the best I could come up with. Better suggestions welcome :)