Add strict_types and move namespace definition

To follow my new conventions.
This commit is contained in:
Daniel Siepmann 2022-09-16 13:53:49 +02:00
parent bcd94f9826
commit 5b4a379978
19 changed files with 66 additions and 25 deletions

View file

@ -1,6 +1,6 @@
<?php <?php
namespace DanielSiepmann\Tracking\Command; declare(strict_types=1);
/* /*
* Copyright (C) 2020 Daniel Siepmann <coding@daniel-siepmann.de> * Copyright (C) 2020 Daniel Siepmann <coding@daniel-siepmann.de>
@ -21,6 +21,8 @@ namespace DanielSiepmann\Tracking\Command;
* 02110-1301, USA. * 02110-1301, USA.
*/ */
namespace DanielSiepmann\Tracking\Command;
use DanielSiepmann\Tracking\Domain\Repository\Pageview; use DanielSiepmann\Tracking\Domain\Repository\Pageview;
use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\ProgressBar; use Symfony\Component\Console\Helper\ProgressBar;

View file

@ -1,6 +1,6 @@
<?php <?php
namespace DanielSiepmann\Tracking\Dashboard\Provider; declare(strict_types=1);
/* /*
* Copyright (C) 2020 Daniel Siepmann <coding@daniel-siepmann.de> * Copyright (C) 2020 Daniel Siepmann <coding@daniel-siepmann.de>
@ -21,6 +21,8 @@ namespace DanielSiepmann\Tracking\Dashboard\Provider;
* 02110-1301, USA. * 02110-1301, USA.
*/ */
namespace DanielSiepmann\Tracking\Dashboard\Provider;
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\Dashboard\Widgets\ListDataProviderInterface; use TYPO3\CMS\Dashboard\Widgets\ListDataProviderInterface;

View file

@ -1,6 +1,6 @@
<?php <?php
namespace DanielSiepmann\Tracking\Dashboard\Provider; declare(strict_types=1);
/* /*
* Copyright (C) 2020 Daniel Siepmann <coding@daniel-siepmann.de> * Copyright (C) 2020 Daniel Siepmann <coding@daniel-siepmann.de>
@ -21,6 +21,8 @@ namespace DanielSiepmann\Tracking\Dashboard\Provider;
* 02110-1301, USA. * 02110-1301, USA.
*/ */
namespace DanielSiepmann\Tracking\Dashboard\Provider;
use DanielSiepmann\Tracking\Extension; use DanielSiepmann\Tracking\Extension;
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;

View file

@ -1,6 +1,6 @@
<?php <?php
namespace DanielSiepmann\Tracking\Dashboard\Provider; declare(strict_types=1);
/* /*
* Copyright (C) 2020 Daniel Siepmann <coding@daniel-siepmann.de> * Copyright (C) 2020 Daniel Siepmann <coding@daniel-siepmann.de>
@ -21,6 +21,8 @@ namespace DanielSiepmann\Tracking\Dashboard\Provider;
* 02110-1301, USA. * 02110-1301, USA.
*/ */
namespace DanielSiepmann\Tracking\Dashboard\Provider;
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\Dashboard\WidgetApi; use TYPO3\CMS\Dashboard\WidgetApi;

View file

@ -1,6 +1,6 @@
<?php <?php
namespace DanielSiepmann\Tracking\Dashboard\Provider; declare(strict_types=1);
/* /*
* Copyright (C) 2020 Daniel Siepmann <coding@daniel-siepmann.de> * Copyright (C) 2020 Daniel Siepmann <coding@daniel-siepmann.de>
@ -21,6 +21,8 @@ namespace DanielSiepmann\Tracking\Dashboard\Provider;
* 02110-1301, USA. * 02110-1301, USA.
*/ */
namespace DanielSiepmann\Tracking\Dashboard\Provider;
use DanielSiepmann\Tracking\Extension; use DanielSiepmann\Tracking\Extension;
use Doctrine\DBAL\ParameterType; use Doctrine\DBAL\ParameterType;
use TYPO3\CMS\Backend\Utility\BackendUtility; use TYPO3\CMS\Backend\Utility\BackendUtility;
@ -144,7 +146,7 @@ class PageviewsPerPage implements ChartDataProviderInterface
continue; continue;
} }
$labels[] = $this->getRecordTitle($row['pid']); $labels[] = $this->getRecordTitle((int) $row['pid']);
$data[] = $row['total']; $data[] = $row['total'];
} }

View file

@ -1,6 +1,6 @@
<?php <?php
namespace DanielSiepmann\Tracking\Dashboard\Provider; declare(strict_types=1);
/* /*
* Copyright (C) 2020 Daniel Siepmann <coding@daniel-siepmann.de> * Copyright (C) 2020 Daniel Siepmann <coding@daniel-siepmann.de>
@ -21,6 +21,8 @@ namespace DanielSiepmann\Tracking\Dashboard\Provider;
* 02110-1301, USA. * 02110-1301, USA.
*/ */
namespace DanielSiepmann\Tracking\Dashboard\Provider;
use DanielSiepmann\Tracking\Extension; use DanielSiepmann\Tracking\Extension;
use Doctrine\DBAL\ParameterType; use Doctrine\DBAL\ParameterType;
use Doctrine\DBAL\Statement; use Doctrine\DBAL\Statement;
@ -117,8 +119,11 @@ class Recordviews implements ChartDataProviderInterface
$data = []; $data = [];
foreach ($this->getRecordviewsRecords() as $recordview) { foreach ($this->getRecordviewsRecords() as $recordview) {
if (is_numeric($recordview['record_uid']) === false) {
continue;
}
$record = $this->getRecord( $record = $this->getRecord(
$recordview['record_uid'], (int) $recordview['record_uid'],
$recordview['record_table_name'] $recordview['record_table_name']
); );

View file

@ -1,6 +1,6 @@
<?php <?php
namespace DanielSiepmann\Tracking\Domain\Model; declare(strict_types=1);
/* /*
* Copyright (C) 2020 Daniel Siepmann <coding@daniel-siepmann.de> * Copyright (C) 2020 Daniel Siepmann <coding@daniel-siepmann.de>
@ -21,6 +21,8 @@ namespace DanielSiepmann\Tracking\Domain\Model;
* 02110-1301, USA. * 02110-1301, USA.
*/ */
namespace DanielSiepmann\Tracking\Domain\Model;
/** /**
* API to extract further info out of an model. * API to extract further info out of an model.
*/ */

View file

@ -1,6 +1,6 @@
<?php <?php
namespace DanielSiepmann\Tracking\Domain\Model; declare(strict_types=1);
/* /*
* Copyright (C) 2020 Daniel Siepmann <coding@daniel-siepmann.de> * Copyright (C) 2020 Daniel Siepmann <coding@daniel-siepmann.de>
@ -21,6 +21,8 @@ namespace DanielSiepmann\Tracking\Domain\Model;
* 02110-1301, USA. * 02110-1301, USA.
*/ */
namespace DanielSiepmann\Tracking\Domain\Model;
interface HasUserAgent interface HasUserAgent
{ {
public function getUserAgent(): string; public function getUserAgent(): string;

View file

@ -1,6 +1,6 @@
<?php <?php
namespace DanielSiepmann\Tracking\Domain\Model; declare(strict_types=1);
/* /*
* Copyright (C) 2020 Daniel Siepmann <coding@daniel-siepmann.de> * Copyright (C) 2020 Daniel Siepmann <coding@daniel-siepmann.de>
@ -21,6 +21,8 @@ namespace DanielSiepmann\Tracking\Domain\Model;
* 02110-1301, USA. * 02110-1301, USA.
*/ */
namespace DanielSiepmann\Tracking\Domain\Model;
use TYPO3\CMS\Core\Site\Entity\SiteLanguage; use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
class Pageview implements HasUserAgent class Pageview implements HasUserAgent

View file

@ -1,6 +1,6 @@
<?php <?php
namespace DanielSiepmann\Tracking\Domain\Model; declare(strict_types=1);
/* /*
* Copyright (C) 2020 Daniel Siepmann <coding@daniel-siepmann.de> * Copyright (C) 2020 Daniel Siepmann <coding@daniel-siepmann.de>
@ -21,6 +21,8 @@ namespace DanielSiepmann\Tracking\Domain\Model;
* 02110-1301, USA. * 02110-1301, USA.
*/ */
namespace DanielSiepmann\Tracking\Domain\Model;
class RecordRule class RecordRule
{ {
/** /**

View file

@ -1,6 +1,6 @@
<?php <?php
namespace DanielSiepmann\Tracking\Domain\Model; declare(strict_types=1);
/* /*
* Copyright (C) 2020 Daniel Siepmann <coding@daniel-siepmann.de> * Copyright (C) 2020 Daniel Siepmann <coding@daniel-siepmann.de>
@ -21,6 +21,8 @@ namespace DanielSiepmann\Tracking\Domain\Model;
* 02110-1301, USA. * 02110-1301, USA.
*/ */
namespace DanielSiepmann\Tracking\Domain\Model;
use TYPO3\CMS\Core\Site\Entity\SiteLanguage; use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
class Recordview implements HasUserAgent class Recordview implements HasUserAgent

View file

@ -1,6 +1,6 @@
<?php <?php
namespace DanielSiepmann\Tracking\Domain\Pageview; declare(strict_types=1);
/* /*
* Copyright (C) 2020 Daniel Siepmann <coding@daniel-siepmann.de> * Copyright (C) 2020 Daniel Siepmann <coding@daniel-siepmann.de>
@ -21,6 +21,8 @@ namespace DanielSiepmann\Tracking\Domain\Pageview;
* 02110-1301, USA. * 02110-1301, USA.
*/ */
namespace DanielSiepmann\Tracking\Domain\Pageview;
use DanielSiepmann\Tracking\Domain\Model\Pageview; use DanielSiepmann\Tracking\Domain\Model\Pageview;
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Core\Routing\PageArguments; use TYPO3\CMS\Core\Routing\PageArguments;
@ -54,13 +56,13 @@ class Factory
public function fromDbRow(array $dbRow): Pageview public function fromDbRow(array $dbRow): Pageview
{ {
return new Pageview( return new Pageview(
$dbRow['pid'], (int) $dbRow['pid'],
$this->siteFinder->getSiteByPageId($dbRow['pid'])->getLanguageById($dbRow['sys_language_uid']), $this->siteFinder->getSiteByPageId((int) $dbRow['pid'])->getLanguageById((int) $dbRow['sys_language_uid']),
new \DateTimeImmutable('@' . $dbRow['crdate']), new \DateTimeImmutable('@' . $dbRow['crdate']),
$dbRow['type'], (int) $dbRow['type'],
$dbRow['url'], $dbRow['url'],
$dbRow['user_agent'], $dbRow['user_agent'],
$dbRow['uid'] (int) $dbRow['uid']
); );
} }

View file

@ -1,6 +1,6 @@
<?php <?php
namespace DanielSiepmann\Tracking\Domain\Recordview; declare(strict_types=1);
/* /*
* Copyright (C) 2020 Daniel Siepmann <coding@daniel-siepmann.de> * Copyright (C) 2020 Daniel Siepmann <coding@daniel-siepmann.de>
@ -21,6 +21,8 @@ namespace DanielSiepmann\Tracking\Domain\Recordview;
* 02110-1301, USA. * 02110-1301, USA.
*/ */
namespace DanielSiepmann\Tracking\Domain\Recordview;
use DanielSiepmann\Tracking\Domain\Model\RecordRule; use DanielSiepmann\Tracking\Domain\Model\RecordRule;
use DanielSiepmann\Tracking\Domain\Model\Recordview; use DanielSiepmann\Tracking\Domain\Model\Recordview;
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ServerRequestInterface;

View file

@ -1,6 +1,6 @@
<?php <?php
namespace DanielSiepmann\Tracking\Domain\Repository; declare(strict_types=1);
/* /*
* Copyright (C) 2020 Daniel Siepmann <coding@daniel-siepmann.de> * Copyright (C) 2020 Daniel Siepmann <coding@daniel-siepmann.de>
@ -21,6 +21,8 @@ namespace DanielSiepmann\Tracking\Domain\Repository;
* 02110-1301, USA. * 02110-1301, USA.
*/ */
namespace DanielSiepmann\Tracking\Domain\Repository;
use DanielSiepmann\Tracking\Domain\Model\Pageview as Model; use DanielSiepmann\Tracking\Domain\Model\Pageview as Model;
use DanielSiepmann\Tracking\Domain\Pageview\Factory; use DanielSiepmann\Tracking\Domain\Pageview\Factory;
use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\Connection;

View file

@ -1,6 +1,6 @@
<?php <?php
namespace DanielSiepmann\Tracking\Domain\Repository; declare(strict_types=1);
/* /*
* Copyright (C) 2020 Daniel Siepmann <coding@daniel-siepmann.de> * Copyright (C) 2020 Daniel Siepmann <coding@daniel-siepmann.de>
@ -21,6 +21,8 @@ namespace DanielSiepmann\Tracking\Domain\Repository;
* 02110-1301, USA. * 02110-1301, USA.
*/ */
namespace DanielSiepmann\Tracking\Domain\Repository;
use DanielSiepmann\Tracking\Domain\Model\Recordview as Model; use DanielSiepmann\Tracking\Domain\Model\Recordview as Model;
use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\Connection;

View file

@ -1,6 +1,6 @@
<?php <?php
namespace DanielSiepmann\Tracking; declare(strict_types=1);
/* /*
* Copyright (C) 2020 Daniel Siepmann <coding@daniel-siepmann.de> * Copyright (C) 2020 Daniel Siepmann <coding@daniel-siepmann.de>
@ -21,6 +21,8 @@ namespace DanielSiepmann\Tracking;
* 02110-1301, USA. * 02110-1301, USA.
*/ */
namespace DanielSiepmann\Tracking;
final class Extension final class Extension
{ {
public const EXT_KEY = 'tracking'; public const EXT_KEY = 'tracking';

View file

@ -1,6 +1,6 @@
<?php <?php
namespace DanielSiepmann\Tracking\Hooks; declare(strict_types=1);
/* /*
* Copyright (C) 2021 Daniel Siepmann <coding@daniel-siepmann.de> * Copyright (C) 2021 Daniel Siepmann <coding@daniel-siepmann.de>
@ -21,6 +21,8 @@ namespace DanielSiepmann\Tracking\Hooks;
* 02110-1301, USA. * 02110-1301, USA.
*/ */
namespace DanielSiepmann\Tracking\Hooks;
use TYPO3\CMS\Core\DataHandling\DataHandler as Typo3DataHandler; use TYPO3\CMS\Core\DataHandling\DataHandler as Typo3DataHandler;
use TYPO3\CMS\Core\Utility\ArrayUtility; use TYPO3\CMS\Core\Utility\ArrayUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\GeneralUtility;

View file

@ -1,6 +1,6 @@
<?php <?php
namespace DanielSiepmann\Tracking\Middleware; declare(strict_types=1);
/* /*
* Copyright (C) 2020 Daniel Siepmann <coding@daniel-siepmann.de> * Copyright (C) 2020 Daniel Siepmann <coding@daniel-siepmann.de>
@ -21,6 +21,8 @@ namespace DanielSiepmann\Tracking\Middleware;
* 02110-1301, USA. * 02110-1301, USA.
*/ */
namespace DanielSiepmann\Tracking\Middleware;
use DanielSiepmann\Tracking\Domain\Pageview\Factory; use DanielSiepmann\Tracking\Domain\Pageview\Factory;
use DanielSiepmann\Tracking\Domain\Repository\Pageview as Repository; use DanielSiepmann\Tracking\Domain\Repository\Pageview as Repository;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;

View file

@ -1,6 +1,6 @@
<?php <?php
namespace DanielSiepmann\Tracking\Middleware; declare(strict_types=1);
/* /*
* Copyright (C) 2020 Daniel Siepmann <coding@daniel-siepmann.de> * Copyright (C) 2020 Daniel Siepmann <coding@daniel-siepmann.de>
@ -21,6 +21,8 @@ namespace DanielSiepmann\Tracking\Middleware;
* 02110-1301, USA. * 02110-1301, USA.
*/ */
namespace DanielSiepmann\Tracking\Middleware;
use DanielSiepmann\Tracking\Domain\Model\RecordRule; use DanielSiepmann\Tracking\Domain\Model\RecordRule;
use DanielSiepmann\Tracking\Domain\Recordview\Factory; use DanielSiepmann\Tracking\Domain\Recordview\Factory;
use DanielSiepmann\Tracking\Domain\Repository\Recordview as Repository; use DanielSiepmann\Tracking\Domain\Repository\Recordview as Repository;