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

[feat] Adds support for ignoring a file on a specific sniff #182

Merged
merged 5 commits into from
Jun 16, 2019

Conversation

olivernybroe
Copy link
Collaborator

Q A
Bug fix? yes
New feature? yes
Fixed tickets #...

This PR adds support for ignoring specific files on a specific sniff.
So for example if I don't want to see the unused property, I can add that file to an array of files which the unused property sniff should ignore.

This is implemented by wrappgin all sniffs in a custom sniff.
The purpouse of this PR is to add this sniff wrapper class, ignoring with a specific file is just an example of usecase for this wrapper.
Using this wrapper we can add support for ignoring sniffs on a bunch of other stuffs, like a method name and so on.

For using the ignore file property, just set it like any other property in your config for a sniff.

              'config' => [
                   OneClassPerFileSniff::class => [
                       'ignoreFiles' => [
                           __DIR__ . '/../../Fixtures/Domain/Sniffs/SniffWrapper/FileWithTwoClasses.php'
                       ]
                   ]
               ]

This means we can now add custom settings for all sniffs.
…to sniffwrapper

# Conflicts:
#	tests/Domain/Sniffs/ForbiddenSetterMethods/ForbiddenSetterMethodsTest.php
@olivernybroe olivernybroe added the enhancement New feature or request label Jun 16, 2019
@nunomaduro nunomaduro merged commit 2be92fc into nunomaduro:master Jun 16, 2019
@nunomaduro
Copy link
Owner

@olivernybroe Great idea buddy and great code aswell, can you add something on the docs concerning this new feature?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants