Skip to content

[Debug] Trigger a deprecation when an @internal class/interface/trait is used #23800

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

Closed
nicolas-grekas opened this issue Aug 6, 2017 · 3 comments

Comments

@nicolas-grekas
Copy link
Member

Q A
Bug report? no
Feature request? yes
BC Break report? no
RFC? no
Symfony version 3.4

We use @internal quite extensively, yet, the DebugClassLoader class doesn't warn when one uses such a tagged class/interface/trait.

We should trigger the same kind of deprecation as we already do for @final, with the added condition that the root namespace needs to be different (don't trigger within the same root namespace.)

@GuilhemN
Copy link
Contributor

GuilhemN commented Aug 6, 2017

Do you have an idea of such implementation? A class is loaded only once so I don't see how we could always trigger the deprecation when necessary.

@nicolas-grekas
Copy link
Member Author

In the case where one extends/uses/implements, it should be similar to what we do for final. Not sure we should do more (we maybe could, using the stack trace, but that might have to high of an impact.)

@GuilhemN
Copy link
Contributor

GuilhemN commented Aug 6, 2017

Ok, I thought you talked about detecting the use of an internal class in the code which is indeed complicated.
👍 for detecting extends/implements. Uses might be harder but why not if we find a clean solution :)

nicolas-grekas added a commit that referenced this issue Aug 7, 2017
…lass/trait/interface (GuilhemN)

This PR was squashed before being merged into the 3.4 branch (closes #23807).

Discussion
----------

[Debug] Trigger a deprecation when using an internal class/trait/interface

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | yes <!-- don't forget updating src/**/CHANGELOG.md files -->
| BC breaks?    | no
| Deprecations? | not truly <!-- don't forget updating UPGRADE-*.md files -->
| Tests pass?   | yes
| Fixed tickets | #23800
| License       | MIT
| Doc PR        |

Trigger a deprecation when the user uses an internal class/trait/interface.
The deprecation is not triggered when an `@internal` is used in the same vendor.

Commits
-------

b89ba29 [Debug] Trigger a deprecation when using an internal class/trait/interface
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

No branches or pull requests

2 participants