2017-03-07 11:52:52 +01:00
|
|
|
.. _highlight: bash
|
|
|
|
|
|
|
|
About
|
|
|
|
=====
|
|
|
|
|
|
|
|
Our goal is to provide an automated migration for TYPO3 updates.
|
|
|
|
|
|
|
|
This should include source code modifications like adjusting old legacy class names to new ones.
|
|
|
|
|
|
|
|
Requirements
|
|
|
|
============
|
|
|
|
|
|
|
|
- ``composer`` needs to be installed and inside your ``$PATH``.
|
|
|
|
|
|
|
|
Installation
|
|
|
|
============
|
|
|
|
|
|
|
|
Run::
|
|
|
|
|
|
|
|
make install
|
|
|
|
|
2017-03-09 11:49:41 +01:00
|
|
|
and copy the ``vendor/composer/autoload_classaliasmap.php`` generated by ``composer`` in your TYPO3
|
|
|
|
installation to ``LegacyClassnames.php`` in the root of this project.
|
2017-03-07 11:52:52 +01:00
|
|
|
|
|
|
|
Usage
|
|
|
|
=====
|
|
|
|
|
2017-03-09 11:49:41 +01:00
|
|
|
Run::
|
|
|
|
|
|
|
|
./vendor/bin/phpcbf <path>
|
|
|
|
|
|
|
|
This will run the auto fixer recursive for ``<path>`` fixing all issues.
|
|
|
|
|
|
|
|
Afterwards you should run::
|
|
|
|
|
|
|
|
./vendor/bin/phpcs <path>
|
|
|
|
|
|
|
|
To get information about possible issues that were not autofixed.
|
|
|
|
|
|
|
|
What's included?
|
|
|
|
================
|
|
|
|
|
|
|
|
Currently we can migrate calls to old legacy class names of the TYPO3 core like ``Tx_Extbase...`` to
|
|
|
|
new ones like ``\TYPO3\Extbase\...``. This is done for:
|
|
|
|
|
|
|
|
- PHPDocuments, like Includes and annotations for IDEs.
|
|
|
|
|
|
|
|
- Inheritance like ``extends`` and ``implements``.
|
|
|
|
|
|
|
|
- Static calls like ``t3lib_div::`` to ``\TYPO3\Core\Utility\GeneralUtility``.
|
|
|
|
|
|
|
|
- Typehints in methods and function like injects.
|
2017-03-09 11:57:49 +01:00
|
|
|
|
2017-03-14 08:40:45 +01:00
|
|
|
- ``instanceof`` checks.
|
2017-03-09 11:57:49 +01:00
|
|
|
|
2017-03-14 08:32:21 +01:00
|
|
|
- Inline comments for IDEs, e.g. ``/* @var $configurationManager
|
|
|
|
Tx_Extbase_Configuration_ConfigurationManager */``
|
2017-03-09 11:57:49 +01:00
|
|
|
|
2017-03-14 09:25:45 +01:00
|
|
|
- Instantiation through ``new``.
|
2017-03-09 11:57:49 +01:00
|
|
|
|
2017-03-14 10:06:07 +01:00
|
|
|
- Instantiation through ``makeInstance``.
|
|
|
|
|
2017-03-09 11:57:49 +01:00
|
|
|
What does it look like?
|
|
|
|
=======================
|
|
|
|
|
|
|
|
.. code::
|
|
|
|
|
|
|
|
$ ./vendor/bin/phpcs -p --colors -s <path>
|
|
|
|
E
|
|
|
|
|
|
|
|
|
|
|
|
FILE: <path>
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
FOUND 5 ERRORS AFFECTING 5 LINES
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
8 | ERROR | [x] Legacy classes are not allowed; found
|
|
|
|
| | backend_toolbarItem
|
|
|
|
| | (Typo3Update.LegacyClassnames.Inheritance.legacyClassname)
|
|
|
|
14 | ERROR | [x] Legacy classes are not allowed; found TYPO3backend
|
|
|
|
| | (Typo3Update.LegacyClassnames.DocComment.legacyClassname)
|
|
|
|
16 | ERROR | [x] Legacy classes are not allowed; found TYPO3backend
|
|
|
|
| | (Typo3Update.LegacyClassnames.TypeHint.legacyClassname)
|
|
|
|
48 | ERROR | [x] Legacy classes are not allowed; found t3lib_extMgm
|
|
|
|
| | (Typo3Update.LegacyClassnames.StaticCall.legacyClassname)
|
|
|
|
61 | ERROR | [x] Legacy classes are not allowed; found t3lib_div
|
|
|
|
| | (Typo3Update.LegacyClassnames.StaticCall.legacyClassname)
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
|
|
|
Time: 35ms; Memory: 5Mb
|
2017-03-16 11:06:15 +01:00
|
|
|
|
|
|
|
Configuration
|
|
|
|
=============
|
|
|
|
|
|
|
|
Configuration is done through PHPCS Standards, e.g. provide a custom ``ruleset.xml`` or customize
|
|
|
|
the provided one.
|
|
|
|
|
|
|
|
``legacyExtensions``
|
|
|
|
Configures which extension names are legacy. Used to provide further checks and warnings about
|
|
|
|
possible legacy code. E.g. inside of non auto migrated situations.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
.. code:: xml
|
|
|
|
|
|
|
|
<rule ref="Typo3Update.LegacyClassnames.Instanceof">
|
|
|
|
<properties>
|
|
|
|
<property name="legacyExtensions" type="array" value="Extbase,Fluid,Frontend,Core"/>
|
|
|
|
</properties>
|
|
|
|
</rule>
|