Merge remote-tracking branch 'origin/develop' into feature/36-namespace-migration
* Make mapping file path configurable Relates: #36, #37
This commit is contained in:
commit
5a8260815c
4 changed files with 33 additions and 4 deletions
16
Readme.rst
16
Readme.rst
|
@ -176,3 +176,19 @@ Example:
|
||||||
.. code:: bash
|
.. code:: bash
|
||||||
|
|
||||||
--runtime-set vendor YourVendor
|
--runtime-set vendor YourVendor
|
||||||
|
|
||||||
|
``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.
|
* 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use PHP_CodeSniffer as PhpCs;
|
||||||
use PHP_CodeSniffer_File as PhpCsFile;
|
use PHP_CodeSniffer_File as PhpCsFile;
|
||||||
use PHP_CodeSniffer_Sniff as PhpCsSniff;
|
use PHP_CodeSniffer_Sniff as PhpCsSniff;
|
||||||
use Typo3Update\Sniffs\LegacyClassnames\Mapping;
|
use Typo3Update\Sniffs\LegacyClassnames\Mapping;
|
||||||
|
|
|
@ -50,8 +50,7 @@ class Mapping
|
||||||
}
|
}
|
||||||
private function __construct()
|
private function __construct()
|
||||||
{
|
{
|
||||||
// $mappingFile = $this->getMappingFile();
|
$mappingFile = $this->getMappingFile();
|
||||||
$mappingFile = __DIR__ . '/../../../../../LegacyClassnames.php';
|
|
||||||
|
|
||||||
$this->mappings = require $mappingFile;
|
$this->mappings = require $mappingFile;
|
||||||
}
|
}
|
||||||
|
@ -113,8 +112,7 @@ class Mapping
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// $mappingFile = $this->getMappingFile();
|
$mappingFile = $this->getMappingFile();
|
||||||
$mappingFile = __DIR__ . '/../../../../../LegacyClassnames.php';
|
|
||||||
|
|
||||||
file_put_contents(
|
file_put_contents(
|
||||||
$mappingFile,
|
$mappingFile,
|
||||||
|
|
|
@ -40,4 +40,18 @@ trait OptionsAccessTrait
|
||||||
}
|
}
|
||||||
return trim($vendor, '\\/');
|
return trim($vendor, '\\/');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the configured file path containing the mappings for classes, interfaced and traits.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getMappingFile()
|
||||||
|
{
|
||||||
|
$mappingFile = PhpCs::getConfigData('mappingFile');
|
||||||
|
if (!$mappingFile) {
|
||||||
|
$mappingFile = __DIR__ . '/../../../../LegacyClassnames.php';
|
||||||
|
}
|
||||||
|
return $mappingFile;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue