From 5428b3805fd3b8ce50ca44e76565ca0d64e1d765 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Tue, 25 Apr 2017 15:36:47 +0200 Subject: [PATCH] TASK: Document new feature in docs --- Documentation/source/configuration.rst | 21 +++++++++++++++++++++ Documentation/source/extending.rst | 18 ++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/Documentation/source/configuration.rst b/Documentation/source/configuration.rst index 49a00ba..94c1d55 100644 --- a/Documentation/source/configuration.rst +++ b/Documentation/source/configuration.rst @@ -156,3 +156,24 @@ Example: .. code:: bash --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 + + + +Example: + +.. code:: bash + + --runtime-set features "/Some/Absolute/Path/*.yaml" diff --git a/Documentation/source/extending.rst b/Documentation/source/extending.rst index 05748bb..8ae8d32 100644 --- a/Documentation/source/extending.rst +++ b/Documentation/source/extending.rst @@ -24,6 +24,24 @@ The following resources might be helpful during working with ``phpcs``: - :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: Tests