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

[PSR-19] Proposal for adding generated tag #1249

Merged
merged 3 commits into from Oct 27, 2021

Conversation

ezimuel
Copy link
Contributor

@ezimuel ezimuel commented Aug 17, 2021

This PR is a proposal to add a @generated tag in PSR-19. This tag indicates that the code has been generated using an automation script. This is quite common in projects where the code is generated from a specification (e.g. OpenAPI). This tag should be used to warn to do not change the code, since the change will be overwritten by the
automation script.

For instance, you can mark a PHP class that has been generated using a script, as follows:

/**
 * Index a document in Elasticsearch
 * 
 * @generated class generated using bin/script.php, please DO NOT EDIT!
 * 
 * @version 7.14.0 Elasticsearch
 */
class Index
{
    <...>
}

The comment in the @generated class can useful to give information about the automation script. In this way people can contribute to the automation script rather than doing the mistake of chaning the code manually.
Moreover, the @generated tag can be used to automate alert (e.g. using Github Action) for manual change in the code.

@ezimuel ezimuel requested a review from ashnazg August 17, 2021 10:29
proposed/phpdoc-tags.md Outdated Show resolved Hide resolved
proposed/phpdoc-tags.md Outdated Show resolved Hide resolved
ezimuel and others added 2 commits August 20, 2021 11:02
Co-authored-by: Adrien Crivelli <adrien.crivelli@gmail.com>
Co-authored-by: Adrien Crivelli <adrien.crivelli@gmail.com>
@ezimuel
Copy link
Contributor Author

ezimuel commented Aug 20, 2021

Thanks @PowerKiKi for your suggestions.

Copy link
Contributor Author

@ezimuel ezimuel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestions applied

@ezimuel
Copy link
Contributor Author

ezimuel commented Aug 30, 2021

@ashnazg may you review this PR? Let me know if you have time, thanks.

@ashnazg
Copy link
Contributor

ashnazg commented Oct 27, 2021

Looks ok.

@ezimuel
Copy link
Contributor Author

ezimuel commented Oct 27, 2021

Thanks @ashnazg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants