Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[RFC] Remove the distinction between api and non-api classes #15977

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
stof opened this issue Sep 28, 2015 · 15 comments
Closed

[RFC] Remove the distinction between api and non-api classes #15977

stof opened this issue Sep 28, 2015 · 15 comments

Comments

@stof
Copy link
Member

stof commented Sep 28, 2015

We introduced @api in the early days of Symfony to distinguish the public API, safe to be used thanks to BC, and less safe APIs.
However, none of the APIs introduced after Symfony 2.3 has been tagged as @api AFAIK. And on the other hand, we became much better at writing BC layers to maintain compatibility until the next major version.
Our BC policy is also lying about its goal: what it describes in the Regular column is a policy which does not provide BC (only partial BC). And in practice, we are much stricter in our code than what is described in this document (i.e. we provide BC for all classes, not only @api classes), defeating the @api distinction.

IMO, the real distinction we should have is between normal APIs (where BC is provided) and internal APIs (tagged as @internal), which should not be used by people using Symfony (if they call an internal method themselves, they are on their own regarding upgrades).
Note that we already have the concept of internal APIs in Symfony (for instance callback functions needing to be public for PHP 5.3 compat, and turned into private ones in 3.0).

What do you think @symfony/deciders ?

@Tobion
Copy link
Contributor

Tobion commented Sep 28, 2015

👍 to remove api tags as they are unmaintained and only distinguish between @internal and the rest.
Also the notion of api tags is kinda ambiguous as there is no defined process of what and when is considered "api".

@xabbuh
Copy link
Member

xabbuh commented Sep 28, 2015

👍 Not distinguishing makes it more clear and we can still add some classes as internal.

@fabpot
Copy link
Member

fabpot commented Sep 28, 2015

👍 The concept is interesting but it needs maintenance, which we never did. And as pointed bu @stof, we are getting better at keeping BC almost everywhere, so it's not as needed as it once was.

@Tobion
Copy link
Contributor

Tobion commented Sep 28, 2015

Is it enough to remove the tags in 2.8? Or also since 2.3?

@stof
Copy link
Member Author

stof commented Sep 28, 2015

Well, I suggest cleaning it in all branches, to avoid confusion.

And then, the doc should be updated to stop talking about this distinction (dropping it is mostly a job for the doc team, as this is where the concept is used)

@fabpot
Copy link
Member

fabpot commented Sep 28, 2015

Doing it in 2.3 sounds good to me.

@Tobion
Copy link
Contributor

Tobion commented Sep 28, 2015

I bet this will be a huge merging pain, esp. in master.

@stof
Copy link
Member Author

stof commented Sep 28, 2015

@Tobion removing it in all branches means we have the merging pain only once, rather than having merge conflicts during the whole maintenance lifetime each time a phpdoc update is propagated to newer branches.

@xabbuh
Copy link
Member

xabbuh commented Sep 28, 2015

see symfony/symfony-docs#5735 for the docs changes

@dunglas
Copy link
Member

dunglas commented Sep 28, 2015

👍 but if we do that maybe should we add @internal on more classes (I think to normalizers in the Serializer Component or extractors in PropertyInfo for instance).

@fabpot
Copy link
Member

fabpot commented Sep 28, 2015

@dunglas I think that's the whole idea: instead of whitelisting the API, we need to blacklist internal classes. We've done that already for some classes during the 2.8 development cycle and we need to do more of that.

Tobion added a commit that referenced this issue Sep 29, 2015
This PR was merged into the 2.3 branch.

Discussion
----------

remove api tags from code

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #15977
| License       | MIT
| Doc PR        | n/a

Commits
-------

f1c7c65 remove api tags from code
@Tobion Tobion closed this as completed Oct 4, 2015
@stof
Copy link
Member Author

stof commented Oct 5, 2015

@dunglas normalizers are not an internal API. they are the extension point we provide to users, and so we expect to see implementations of the interface outside the component.
Internal classes/interfaces are classes/interfaces that a user should not be using directly when using Symfony. Any interface used to provide an extension point does not qualify for that.

@dunglas
Copy link
Member

dunglas commented Oct 5, 2015

I'm not speaking about the interface but about implementations such as ObjectNormalizer. It's API can change in the way described by the old BC promise (not marked as @api).

@stof
Copy link
Member Author

stof commented Oct 5, 2015

@dunglas no. It is simply that it was merged in Symfony after the last time we maintained the @api tags. this is one of the reason of the removal: our current set of @api tags is totally meaningless as it is far from being complete.

@stof
Copy link
Member Author

stof commented Oct 5, 2015

and this class is still meant to be used by users of the component, so it is not internal.

weaverryan added a commit to symfony/symfony-docs that referenced this issue Nov 5, 2015
… and API classes (xabbuh)

This PR was merged into the 2.3 branch.

Discussion
----------

[Contributing][Code] do not distinguish regular classes and API classes

| Q             | A
| ------------- | ---
| Doc fix?      | no
| New docs?     | kind of (symfony/symfony#15977, symfony/symfony#15979)
| Applies to    | all
| Fixed tickets |

Commits
-------

9794d58 do not distinguish regular classes and API classes
xabbuh added a commit to symfony/symfony-docs that referenced this issue Dec 31, 2015
This PR was merged into the 2.3 branch.

Discussion
----------

Remove references to API tagging

| Q             | A
| ------------- | ---
| Doc fix?      | yes
| New docs?     | no
| Applies to    | 2.3
| Fixed tickets | n/a

Related to symfony/symfony#15977 and symfony/symfony#15979.

Commits
-------

d816c7f Remove references to API tagging
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

5 participants