Merge pull request #37 from DanielSiepmann/feature/make-mapping-path-configurable
FEATURE: Make path to mapping file configurable
This commit is contained in:
commit
6eeeb50ecb
2 changed files with 23 additions and 2 deletions
16
Readme.rst
16
Readme.rst
|
@ -136,3 +136,19 @@ Typo3Update.LegacyClassnames.DocComment: ``allowedTags``
|
|||
<property name="allowedTags" type="array" value="@param,@return,@var,@see,@throws"/>
|
||||
</properties>
|
||||
</rule>
|
||||
|
||||
``mappingFile``
|
||||
Configure where the `LegacyClassnames.php` is located, through ``ruleset.xml`` or using
|
||||
``--runtime-set``. Default is `LegacyClassnames.php` in the project root.
|
||||
|
||||
Example:
|
||||
|
||||
.. code:: xml
|
||||
|
||||
<config name="mappingFile" value="/projects/typo3_installation/vendor/composer/autoload_classaliasmap.php"/>
|
||||
|
||||
Example:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
--runtime-set mappingFile /projects/typo3_installation/vendor/composer/autoload_classaliasmap.php
|
||||
|
|
|
@ -20,6 +20,7 @@ namespace Typo3Update\Sniffs\LegacyClassnames;
|
|||
* 02110-1301, USA.
|
||||
*/
|
||||
|
||||
use PHP_CodeSniffer as PhpCs;
|
||||
use PHP_CodeSniffer_File as PhpCsFile;
|
||||
|
||||
/**
|
||||
|
@ -44,10 +45,14 @@ trait ClassnameCheckerTrait
|
|||
public $legacyExtensions = ['Extbase', 'Fluid'];
|
||||
|
||||
/**
|
||||
* @param string $mappingFile File containing php array for mapping.
|
||||
* Initialize, used internally, to not initialize if not needed inside __construct.
|
||||
*/
|
||||
private function initialize($mappingFile = __DIR__ . '/../../../../../LegacyClassnames.php')
|
||||
private function initialize()
|
||||
{
|
||||
$mappingFile = PhpCs::getConfigData('mappingFile');
|
||||
if (!$mappingFile) {
|
||||
$mappingFile = __DIR__ . '/../../../../../LegacyClassnames.php';
|
||||
}
|
||||
if ($this->legacyClassnames !== []) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue