TASK: Document new feature in docs

This commit is contained in:
Daniel Siepmann 2017-04-25 15:36:47 +02:00
parent 28329844b8
commit 5428b3805f
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4
2 changed files with 39 additions and 0 deletions

View file

@ -156,3 +156,24 @@ Example:
.. code:: bash .. code:: bash
--runtime-set removedConstantConfigFiles "/Some/Absolute/Path/*.yaml" --runtime-set removedConstantConfigFiles "/Some/Absolute/Path/*.yaml"
.. _configuration-features:
features
--------
Configure where to look for configuration files defining the feature mappings. Default is
``Configuration/Features/*.yaml`` inside the standard itself. Globing is used, so placeholders like
``*`` are possible, see https://secure.php.net/manual/en/function.glob.php
Using :file:`ruleset.xml`:
.. code:: xml
<config name="features" value="/Some/Absolute/Path/*.yaml"/>
Example:
.. code:: bash
--runtime-set features "/Some/Absolute/Path/*.yaml"

View file

@ -24,6 +24,24 @@ The following resources might be helpful during working with ``phpcs``:
- :file:`CodeSniffer/File.php` - :file:`CodeSniffer/File.php`
.. _extending-features:
Features
--------
Sniffs do not always add errors or warnings in our standard, instead for more flexibility, we use
them to find specific "tokens", e.g. class names. We then attach so called *Features* to sniffs to
work on that token.
E.g. we deliver the Feature ``LegacyClassnameFeature`` which will check whether a given class name
is legacy and should be replaced. As class names may occur in many places like type hints or php doc
blocks, the sniffs will detect the class names and the feature will work on them.
Features can be attached to the sniffs. A feature has to implement the ``FeatureInterface`` and will
work on tokens found by sniffs.
To attach a Feature to Sniffs, provide a yaml-configuration, see :ref:`configuration-features`.
.. _extending-tests: .. _extending-tests:
Tests Tests