Switch to ECS for coding style

This allows configuration via PHP.
It also combines code sniffer and php cs fixer.

Used commands:

composer remove --dev squizlabs/php_codesniffer
composer req --dev symplify/easy-coding-standard
./vendor/bin/ecs --fix
This commit is contained in:
Daniel Siepmann 2021-05-21 18:49:38 +02:00
parent 165b110e01
commit adb73eeffc
19 changed files with 37 additions and 26 deletions

View file

@ -140,9 +140,6 @@ jobs:
- name: PHPUnit configuration file - name: PHPUnit configuration file
run: xmllint --schema vendor/phpunit/phpunit/phpunit.xsd --noout phpunit.xml.dist run: xmllint --schema vendor/phpunit/phpunit/phpunit.xsd --noout phpunit.xml.dist
- name: PHPCodeSniffer configuration file
run: xmllint --schema vendor/squizlabs/php_codesniffer/phpcs.xsd --noout phpcs.xml.dist
- name: Fetch schema for xliff - name: Fetch schema for xliff
run: wget https://docs.oasis-open.org/xliff/v1.2/os/xliff-core-1.2-strict.xsd --output-document=.Build/xliff-core-1.2-strict.xsd run: wget https://docs.oasis-open.org/xliff/v1.2/os/xliff-core-1.2-strict.xsd --output-document=.Build/xliff-core-1.2-strict.xsd
@ -151,8 +148,6 @@ jobs:
coding-guideline: coding-guideline:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs:
- xml-linting
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -177,7 +172,7 @@ jobs:
run: composer install --prefer-dist --no-progress --no-suggest run: composer install --prefer-dist --no-progress --no-suggest
- name: Coding Guideline - name: Coding Guideline
run: ./vendor/bin/phpcs run: ./vendor/bin/ecs check
tests-sqlite-TYPO3-v10: tests-sqlite-TYPO3-v10:
runs-on: ubuntu-latest runs-on: ubuntu-latest

View file

@ -23,8 +23,8 @@ namespace DanielSiepmann\Tracking\Tests\Unit\Domain\Model;
use DanielSiepmann\Tracking\Domain\Model\Extractor; use DanielSiepmann\Tracking\Domain\Model\Extractor;
use DanielSiepmann\Tracking\Domain\Model\HasUserAgent; use DanielSiepmann\Tracking\Domain\Model\HasUserAgent;
use TYPO3\TestingFramework\Core\Unit\UnitTestCase as TestCase;
use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\PhpUnit\ProphecyTrait;
use TYPO3\TestingFramework\Core\Unit\UnitTestCase as TestCase;
/** /**
* @covers DanielSiepmann\Tracking\Domain\Model\Extractor * @covers DanielSiepmann\Tracking\Domain\Model\Extractor

View file

@ -22,9 +22,9 @@ namespace DanielSiepmann\Tracking\Tests\Unit\Domain\Model;
*/ */
use DanielSiepmann\Tracking\Domain\Model\Pageview; use DanielSiepmann\Tracking\Domain\Model\Pageview;
use TYPO3\TestingFramework\Core\Unit\UnitTestCase as TestCase;
use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\PhpUnit\ProphecyTrait;
use TYPO3\CMS\Core\Site\Entity\SiteLanguage; use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
use TYPO3\TestingFramework\Core\Unit\UnitTestCase as TestCase;
/** /**
* @covers DanielSiepmann\Tracking\Domain\Model\Pageview * @covers DanielSiepmann\Tracking\Domain\Model\Pageview

View file

@ -22,9 +22,9 @@ namespace DanielSiepmann\Tracking\Tests\Unit\Domain\Model;
*/ */
use DanielSiepmann\Tracking\Domain\Model\Recordview; use DanielSiepmann\Tracking\Domain\Model\Recordview;
use TYPO3\TestingFramework\Core\Unit\UnitTestCase as TestCase;
use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\PhpUnit\ProphecyTrait;
use TYPO3\CMS\Core\Site\Entity\SiteLanguage; use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
use TYPO3\TestingFramework\Core\Unit\UnitTestCase as TestCase;
/** /**
* @covers DanielSiepmann\Tracking\Domain\Model\Recordview * @covers DanielSiepmann\Tracking\Domain\Model\Recordview

View file

@ -23,7 +23,6 @@ namespace DanielSiepmann\Tracking\Tests\Unit\Domain\Pageview;
use DanielSiepmann\Tracking\Domain\Model\Pageview; use DanielSiepmann\Tracking\Domain\Model\Pageview;
use DanielSiepmann\Tracking\Domain\Pageview\Factory; use DanielSiepmann\Tracking\Domain\Pageview\Factory;
use TYPO3\TestingFramework\Core\Unit\UnitTestCase as TestCase;
use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophet; use Prophecy\Prophet;
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ServerRequestInterface;
@ -31,6 +30,7 @@ use TYPO3\CMS\Core\Routing\PageArguments;
use TYPO3\CMS\Core\Site\Entity\Site; use TYPO3\CMS\Core\Site\Entity\Site;
use TYPO3\CMS\Core\Site\Entity\SiteLanguage; use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
use TYPO3\CMS\Core\Site\SiteFinder; use TYPO3\CMS\Core\Site\SiteFinder;
use TYPO3\TestingFramework\Core\Unit\UnitTestCase as TestCase;
/** /**
* @covers DanielSiepmann\Tracking\Domain\Pageview\Factory * @covers DanielSiepmann\Tracking\Domain\Pageview\Factory

View file

@ -25,11 +25,11 @@ use DanielSiepmann\Tracking\Domain\Model\Pageview as Model;
use DanielSiepmann\Tracking\Domain\Pageview\Factory; use DanielSiepmann\Tracking\Domain\Pageview\Factory;
use DanielSiepmann\Tracking\Domain\Repository\Pageview; use DanielSiepmann\Tracking\Domain\Repository\Pageview;
use Doctrine\DBAL\Statement; use Doctrine\DBAL\Statement;
use TYPO3\TestingFramework\Core\Unit\UnitTestCase as TestCase;
use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\PhpUnit\ProphecyTrait;
use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\Connection;
use TYPO3\CMS\Core\Database\Query\QueryBuilder; use TYPO3\CMS\Core\Database\Query\QueryBuilder;
use TYPO3\CMS\Core\Site\Entity\SiteLanguage; use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
use TYPO3\TestingFramework\Core\Unit\UnitTestCase as TestCase;
/** /**
* @covers DanielSiepmann\Tracking\Domain\Repository\Pageview * @covers DanielSiepmann\Tracking\Domain\Repository\Pageview

View file

@ -23,10 +23,10 @@ namespace DanielSiepmann\Tracking\Tests\Unit\Domain\Repository;
use DanielSiepmann\Tracking\Domain\Model\Recordview as Model; use DanielSiepmann\Tracking\Domain\Model\Recordview as Model;
use DanielSiepmann\Tracking\Domain\Repository\Recordview; use DanielSiepmann\Tracking\Domain\Repository\Recordview;
use TYPO3\TestingFramework\Core\Unit\UnitTestCase as TestCase;
use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\PhpUnit\ProphecyTrait;
use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\Connection;
use TYPO3\CMS\Core\Site\Entity\SiteLanguage; use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
use TYPO3\TestingFramework\Core\Unit\UnitTestCase as TestCase;
/** /**
* @covers DanielSiepmann\Tracking\Domain\Repository\Recordview * @covers DanielSiepmann\Tracking\Domain\Repository\Recordview

View file

@ -24,7 +24,6 @@ namespace DanielSiepmann\Tracking\Tests\Unit\Middleware;
use DanielSiepmann\Tracking\Domain\Model\Pageview as Model; use DanielSiepmann\Tracking\Domain\Model\Pageview as Model;
use DanielSiepmann\Tracking\Domain\Repository\Pageview as Repository; use DanielSiepmann\Tracking\Domain\Repository\Pageview as Repository;
use DanielSiepmann\Tracking\Middleware\Pageview; use DanielSiepmann\Tracking\Middleware\Pageview;
use TYPO3\TestingFramework\Core\Unit\UnitTestCase as TestCase;
use Prophecy\Argument; use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\PhpUnit\ProphecyTrait;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
@ -33,6 +32,7 @@ use Psr\Http\Server\RequestHandlerInterface;
use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Routing\PageArguments; use TYPO3\CMS\Core\Routing\PageArguments;
use TYPO3\CMS\Core\Site\Entity\SiteLanguage; use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
use TYPO3\TestingFramework\Core\Unit\UnitTestCase as TestCase;
/** /**
* @covers DanielSiepmann\Tracking\Middleware\Pageview * @covers DanielSiepmann\Tracking\Middleware\Pageview

View file

@ -24,7 +24,6 @@ namespace DanielSiepmann\Tracking\Tests\Unit\Middleware;
use DanielSiepmann\Tracking\Domain\Model\Recordview as Model; use DanielSiepmann\Tracking\Domain\Model\Recordview as Model;
use DanielSiepmann\Tracking\Domain\Repository\Recordview as Repository; use DanielSiepmann\Tracking\Domain\Repository\Recordview as Repository;
use DanielSiepmann\Tracking\Middleware\Recordview; use DanielSiepmann\Tracking\Middleware\Recordview;
use TYPO3\TestingFramework\Core\Unit\UnitTestCase as TestCase;
use Prophecy\Argument; use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\PhpUnit\ProphecyTrait;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
@ -33,6 +32,7 @@ use Psr\Http\Server\RequestHandlerInterface;
use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Routing\PageArguments; use TYPO3\CMS\Core\Routing\PageArguments;
use TYPO3\CMS\Core\Site\Entity\SiteLanguage; use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
use TYPO3\TestingFramework\Core\Unit\UnitTestCase as TestCase;
/** /**
* @covers DanielSiepmann\Tracking\Middleware\Recordview * @covers DanielSiepmann\Tracking\Middleware\Recordview

View file

@ -39,7 +39,6 @@
"typo3/cms-dashboard": "^10.4 || ~11.2" "typo3/cms-dashboard": "^10.4 || ~11.2"
}, },
"require-dev": { "require-dev": {
"squizlabs/php_codesniffer": "^3.5",
"phpunit/phpunit": "^9.0", "phpunit/phpunit": "^9.0",
"phpstan/phpstan": "^0.12.18", "phpstan/phpstan": "^0.12.18",
"phpstan/extension-installer": "^1.0", "phpstan/extension-installer": "^1.0",
@ -47,7 +46,8 @@
"maglnet/composer-require-checker": "^3.2", "maglnet/composer-require-checker": "^3.2",
"phpspec/prophecy-phpunit": "^2.0", "phpspec/prophecy-phpunit": "^2.0",
"typo3/testing-framework": "^6.8.2", "typo3/testing-framework": "^6.8.2",
"saschaegerer/phpstan-typo3": "^0.13.1" "saschaegerer/phpstan-typo3": "^0.13.1",
"symplify/easy-coding-standard": "^9.3"
}, },
"minimum-stability": "dev", "minimum-stability": "dev",
"prefer-stable": true, "prefer-stable": true,

View file

@ -1,6 +1,6 @@
{ {
"scan-files": [ "scan-files": [
"*.php", "ext_*.php",
"Configuration/*php", "Configuration/*php",
"Configuration/Backend/*.php", "Configuration/Backend/*.php",
"Configuration/TCA/*.php" "Configuration/TCA/*.php"

16
ecs.php Normal file
View file

@ -0,0 +1,16 @@
<?php
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\EasyCodingStandard\ValueObject\Option;
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->import(SetList::PSR_12);
$parameters = $containerConfigurator->parameters();
$parameters->set(Option::PATHS, [
__DIR__ . '/Classes',
__DIR__ . '/Tests',
]);
};