automated-typo3-update/Documentation/source/configuration.rst

5.2 KiB

Configuration

Configuration is done through PHPCS Standards, e.g. provide a custom ruleset.xml or inside your project using a phpcs.xml.dist. As this is just a PHPCS-Standard, the official documentation applies.

All options available in ruleset.xml are also available in your phpcs.xml files, as already documented by phpcs itself. Therefore this documentation will just mention ruleset.xml.

Beside that, some options are also available through CLI. Examples are always provided.

To disable warnings for specific deprecated parts, e.g. a specific function, you can use the full sniff name, as we try to add the concrete constant or function name to the sniff. Just run phpcs with the -s option to see sniff names.

The following configuration options are available:

legacyExtensions

Configures which extension names are legacy. Used to provide further checks and warnings about possible legacy code. All class usages starting with Tx_<ExtensionName> where ExtensionName is defined in this array, will produce a warning, until the class is already found to be deprecaed.

Can and have to be configured for each sniff, e.g. Instanceof and PhpDocComment.

Example:

<rule ref="Typo3Update.Classname.Instanceof">
    <properties>
        <property name="legacyExtensions" type="array" value="Extbase,Fluid,Frontend,Core"/>
    </properties>
</rule>

allowedTags

Only used inside Sniff Typo3Update.Classname.PhpDocComment.

Configures which tags are checked for legacy class names.

This way you can add checks for further tags you are using. All strings inside the tag are checked, so no matter where the class name occurs inside the tag.

Example:

<rule ref="Typo3Update.Classname.PhpDocComment">
    <properties>
        <property name="allowedTags" type="array" value="@param,@return,@var,@see,@throws"/>
    </properties>
</rule>

mappingFile

For auto migrating usages of old class names, a PHP file with a mapping is required. The file has to be in the composer structure autoload_classaliasmap.php. If TYPO3 is already installed using composer, you can use this file through configuration, or by copying to the default location, which is LegacyClassnames.php in the root of this project.

Configure where the LegacyClassnames.php is located, through ruleset.xml or using --runtime-set. Default is LegacyClassnames.php in the project root.

Using ruleset.xml:

<config name="mappingFile" value="/projects/typo3_installation/vendor/composer/autoload_classaliasmap.php"/>

Using runtime-set:

--runtime-set mappingFile /projects/typo3_installation/vendor/composer/autoload_classaliasmap.php

vendor

Used while adding namespaces to legacy class definitions and updating plugin and module registrations. Default is YourCompany to enable you to search and replace afterwards.

If you use multiple vendors through your projects, use the cli to define the vendor and run phpcbf over specific folders, this way you can update your project step by step with different vendors.

Using ruleset.xml:

<config name="vendor" value="YourVendor"/>

Example:

--runtime-set vendor YourVendor

removedFunctionConfigFiles

Configure where to look for configuration files defining the removed functions and methods. Default is Configuration/Removed/Functions/*.yaml inside the standard itself. We already try to deliver as much as possible. Globing is used, so placeholders like * are possible, see https://secure.php.net/manual/en/function.glob.php

Using ruleset.xml:

<config name="removedFunctionConfigFiles" value="/Some/Absolute/Path/*.yaml"/>

Example:

--runtime-set removedFunctionConfigFiles "/Some/Absolute/Path/*.yaml"

removedConstantConfigFiles

Configure where to look for configuration files defining the removed constants. Default is Configuration/Removed/Functions/*.yaml inside the standard itself. We already try to deliver as much as possible. Globing is used, so placeholders like * are possible, see https://secure.php.net/manual/en/function.glob.php

Using ruleset.xml:

<config name="removedConstantConfigFiles" value="/Some/Absolute/Path/*.yaml"/>

Example:

--runtime-set removedConstantConfigFiles "/Some/Absolute/Path/*.yaml"

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 ruleset.xml:

<config name="features" value="/Some/Absolute/Path/*.yaml"/>

Example:

--runtime-set features "/Some/Absolute/Path/*.yaml"