8000 Add machine readable events by dawehner · Pull Request #12299 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Add machine readable events #12299

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
wants to merge 1 commit into from
Closed

Conversation

dawehner
Copy link
Contributor

As discussed in [#11878] it would be great to have some simple machine readable way to find events

Q A
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #11878
License MIT

@linaori
Copy link
Contributor
linaori commented Oct 23, 2014

I'm not really a fan of useless annotations. What about just creating a command that parses all classes that have the "Events" suffix? This would also make it easier to parse 3rd party packages and list optional events if they follow the same system.

@stof
Copy link
Member
stof commented Oct 23, 2014

@iltar the idea here is to give a hint to phpdoc generators.

And a command parsing classes ending with Events would have to parse all files in the project to find them, which would be quite inefficient.

@linaori
Copy link
Contributor
linaori commented Oct 23, 2014

@stof Having 3rd party bundles adapt to this standard will probably even take longer, where as it might be a lot more common for people to name their their classes *Events. I know I have done that and I think doctrine has this as well. Making 3rd party bundles adapt to a documentation/annotation standard is a lot harder and more work than scanning for an already existing pattern.

Annotations also have the side effect of being used by parsers and IDEs. With a common name like Category, who knows what breaks. Who knows what custom Annotation readers will break on this? Side effects will most likely be limited, but in my opinion, a (slow but cachable) file scanner should be a better solution and show more possible events.

I think the goal of this is to not only document Symfony events, because they are already documented, but also to gather all events and mark which are being listened to. On systems that have access to "find", this can even be an extremely fast one liner in bash.

@dawehner
Copy link
Contributor Author

@iltar
I think having 3rd party bundles adapting to that standard is kind of a weak point, given that there is currently not a really standard anyway.

The one big reason why having some annotation (you could also say that its just a ordinary phpdoc) is that doc tools out there already understand this. Parsing by classname in each file is way more specific compared to every common features, for example listing documentation by group.

@dawehner
Copy link
Contributor Author
dawehner commented Nov 9, 2014

Can someone explain me what bits here are wrong? There is a contribution header up there, changing documentation should also not let travis fail completly! Any idea?

@wouterj
Copy link
Member
wouterj commented Nov 9, 2014

@dawehner fabpot is only run when a new commit is pushed. It doesn't detect message changes in the PR description. I assume you didn't have the table when creating this PR?
Also, travis is not failing because of this.
Besides that,

@dawehner
Copy link
Contributor Author
dawehner commented Nov 9, 2014

Okay ... rebased so updated.

@wouterj Did you maybe forgot to write down your full sentence.

@linaori
Copy link
Contributor
linaori commented Nov 10, 2014

@dawehner the thing is, I really don't see why you would want to list all events known from only symfony. They are already documented on the website.. What I _do_find interesting, is being able to list all events available from all my vendors.

@dawehner
Copy link
Contributor Author

@iltar
Indeed this is the point, thank you. With that standard Drupal can also use the standard and mark
the events, same as other bundles out there. Its an opt IN thing

@linaori
Copy link
Contributor
linaori commented Nov 10, 2014

@dawehner That's why I think an @category won't work. It's a convention symfony might follow, but it takes a long time for everyone to adapt to this, if they even bother.

@fabpot
Copy link
Member
fabpot commented Nov 10, 2014

Looks like something that does not hurt us, so I'm 👍

@fabpot
Copy link
Member
fabpot commented Nov 12, 2014

@category has a very specific use for phpdocs, so I'm wondering if it would be better to choose something else. What do you think @mvriel?

@dawehner
Copy link
Contributor Author

I would love to be able to use @group but I haven't found any information about that specific tag on phpdoc. Drupal uses it pretty mmuch everywhere already

@mvriel
Copy link
mvriel commented Nov 13, 2014

@fabpot I also think another tag name might be more well suited. With @category people are able to mention a top level grouping above @Package.

Even though it is under discussion for PSR-5, this tag name might still cause some confusion for people who have used docblocks for a long time

@fabpot
Copy link
Member
fabpot commented Nov 13, 2014

So, what about a @event tag instead? Like Doctrine has an @annotation one.

@dawehner
Copy link
Contributor Author

I would be totally fine with that as well

@fabpot
Copy link
Member
fabpot commented Nov 16, 2014

@dawehner Can you make the change? I think we need to use @Event to be consistent with the Doctrine @Annotation.

@dawehner
Copy link
Contributor Author

Sure, just was slacking around

@fabpot
Copy link
Member
fabpot commented Nov 16, 2014

Thank you @dawehner.

fabpot added a commit that referenced this pull request Nov 16, 2014
This PR was submitted for the master branch but it was merged into the 2.3 branch instead (closes #12299).

Discussion
----------

Add machine readable events

As discussed in [#11878] it would be great to have some simple machine readable way to find events

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #11878
| License       | MIT

Commits
-------

ace9a22 Add machine readable events
@fabpot fabpot closed this Nov 16, 2014
fabpot added a commit that referenced this pull request Oct 4, 2016
This PR was submitted for the master branch but it was merged into the 3.1 branch instead (closes #20156).

Discussion
----------

Fix event annotation for arguments resolving event

| Q             | A
| ------------- | ---
| Branch?       | 3.1
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #12299
| License       | MIT
| Doc PR        | -

Commits
-------

384d0ee Fix event annotation for arguments resolving event
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 this pull request may close these issues.

6 participants
0