Skip to content

Latest commit

 

History

History
176 lines (111 loc) · 4.4 KB

typo3_rules.md

File metadata and controls

176 lines (111 loc) · 4.4 KB

7 Rules Overview

DoNotUseConstantsInConfigurationFilesRule

Do not use constants TYPO3_MODE and TYPO3_REQUESTTYPE in ext_localconf.php or ext_tables.php

if (TYPO3_MODE === 'BE') {
    $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_pagerenderer.php']['render-preProcess'][$packageKey] = \Prefix\MyExtension\PageRendererHooks::class . '->renderPreProcess';
}


$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_pagerenderer.php']['render-preProcess'][$packageKey] = \Prefix\MyExtension\PageRendererHooks::class . '->renderPreProcess';

👍


DoNotUseDeclareInConfigurationFilesRule

Do not use declare statements in ext_localconf.php or ext_tables.php

declare(strict_types=1)

$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_pagerenderer.php']['render-preProcess'][$packageKey] = \Prefix\MyExtension\PageRendererHooks::class . '->renderPreProcess';


$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_pagerenderer.php']['render-preProcess'][$packageKey] = \Prefix\MyExtension\PageRendererHooks::class . '->renderPreProcess';

👍


DoNotUseImplicitVariableInConfigurationFilesRule

Do not use $_EXTKEY and $_EXTCONF in ext_localconf.php or ext_tables.php

$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_pagerenderer.php']['render-preProcess'][$_EXTKEY] = \Prefix\MyExtension\PageRendererHooks::class . '->renderPreProcess';


$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_pagerenderer.php']['render-preProcess']['my_extension_key'] = \Prefix\MyExtension\PageRendererHooks::class . '->renderPreProcess';

👍


DoNotUseNullableConstructorRule

Do not use nullable constructor arguments for classes. Use Symfony Dependency Injection Configuration properly.

public function __construct(?MyService $myService = null)


public function __construct(MyService $myService)

👍


DoNotUseUseInConfigurationFilesRule

Do not use statements but FQN in ext_localconf.php or ext_tables.php

use \Prefix\MyExtension\PageRendererHooks;

$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_pagerenderer.php']['render-preProcess'][$packageKey] = PageRendererHooks::class . '->renderPreProcess';


$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_pagerenderer.php']['render-preProcess'][$packageKey] = \Prefix\MyExtension\PageRendererHooks::class . '->renderPreProcess';

👍


MissingDefaultValueForTypedPropertyRule

Missing default value for property "property" in class "MissingDefaultValueForTypedProperty"

final class MissingDefaultValueForTypedProperty extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
    protected string $property;
}


final class MissingDefaultValueForTypedProperty extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
    protected string $property = '';
}

👍


MissingVarAnnotationForPropertyInEntityClassRule

Missing var annotation for property "property" in class "MissingDocblock"

final class MissingDocblock extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
    protected ?string $property = null;
}


final class MissingDocblock extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
    /**
     * @var string|null
     */
    protected ?string $property = null;
}

👍