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

AnnotationRegistry is deprecated but has no alternative in v1.6.1 #270

Closed
danepowell opened this issue May 31, 2019 · 5 comments · Fixed by #271
Closed

AnnotationRegistry is deprecated but has no alternative in v1.6.1 #270

danepowell opened this issue May 31, 2019 · 5 comments · Fixed by #271

Comments

@danepowell
Copy link

I understand that the AnnotationRegistry is being deprecated and in version 2+ we should just rely on the Composer autoloader, which is awesome.

However, it seems that at least in version 1.6.1, you can't just use the autoloader, you still must use the registry. I think it's wrong to mark the registry members as deprecated when no better alternative exists today. This causes a lot of confusion amongst users and makes downstream deprecation tests somewhat useless, since there's no way to get them to pass today.

I think that version 1.x should be changed to allow using the autoloader for folks that don't want to use the deprecated functions.

@Ocramius
Copy link
Member

Ocramius commented May 31, 2019 via email

@danepowell
Copy link
Author

danepowell commented May 31, 2019

Yeah I'm excited that that's the vision for v2, but the problem is that everything's already been deprecated in v1 and there's no alternative in v1. Correct me if I'm wrong.

In my mind, the main point of having deprecation warnings is to give folks time to effect a transition between two versions of an upstream library such as annotations. The way that functions have been deprecated in v1.6.1 without providing any viable alternative (that's usable in v1.6.1) subverts that whole purpose. It means that downstream projects will need to be much more tightly coupled to the annotation library version, and can't eliminate the deprecation warnings until after they upgrade to annotations 2.0 (which doesn't exist yet).

@Ocramius
Copy link
Member

Yes, that is correct: specifically, "application" packages will, since libraries have no business in touching the annotation registry.

sanmai added a commit to sanmai/annotations that referenced this issue Jun 28, 2019
As v2 isn't here yet, and looking at doctrine#232 it is unclear if will, and as we have to put up with annoying deprecated functions, here I propose to fall back to the standard autoloader if nothing else worked, and if there's no custom loader defined.

Fixes doctrine#270
@sanmai
Copy link
Contributor

sanmai commented Jun 28, 2019

libraries have no business in touching the annotation registry

Libraries do have a business in touching the annotation registry because a typical library is supposed to work out of box. Just composer install ... should be enough.

And if you have to ask your users to add AnnotationRegistry::registerLoader('class_exists') whenever they want to use your library, that is the bad design. Guess what, nobody's going to do that because not a single sane person is willing to read the installation instructions beyond composer install. And nobody has to.

Overall this is just calling for trouble and endless issues riddled with semantical errors about some inexistent annotations that seeming have nothing to do with the library they're trying to use. Total and complete waste of time. So we, as responsible library authors, have to deal with the annotation registry.

@scaytrase
Copy link

Looks like #271 solves the problem keeping BC. Can we adopt this?

alcaeus pushed a commit to sanmai/annotations that referenced this issue Apr 1, 2020
As v2 isn't here yet, and looking at doctrine#232 it is unclear if will, and as we have to put up with annoying deprecated functions, here I propose to fall back to the standard autoloader if nothing else worked, and if there's no custom loader defined.

Fixes doctrine#270
alcaeus pushed a commit to sanmai/annotations that referenced this issue Apr 2, 2020
As v2 isn't here yet, and looking at doctrine#232 it is unclear if will, and as we have to put up with annoying deprecated functions, here I propose to fall back to the standard autoloader if nothing else worked, and if there's no custom loader defined.

Fixes doctrine#270
alcaeus added a commit that referenced this issue Apr 2, 2020
* Trigger the standard autoloader as the last resort

As v2 isn't here yet, and looking at #232 it is unclear if will, and as we have to put up with annoying deprecated functions, here I propose to fall back to the standard autoloader if nothing else worked, and if there's no custom loader defined.

Fixes #270

* Do not use standard autoloader with registerFile()

* Add tests for fallback autoloading

* Update deprecation messages

* Update AnnotationRegistry.php

Co-authored-by: Andreas Braun <[email protected]>
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 a pull request may close this issue.

4 participants