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

Skip to content

added logging of unused tags #15963

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

Merged
merged 3 commits into from
Sep 28, 2015
Merged

added logging of unused tags #15963

merged 3 commits into from
Sep 28, 2015

Conversation

fabpot
Copy link
Member

@fabpot fabpot commented Sep 28, 2015

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #11511, #11744
License MIT
Doc PR -

This is the same as #11744 but with some minor tweaks and some unit tests for the compiler pass.

$tags = array_values(array_diff($this->findTags(), $this->usedTags));
$tags = array_unique($tags);

return $tags;
Copy link
Contributor

Choose a reason for hiding this comment

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

return array_unique($tags) (overwriting variables usually not nice)

Copy link
Contributor

Choose a reason for hiding this comment

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

actually, the array_unique is useless because findTags already ensures that

Copy link
Member Author

Choose a reason for hiding this comment

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

yep

@Tobion
Copy link
Contributor

Tobion commented Sep 28, 2015

IMO it's enough to add the UnusedTagsPass only in debug mode.

* @var array
*/
protected $whitelist = array(
"console.command",
Copy link
Contributor

Choose a reason for hiding this comment

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

use single quotes please

Copy link
Member Author

Choose a reason for hiding this comment

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

indeed

@fabpot fabpot force-pushed the unused_tags branch 2 times, most recently from 9dcab2b to 2054135 Compare September 28, 2015 16:33
@fabpot
Copy link
Member Author

fabpot commented Sep 28, 2015

Indeed, the pass is now only enabled on debug. That makes sense as the compile log is only dumped in debug mode anyway.

Should be ready now.

/**
* Returns all tags not queried by findTaggedServiceIds
*
* @return array An array of tags
Copy link
Contributor

Choose a reason for hiding this comment

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

lets use string[] to be more specific

@Tobion
Copy link
Contributor

Tobion commented Sep 28, 2015

👍

Status: Reviewed

@fabpot
Copy link
Member Author

fabpot commented Sep 28, 2015

Thank you @Marmelatze.

@fabpot fabpot merged commit 95c9f50 into symfony:2.8 Sep 28, 2015
fabpot added a commit that referenced this pull request Sep 28, 2015
This PR was merged into the 2.8 branch.

Discussion
----------

added logging of unused tags

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #11511, #11744
| License       | MIT
| Doc PR        | -

This is the same as #11744 but with some minor tweaks and some unit tests for the compiler pass.

Commits
-------

95c9f50 added some tests
d3271e1 missing tags in whitelist
f51fe4a [FrameworkBundle] [DependencyInjection] added logging of unused tags during container compilation
@fabpot fabpot mentioned this pull request Nov 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants