diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8b4c862..42249e1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -140,9 +140,6 @@ jobs: - name: PHPUnit configuration file 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 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: runs-on: ubuntu-latest - needs: - - xml-linting steps: - uses: actions/checkout@v2 @@ -177,7 +172,7 @@ jobs: run: composer install --prefer-dist --no-progress --no-suggest - name: Coding Guideline - run: ./vendor/bin/phpcs + run: ./vendor/bin/ecs check tests-sqlite-TYPO3-v10: runs-on: ubuntu-latest diff --git a/Classes/Dashboard/Provider/NewestPageviews.php b/Classes/Dashboard/Provider/NewestPageviews.php index 53c4e75..30d3821 100644 --- a/Classes/Dashboard/Provider/NewestPageviews.php +++ b/Classes/Dashboard/Provider/NewestPageviews.php @@ -92,7 +92,7 @@ class NewestPageviews implements ListDataProviderInterface ->setMaxResults($this->maxResults); if ($constraints !== []) { - $this->queryBuilder->where(... $constraints); + $this->queryBuilder->where(...$constraints); } $items = $this->queryBuilder->execute()->fetchAll(); diff --git a/Classes/Dashboard/Provider/PageviewsPerDay.php b/Classes/Dashboard/Provider/PageviewsPerDay.php index 3c88edc..f83c648 100644 --- a/Classes/Dashboard/Provider/PageviewsPerDay.php +++ b/Classes/Dashboard/Provider/PageviewsPerDay.php @@ -103,7 +103,7 @@ class PageviewsPerDay implements ChartDataProviderInterface for ($daysBefore = $this->days; $daysBefore >= 0; $daysBefore--) { $timeForLabel = (int) strtotime('-' . $daysBefore . ' day'); $startPeriod = (int) strtotime('-' . $daysBefore . ' day 0:00:00'); - $endPeriod = (int) strtotime('-' . $daysBefore . ' day 23:59:59'); + $endPeriod = (int) strtotime('-' . $daysBefore . ' day 23:59:59'); $labels[] = date($this->dateFormat, $timeForLabel); $data[] = $this->getPageviewsInPeriod($startPeriod, $endPeriod); @@ -145,7 +145,7 @@ class PageviewsPerDay implements ChartDataProviderInterface return (int)$this->queryBuilder ->count('*') ->from('tx_tracking_pageview') - ->where(... $constraints) + ->where(...$constraints) ->execute() ->fetchColumn(); } diff --git a/Classes/Dashboard/Provider/PageviewsPerOperatingSystem.php b/Classes/Dashboard/Provider/PageviewsPerOperatingSystem.php index 9a474df..9c6c6d6 100644 --- a/Classes/Dashboard/Provider/PageviewsPerOperatingSystem.php +++ b/Classes/Dashboard/Provider/PageviewsPerOperatingSystem.php @@ -105,7 +105,7 @@ class PageviewsPerOperatingSystem implements ChartDataProviderInterface ->selectLiteral('count(operating_system) as total') ->addSelect('operating_system') ->from('tx_tracking_pageview') - ->where(... $constraints) + ->where(...$constraints) ->groupBy('tx_tracking_pageview.operating_system') ->orderBy('total', 'desc') ->addOrderBy('operating_system', 'asc') diff --git a/Classes/Dashboard/Provider/PageviewsPerPage.php b/Classes/Dashboard/Provider/PageviewsPerPage.php index e1dc9c3..aa8377d 100644 --- a/Classes/Dashboard/Provider/PageviewsPerPage.php +++ b/Classes/Dashboard/Provider/PageviewsPerPage.php @@ -131,7 +131,7 @@ class PageviewsPerPage implements ChartDataProviderInterface ) ->addSelect('pid') ->from('tx_tracking_pageview') - ->where(... $constraints) + ->where(...$constraints) ->groupBy('pid') ->orderBy('total', 'desc') ->addOrderBy('latest', 'desc') diff --git a/Classes/Dashboard/Provider/Recordviews.php b/Classes/Dashboard/Provider/Recordviews.php index 34e4324..92af663 100644 --- a/Classes/Dashboard/Provider/Recordviews.php +++ b/Classes/Dashboard/Provider/Recordviews.php @@ -193,7 +193,7 @@ class Recordviews implements ChartDataProviderInterface ) ->addSelect('record_uid', 'record_table_name') ->from('tx_tracking_recordview') - ->where(... $constraints) + ->where(...$constraints) ->groupBy('record', 'record_uid', 'record_table_name') ->orderBy('total', 'desc') ->addOrderBy('latest', 'desc') diff --git a/Tests/Functional/Dashboard/Provider/PageviewsPerPageTest.php b/Tests/Functional/Dashboard/Provider/PageviewsPerPageTest.php index abaf8ae..bdec086 100644 --- a/Tests/Functional/Dashboard/Provider/PageviewsPerPageTest.php +++ b/Tests/Functional/Dashboard/Provider/PageviewsPerPageTest.php @@ -189,7 +189,7 @@ class PageviewsPerPageTest extends TestCase GeneralUtility::makeInstance(PageRepository::class), 31, 6, - [1,2,3,4,5,6] + [1, 2, 3, 4, 5, 6] ); $result = $subject->getChartData(); diff --git a/Tests/Functional/Dashboard/Provider/RecordviewsTest.php b/Tests/Functional/Dashboard/Provider/RecordviewsTest.php index 1dfb91e..b85777d 100644 --- a/Tests/Functional/Dashboard/Provider/RecordviewsTest.php +++ b/Tests/Functional/Dashboard/Provider/RecordviewsTest.php @@ -229,7 +229,7 @@ class RecordviewsTest extends TestCase $connectionPool->getQueryBuilderForTable('tx_tracking_recordview'), 31, 6, - [1,2,3,4,5] + [1, 2, 3, 4, 5] ); $result = $subject->getChartData(); @@ -320,7 +320,7 @@ class RecordviewsTest extends TestCase [], [], [], - ['1',2] + ['1', 2] ); $result = $subject->getChartData(); diff --git a/Tests/Unit/Domain/Model/ExtractorTest.php b/Tests/Unit/Domain/Model/ExtractorTest.php index 2ae13ca..740330e 100644 --- a/Tests/Unit/Domain/Model/ExtractorTest.php +++ b/Tests/Unit/Domain/Model/ExtractorTest.php @@ -23,8 +23,8 @@ namespace DanielSiepmann\Tracking\Tests\Unit\Domain\Model; use DanielSiepmann\Tracking\Domain\Model\Extractor; use DanielSiepmann\Tracking\Domain\Model\HasUserAgent; -use TYPO3\TestingFramework\Core\Unit\UnitTestCase as TestCase; use Prophecy\PhpUnit\ProphecyTrait; +use TYPO3\TestingFramework\Core\Unit\UnitTestCase as TestCase; /** * @covers DanielSiepmann\Tracking\Domain\Model\Extractor diff --git a/Tests/Unit/Domain/Model/PageviewTest.php b/Tests/Unit/Domain/Model/PageviewTest.php index 0b07929..780973d 100644 --- a/Tests/Unit/Domain/Model/PageviewTest.php +++ b/Tests/Unit/Domain/Model/PageviewTest.php @@ -22,9 +22,9 @@ namespace DanielSiepmann\Tracking\Tests\Unit\Domain\Model; */ use DanielSiepmann\Tracking\Domain\Model\Pageview; -use TYPO3\TestingFramework\Core\Unit\UnitTestCase as TestCase; use Prophecy\PhpUnit\ProphecyTrait; use TYPO3\CMS\Core\Site\Entity\SiteLanguage; +use TYPO3\TestingFramework\Core\Unit\UnitTestCase as TestCase; /** * @covers DanielSiepmann\Tracking\Domain\Model\Pageview diff --git a/Tests/Unit/Domain/Model/RecordviewTest.php b/Tests/Unit/Domain/Model/RecordviewTest.php index 465ea18..20e0850 100644 --- a/Tests/Unit/Domain/Model/RecordviewTest.php +++ b/Tests/Unit/Domain/Model/RecordviewTest.php @@ -22,9 +22,9 @@ namespace DanielSiepmann\Tracking\Tests\Unit\Domain\Model; */ use DanielSiepmann\Tracking\Domain\Model\Recordview; -use TYPO3\TestingFramework\Core\Unit\UnitTestCase as TestCase; use Prophecy\PhpUnit\ProphecyTrait; use TYPO3\CMS\Core\Site\Entity\SiteLanguage; +use TYPO3\TestingFramework\Core\Unit\UnitTestCase as TestCase; /** * @covers DanielSiepmann\Tracking\Domain\Model\Recordview diff --git a/Tests/Unit/Domain/Pageview/FactoryTest.php b/Tests/Unit/Domain/Pageview/FactoryTest.php index df5701d..e84ea5e 100644 --- a/Tests/Unit/Domain/Pageview/FactoryTest.php +++ b/Tests/Unit/Domain/Pageview/FactoryTest.php @@ -23,7 +23,6 @@ namespace DanielSiepmann\Tracking\Tests\Unit\Domain\Pageview; use DanielSiepmann\Tracking\Domain\Model\Pageview; use DanielSiepmann\Tracking\Domain\Pageview\Factory; -use TYPO3\TestingFramework\Core\Unit\UnitTestCase as TestCase; use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\Prophet; 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\SiteLanguage; use TYPO3\CMS\Core\Site\SiteFinder; +use TYPO3\TestingFramework\Core\Unit\UnitTestCase as TestCase; /** * @covers DanielSiepmann\Tracking\Domain\Pageview\Factory diff --git a/Tests/Unit/Domain/Repository/PageviewTest.php b/Tests/Unit/Domain/Repository/PageviewTest.php index 0bab2b5..7b4f844 100644 --- a/Tests/Unit/Domain/Repository/PageviewTest.php +++ b/Tests/Unit/Domain/Repository/PageviewTest.php @@ -25,11 +25,11 @@ use DanielSiepmann\Tracking\Domain\Model\Pageview as Model; use DanielSiepmann\Tracking\Domain\Pageview\Factory; use DanielSiepmann\Tracking\Domain\Repository\Pageview; use Doctrine\DBAL\Statement; -use TYPO3\TestingFramework\Core\Unit\UnitTestCase as TestCase; use Prophecy\PhpUnit\ProphecyTrait; use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\Query\QueryBuilder; use TYPO3\CMS\Core\Site\Entity\SiteLanguage; +use TYPO3\TestingFramework\Core\Unit\UnitTestCase as TestCase; /** * @covers DanielSiepmann\Tracking\Domain\Repository\Pageview diff --git a/Tests/Unit/Domain/Repository/RecordviewTest.php b/Tests/Unit/Domain/Repository/RecordviewTest.php index 05e3f35..2e57035 100644 --- a/Tests/Unit/Domain/Repository/RecordviewTest.php +++ b/Tests/Unit/Domain/Repository/RecordviewTest.php @@ -23,10 +23,10 @@ namespace DanielSiepmann\Tracking\Tests\Unit\Domain\Repository; use DanielSiepmann\Tracking\Domain\Model\Recordview as Model; use DanielSiepmann\Tracking\Domain\Repository\Recordview; -use TYPO3\TestingFramework\Core\Unit\UnitTestCase as TestCase; use Prophecy\PhpUnit\ProphecyTrait; use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Site\Entity\SiteLanguage; +use TYPO3\TestingFramework\Core\Unit\UnitTestCase as TestCase; /** * @covers DanielSiepmann\Tracking\Domain\Repository\Recordview diff --git a/Tests/Unit/Middleware/PageviewTest.php b/Tests/Unit/Middleware/PageviewTest.php index d094fca..b4dc388 100644 --- a/Tests/Unit/Middleware/PageviewTest.php +++ b/Tests/Unit/Middleware/PageviewTest.php @@ -24,7 +24,6 @@ namespace DanielSiepmann\Tracking\Tests\Unit\Middleware; use DanielSiepmann\Tracking\Domain\Model\Pageview as Model; use DanielSiepmann\Tracking\Domain\Repository\Pageview as Repository; use DanielSiepmann\Tracking\Middleware\Pageview; -use TYPO3\TestingFramework\Core\Unit\UnitTestCase as TestCase; use Prophecy\Argument; use Prophecy\PhpUnit\ProphecyTrait; use Psr\Http\Message\ResponseInterface; @@ -33,6 +32,7 @@ use Psr\Http\Server\RequestHandlerInterface; use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\Routing\PageArguments; use TYPO3\CMS\Core\Site\Entity\SiteLanguage; +use TYPO3\TestingFramework\Core\Unit\UnitTestCase as TestCase; /** * @covers DanielSiepmann\Tracking\Middleware\Pageview diff --git a/Tests/Unit/Middleware/RecordviewTest.php b/Tests/Unit/Middleware/RecordviewTest.php index d88a564..3b00197 100644 --- a/Tests/Unit/Middleware/RecordviewTest.php +++ b/Tests/Unit/Middleware/RecordviewTest.php @@ -24,7 +24,6 @@ namespace DanielSiepmann\Tracking\Tests\Unit\Middleware; use DanielSiepmann\Tracking\Domain\Model\Recordview as Model; use DanielSiepmann\Tracking\Domain\Repository\Recordview as Repository; use DanielSiepmann\Tracking\Middleware\Recordview; -use TYPO3\TestingFramework\Core\Unit\UnitTestCase as TestCase; use Prophecy\Argument; use Prophecy\PhpUnit\ProphecyTrait; use Psr\Http\Message\ResponseInterface; @@ -33,6 +32,7 @@ use Psr\Http\Server\RequestHandlerInterface; use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\Routing\PageArguments; use TYPO3\CMS\Core\Site\Entity\SiteLanguage; +use TYPO3\TestingFramework\Core\Unit\UnitTestCase as TestCase; /** * @covers DanielSiepmann\Tracking\Middleware\Recordview diff --git a/composer.json b/composer.json index 1d802b8..16a96f7 100644 --- a/composer.json +++ b/composer.json @@ -39,7 +39,6 @@ "typo3/cms-dashboard": "^10.4 || ~11.2" }, "require-dev": { - "squizlabs/php_codesniffer": "^3.5", "phpunit/phpunit": "^9.0", "phpstan/phpstan": "^0.12.18", "phpstan/extension-installer": "^1.0", @@ -47,7 +46,8 @@ "maglnet/composer-require-checker": "^3.2", "phpspec/prophecy-phpunit": "^2.0", "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", "prefer-stable": true, diff --git a/dependency-checker.json b/dependency-checker.json index fe1a5d9..c1b550b 100644 --- a/dependency-checker.json +++ b/dependency-checker.json @@ -1,6 +1,6 @@ { "scan-files": [ - "*.php", + "ext_*.php", "Configuration/*php", "Configuration/Backend/*.php", "Configuration/TCA/*.php" diff --git a/ecs.php b/ecs.php new file mode 100644 index 0000000..7db1b34 --- /dev/null +++ b/ecs.php @@ -0,0 +1,16 @@ +import(SetList::PSR_12); + + $parameters = $containerConfigurator->parameters(); + + $parameters->set(Option::PATHS, [ + __DIR__ . '/Classes', + __DIR__ . '/Tests', + ]); +};