Commit 7b919798 authored by Alexander Schnitzler's avatar Alexander Schnitzler Committed by Benni Mack
Browse files

[TASK] Set php header comment via php-cs-fixer

With this patch, the header comment of php files is
automatically added by the php-cs-fixer, which guarantees
that its format and place of occurrence remain the same
in all files.

Files that are copied over from other projects are excluded.

Furthermore, files that are kind of inspired by other
projects also get the same header comment but may have
a second, additional comment explaining its origin.

Used command:

    bin/php-cs-fixer fix --config=Build/php-cs-fixer/header-comment.php

Releases: master
Resolves: #91024
Change-Id: I5a040517e0fbde6e5a27d589bf2f222078326dc8
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64159

Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
parent b381d9aa
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
if (PHP_SAPI !== 'cli') {
die('This script supports command line usage only. Please check your command.');
}
$finder = PhpCsFixer\Finder::create()
->files()
->name('*.php')
->in([
__DIR__ . '/../../typo3/sysext/*/Classes/',
__DIR__ . '/../../typo3/sysext/*/Tests/',
__DIR__ . '/../../typo3/sysext/core/Tests/Functional/Fixtures/Extensions/irre_tutorial/Classes/',
__DIR__ . '/../../typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_datahandler/Classes/',
__DIR__ . '/../../typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_meta/Classes/',
__DIR__ . '/../../typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/blog_example/Classes/',
__DIR__ . '/../../typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/class_overriding/a/Classes/',
__DIR__ . '/../../typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/class_overriding/b/Classes/',
__DIR__ . '/../../typo3/sysext/fluid/Tests/Functional/Fixtures/Extensions/fluid_test/Classes/',
])
->exclude('Unit/Core/Fixtures/test_extension/') // EXT:core
->exclude('Functional/Configuration/SiteConfiguration/Fixtures/Extensions/conf_overriding/') // EXT:core
->exclude('Functional/Fixtures/Extensions/irre_tutorial/') // EXT:core
->exclude('Functional/Fixtures/Extensions/test_datahandler/') // EXT:core
->exclude('Functional/Fixtures/Extensions/test_meta/') // EXT:core
->exclude('Functional/Fixtures/Extensions/test_resources/') // EXT:core
->exclude('Functional/Category/Collection/Fixtures/Extensions/test/') // EXT:core
->exclude('Functional/Database/Fixtures/Extensions/test_expressionbuilder/') // EXT:core
->exclude('Unit/Http/Fixtures/Package1') // EXT:core
->exclude('Unit/Http/Fixtures/Package2') // EXT:core
->exclude('Unit/Http/Fixtures/Package2Disables1') // EXT:core
->exclude('Unit/Http/Fixtures/Package2Replaces1') // EXT:core
->exclude('Functional/Fixtures/Extensions/blog_example/') // EXT:extbase
->exclude('Functional/Fixtures/Extensions/class_overriding/a/') // EXT:extbase
->exclude('Functional/Fixtures/Extensions/class_overriding/b/') // EXT:extbase
->exclude('Functional/Fixtures/Extensions/template_extension/') // EXT:impexp
->exclude('Functional/Hooks/Fixtures/test_resources/') // EXT:form
->exclude('Functional/Fixtures/Extensions/fluid_test/') // EXT:fluid
->exclude('Unit/Service/Fixtures/') // EXT:form
->exclude('Acceptance/Support/_generated') // EXT:core
->notName('Rfc822AddressesParser.php')
->notName('AdditionalConfiguration.php')
->notName('ext_localconf.php')
->notName('ext_tables.php')
->notName('ext_emconf.php')
->notName('install.php')
->notName('index.php')
;
$headerComment = <<<COMMENT
This file is part of the TYPO3 CMS project.
It is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License, either version 2
of the License, or any later version.
For the full copyright and license information, please read the
LICENSE.txt file that was distributed with this source code.
The TYPO3 project - inspiring people to share!
COMMENT;
return PhpCsFixer\Config::create()
->setRiskyAllowed(false)
->setRules([
'header_comment' => [
'header' => $headerComment,
'comment_type' => 'comment',
'separate' => 'both',
'location' => 'after_declare_strict'
],
])
->setFinder($finder);
<?php
namespace TYPO3\CMS\About\Controller;
/*
* This file is part of the TYPO3 CMS project.
*
......@@ -15,6 +13,8 @@ namespace TYPO3\CMS\About\Controller;
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\About\Controller;
use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Backend\Module\ModuleLoader;
use TYPO3\CMS\Backend\Template\ModuleTemplate;
......
......@@ -2,8 +2,6 @@
declare(strict_types=1);
namespace TYPO3\CMS\Adminpanel\Controller;
/*
* This file is part of the TYPO3 CMS project.
*
......@@ -17,6 +15,8 @@ namespace TYPO3\CMS\Adminpanel\Controller;
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Adminpanel\Controller;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Adminpanel\Service\ConfigurationService;
use TYPO3\CMS\Adminpanel\Service\ModuleLoader;
......
......@@ -2,8 +2,6 @@
declare(strict_types=1);
namespace TYPO3\CMS\Adminpanel\Controller;
/*
* This file is part of the TYPO3 CMS project.
*
......@@ -17,6 +15,8 @@ namespace TYPO3\CMS\Adminpanel\Controller;
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Adminpanel\Controller;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Adminpanel\ModuleApi\ConfigurableInterface;
use TYPO3\CMS\Adminpanel\ModuleApi\DataProviderInterface;
......
......@@ -2,8 +2,6 @@
declare(strict_types=1);
namespace TYPO3\CMS\Adminpanel\Exceptions;
/*
* This file is part of the TYPO3 CMS project.
*
......@@ -17,6 +15,8 @@ namespace TYPO3\CMS\Adminpanel\Exceptions;
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Adminpanel\Exceptions;
/**
* Exception class for invalid admin panel configuration
*/
......
......@@ -2,8 +2,6 @@
declare(strict_types=1);
namespace TYPO3\CMS\Adminpanel\Log;
/*
* This file is part of the TYPO3 CMS project.
*
......@@ -17,6 +15,8 @@ namespace TYPO3\CMS\Adminpanel\Log;
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Adminpanel\Log;
use Doctrine\DBAL\Logging\SQLLogger;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
......
......@@ -2,8 +2,6 @@
declare(strict_types=1);
namespace TYPO3\CMS\Adminpanel\Log;
/*
* This file is part of the TYPO3 CMS project.
*
......@@ -17,6 +15,8 @@ namespace TYPO3\CMS\Adminpanel\Log;
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Adminpanel\Log;
use TYPO3\CMS\Adminpanel\Utility\MemoryUtility;
use TYPO3\CMS\Core\Log\LogLevel;
use TYPO3\CMS\Core\Log\LogRecord;
......
......@@ -2,8 +2,6 @@
declare(strict_types=1);
namespace TYPO3\CMS\Adminpanel\Middleware;
/*
* This file is part of the TYPO3 CMS project.
*
......@@ -17,6 +15,8 @@ namespace TYPO3\CMS\Adminpanel\Middleware;
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Adminpanel\Middleware;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
......
......@@ -2,8 +2,6 @@
declare(strict_types=1);
namespace TYPO3\CMS\Adminpanel\Middleware;
/*
* This file is part of the TYPO3 CMS project.
*
......@@ -17,6 +15,8 @@ namespace TYPO3\CMS\Adminpanel\Middleware;
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Adminpanel\Middleware;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
......
......@@ -2,8 +2,6 @@
declare(strict_types=1);
namespace TYPO3\CMS\Adminpanel\Middleware;
/*
* This file is part of the TYPO3 CMS project.
*
......@@ -17,6 +15,8 @@ namespace TYPO3\CMS\Adminpanel\Middleware;
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Adminpanel\Middleware;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
......
......@@ -2,8 +2,6 @@
declare(strict_types=1);
namespace TYPO3\CMS\Adminpanel\Middleware;
/*
* This file is part of the TYPO3 CMS project.
*
......@@ -17,6 +15,8 @@ namespace TYPO3\CMS\Adminpanel\Middleware;
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Adminpanel\Middleware;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
......
......@@ -2,8 +2,6 @@
declare(strict_types=1);
namespace TYPO3\CMS\Adminpanel\ModuleApi;
/*
* This file is part of the TYPO3 CMS project.
*
......@@ -17,6 +15,8 @@ namespace TYPO3\CMS\Adminpanel\ModuleApi;
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Adminpanel\ModuleApi;
use TYPO3\CMS\Adminpanel\Service\ConfigurationService;
use TYPO3\CMS\Backend\FrontendBackendUserAuthentication;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
......
......@@ -2,8 +2,6 @@
declare(strict_types=1);
namespace TYPO3\CMS\Adminpanel\ModuleApi;
/*
* This file is part of the TYPO3 CMS project.
*
......@@ -17,6 +15,8 @@ namespace TYPO3\CMS\Adminpanel\ModuleApi;
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Adminpanel\ModuleApi;
use TYPO3\CMS\Core\Localization\LanguageService;
/**
......
......@@ -2,8 +2,6 @@
declare(strict_types=1);
namespace TYPO3\CMS\Adminpanel\ModuleApi;
/*
* This file is part of the TYPO3 CMS project.
*
......@@ -17,6 +15,8 @@ namespace TYPO3\CMS\Adminpanel\ModuleApi;
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Adminpanel\ModuleApi;
/**
* AdminPanel ConfigurableInterface
*
......
......@@ -2,8 +2,6 @@
declare(strict_types=1);
namespace TYPO3\CMS\Adminpanel\ModuleApi;
/*
* This file is part of the TYPO3 CMS project.
*
......@@ -17,6 +15,8 @@ namespace TYPO3\CMS\Adminpanel\ModuleApi;
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Adminpanel\ModuleApi;
/**
* Adminpanel interface to denote that a module has content to be rendered
*
......
......@@ -2,8 +2,6 @@
declare(strict_types=1);
namespace TYPO3\CMS\Adminpanel\ModuleApi;
/*
* This file is part of the TYPO3 CMS project.
*
......@@ -17,6 +15,8 @@ namespace TYPO3\CMS\Adminpanel\ModuleApi;
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Adminpanel\ModuleApi;
use Psr\Http\Message\ServerRequestInterface;
/**
......
......@@ -2,8 +2,6 @@
declare(strict_types=1);
namespace TYPO3\CMS\Adminpanel\ModuleApi;
/*
* This file is part of the TYPO3 CMS project.
*
......@@ -17,6 +15,8 @@ namespace TYPO3\CMS\Adminpanel\ModuleApi;
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Adminpanel\ModuleApi;
use Psr\Http\Message\ServerRequestInterface;
/**
......
......@@ -2,8 +2,6 @@
declare(strict_types=1);
namespace TYPO3\CMS\Adminpanel\ModuleApi;
/*
* This file is part of the TYPO3 CMS project.
*
......@@ -17,6 +15,8 @@ namespace TYPO3\CMS\Adminpanel\ModuleApi;
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Adminpanel\ModuleApi;
/**
* ModuleDataStorageCollection is an object storage for adminpanel modules and their data
*/
......
......@@ -2,8 +2,6 @@
declare(strict_types=1);
namespace TYPO3\CMS\Adminpanel\ModuleApi;
/*
* This file is part of the TYPO3 CMS project.
*
......@@ -17,6 +15,8 @@ namespace TYPO3\CMS\Adminpanel\ModuleApi;
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Adminpanel\ModuleApi;
/**
* Adminpanel interface for all modules
*
......
......@@ -2,8 +2,6 @@
declare(strict_types=1);
namespace TYPO3\CMS\Adminpanel\ModuleApi;
/*
* This file is part of the TYPO3 CMS project.
*
......@@ -17,6 +15,8 @@ namespace TYPO3\CMS\Adminpanel\ModuleApi;
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Adminpanel\ModuleApi;
/**
* Adminpanel module settings interface denotes that a module has own settings.
*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment