yii2: #14456 breaks backward compatibility
Regarding https://github.com/yiisoft/yii2/pull/14456#issuecomment-327409143 I think the PR #14456 breaks backward compatibility.
You can totally have some classes extending BaseActiveRecord (which implements ActiveRecordInterface which extends StaticInstanceInterface) and having an instance() method.
See for instance Humhub: https://github.com/humhub/humhub/blob/master/protected/humhub/modules/user/models/GroupPermission.php#L26
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 1
- Comments: 22 (21 by maintainers)
Commits related to this issue
- improve upgrade instruction for AR::instance() issue #14767 — committed to yiisoft/yii2 by cebe 7 years ago
And what about following comment then: https://github.com/yiisoft/yii2/pull/14456#issuecomment-323966799 ?
We have already decided the naming, besides who can tell someone have not declared
modelInstance()method inside his ActiveRecord.We have already placed the note to UPGRAGE.md, I can not see why there should be anything else to be done.
There is a versioning policy, which explains what changes may appear at particualr release. For the 2.0.x there is an explanation: https://github.com/yiisoft/yii2/blob/master/docs/internals/versions.md#2xy-minor-releases
It is not some secret: you have been warned about it.
Yes, it is a sad thing that we are unable to follow strict versioning rules, but we simply do not have enough resources for that. If we use more strict rules for the releases this framework will not move anywhere as it happens for 2.1 version at the present state.
how about renaming the method to
modelInstance()to make it less likely to conflict?The same story here: https://github.com/yiisoft/yii2/pull/14441#issuecomment-315127527
Each update we create tons of new method and we can not predict cases like this. There’s always a possibility that new public or protected method will break users’ code just because of incompatible declaration. I think we have nothing to do it.
It’s general. Doesn’t matter if it’s a class or interface. In both SemVer and YiiVer it’s allowed to be released in minor version which 2.0.13 is.
No workaround is possible. It’s common for minor versions and I’ve never seen any library is describing every introduced non-private method or property in this manner.
I would rather move these changes to 2.1 milestone than introduce some weird names like
modelInstance().The main issue here is lack of LTS line which contains only BC bugfixes. Right now big projects based on Yii (or extensions) doesn’t have any way to safely use Yii without locking framework version to specific release. Just look at https://github.com/yiisoft/yii2/blob/master/framework/UPGRADE.md - changing method signature or introducing new methods in interfaces are regular BC breakers in last releases. Yii simply does not have BC line - new versions always always bring a risk of serious BC break.
That is why it is mentioned in UPGRADE.