TYPO3 V12 Update (#116)

* Support TYPO3 v12 and PHP 8.3
This commit is contained in:
Daniel Siepmann 2023-12-05 09:43:55 +01:00 committed by GitHub
parent f69db97990
commit 54d244b804
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
228 changed files with 4711 additions and 4419 deletions

10
.gitattributes vendored Normal file
View file

@ -0,0 +1,10 @@
codeception.dist.yml export-ignore
.gitattributes export-ignore
.github export-ignore
.gitignore export-ignore
.php-cs-fixer.dist.php export-ignore
phpstan-baseline.neon export-ignore
phpstan.neon export-ignore
phpunit.xml.dist export-ignore
shell.nix export-ignore
Tests export-ignore

View file

@ -15,10 +15,9 @@ jobs:
strategy:
matrix:
php-version:
- 7.4
- 8.0
- 8.1
- 8.2
- 8.3
steps:
- name: Checkout
uses: actions/checkout@v3
@ -41,7 +40,7 @@ jobs:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: "7.4"
php-version: "8.2"
tools: composer:v2
- name: Install xmllint
@ -70,14 +69,14 @@ jobs:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: "7.4"
php-version: "8.2"
tools: composer:v2
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest
- name: Coding Guideline
run: ./vendor/bin/ecs check
run: ./vendor/bin/php-cs-fixer fix --dry-run --diff
code-quality:
runs-on: ubuntu-latest
@ -86,16 +85,12 @@ jobs:
strategy:
matrix:
include:
- php-version: '7.4'
typo3-version: '^10.4'
- php-version: '7.4'
typo3-version: '^11.5'
- php-version: '8.0'
typo3-version: '^11.5'
- php-version: '8.1'
typo3-version: '^11.5'
typo3-version: '^12.4'
- php-version: '8.2'
typo3-version: '^11.5'
typo3-version: '^12.4'
- php-version: '8.3'
typo3-version: '^12.4'
steps:
- uses: actions/checkout@v3
@ -121,23 +116,14 @@ jobs:
strategy:
matrix:
include:
- php-version: '7.4'
typo3-version: '^10.4'
db-version: '5.6'
- php-version: '7.4'
typo3-version: '^10.4'
db-version: '8'
- php-version: '7.4'
typo3-version: '^11.5'
db-version: '8'
- php-version: '8.0'
typo3-version: '^11.5'
db-version: '8'
- php-version: '8.1'
typo3-version: '^11.5'
typo3-version: '^12.4'
db-version: '8'
- php-version: '8.2'
typo3-version: '^11.5'
typo3-version: '^12.4'
db-version: '8'
- php-version: '8.3'
typo3-version: '^12.4'
db-version: '8'
steps:
- uses: actions/checkout@v3
@ -151,10 +137,16 @@ jobs:
- name: Setup MySQL
uses: mirromutth/mysql-action@v1.1
with:
mysql version: '5.7'
mysql version: "${{ matrix.db-version }}"
mysql database: 'typo3'
mysql root password: 'root'
- name: Wait for MySQL
run: |
while ! mysqladmin ping --host=127.0.0.1 --password=root --silent; do
sleep 1
done
- name: Install dependencies
run: composer require --no-interaction --prefer-dist --no-progress "typo3/cms-backend:${{ matrix.typo3-version }}" "typo3/cms-core:${{ matrix.typo3-version }}" "typo3/cms-extbase:${{ matrix.typo3-version }}" "typo3/cms-frontend:${{ matrix.typo3-version }}" "typo3/cms-fluid-styled-content:${{ matrix.typo3-version }}"
@ -165,4 +157,16 @@ jobs:
export typo3DatabaseHost="127.0.0.1"
export typo3DatabaseUsername="root"
export typo3DatabasePassword="root"
./vendor/bin/phpunit --testdox
./vendor/bin/phpunit
tests-acceptance:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v24
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Run Acceptance Tests
run: nix-shell --run project-test-acceptance

2
.gitignore vendored
View file

@ -1,3 +1,5 @@
/.Build/
/composer.lock
/.phpunit.cache
/Tests/Acceptance/Support/_generated
/vendor/

73
.php-cs-fixer.dist.php Normal file
View file

@ -0,0 +1,73 @@
<?php
$finder = (new PhpCsFixer\Finder())
->ignoreVCSIgnored(true)
->in(realpath(__DIR__))
;
return (new \PhpCsFixer\Config())
->setRiskyAllowed(true)
->setRules([
'@DoctrineAnnotation' => true,
'@PSR2' => true,
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'attribute_empty_parentheses' => true,
'blank_line_after_opening_tag' => true,
'braces' => ['allow_single_line_closure' => true],
'cast_spaces' => ['space' => 'none'],
'compact_nullable_typehint' => true,
'concat_space' => ['spacing' => 'one'],
'declare_equal_normalize' => ['space' => 'none'],
'declare_strict_types' => true,
'dir_constant' => true,
'fully_qualified_strict_types' => false,
'function_to_constant' => ['functions' => ['get_called_class', 'get_class', 'get_class_this', 'php_sapi_name', 'phpversion', 'pi']],
'function_typehint_space' => true,
'global_namespace_import' => ['import_classes' => true, 'import_constants' => true, 'import_functions' => true],
'lowercase_cast' => true,
'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'],
'modernize_strpos' => true,
'modernize_types_casting' => true,
'multiline_whitespace_before_semicolons' => ['strategy' => 'new_line_for_chained_calls'],
'native_function_casing' => true,
'new_with_braces' => true,
'no_alias_functions' => true,
'no_blank_lines_after_phpdoc' => true,
'no_empty_phpdoc' => true,
'no_empty_statement' => true,
'no_extra_blank_lines' => true,
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_multiline_whitespace_around_double_arrow' => true,
'no_null_property_initialization' => true,
'no_short_bool_cast' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_superfluous_elseif' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_unneeded_control_parentheses' => true,
'no_unneeded_import_alias' => true,
'no_unused_imports' => true,
'no_useless_else' => true,
'no_whitespace_in_blank_line' => true,
'ordered_imports' => true,
'php_unit_construct' => ['assertions' => ['assertEquals', 'assertSame', 'assertNotEquals', 'assertNotSame']],
'php_unit_mock_short_will_return' => true,
'php_unit_test_case_static_method_calls' => ['call_type' => 'self'],
'phpdoc_no_access' => true,
'phpdoc_no_package' => true,
'phpdoc_order' => ['order' => ['test', 'dataProvider', 'param', 'throws', 'return']],
'phpdoc_scalar' => true,
'phpdoc_separation' => ['groups' => [['Extbase\\*']]],
'phpdoc_trim' => true,
'phpdoc_types' => true,
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
'return_type_declaration' => ['space_before' => 'none'],
'single_line_comment_style' => ['comment_types' => ['hash']],
'single_quote' => true,
'single_trait_insert_per_statement' => true,
'trailing_comma_in_multiline' => ['elements' => ['arrays']],
'whitespace_after_comma_in_array' => true,
'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false],
])
->setFinder($finder)
;

View file

@ -34,24 +34,11 @@ use WerkraumMedia\ThueCat\Domain\Repository\Backend\ImportConfigurationRepositor
class ImportConfigurationCommand extends Command
{
/**
* @var ImportConfigurationRepository
*/
private $importConfigurationRepository;
/**
* @var Importer
*/
private $importer;
public function __construct(
ImportConfigurationRepository $importConfigurationRepository,
Importer $importer
private readonly ImportConfigurationRepository $importConfigurationRepository,
private readonly Importer $importer
) {
parent::__construct();
$this->importConfigurationRepository = $importConfigurationRepository;
$this->importer = $importer;
}
protected function configure(): void

View file

@ -23,22 +23,30 @@ declare(strict_types=1);
namespace WerkraumMedia\ThueCat\Controller\Backend;
use TYPO3\CMS\Backend\View\BackendTemplateView;
use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Backend\Template\ModuleTemplate;
use TYPO3\CMS\Backend\Template\ModuleTemplateFactory;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
abstract class AbstractController extends ActionController
{
/**
* BackendTemplateContainer
*
* @var BackendTemplateView
*/
protected $view;
private ModuleTemplateFactory $moduleTemplateFactory;
/**
* Backend Template Container
*
* @var string
*/
protected $defaultViewObjectName = BackendTemplateView::class;
protected ModuleTemplate $moduleTemplate;
public function injectModuleTemplateFactory(ModuleTemplateFactory $moduleTemplateFactory): void
{
$this->moduleTemplateFactory = $moduleTemplateFactory;
}
protected function initializeView(): void
{
$this->moduleTemplate = $this->moduleTemplateFactory->create($this->request);
$this->moduleTemplate->assign('settings', $this->settings);
}
protected function htmlResponse(?string $html = null): ResponseInterface
{
return parent::htmlResponse($html ?? $this->moduleTemplate->render());
}
}

View file

@ -23,34 +23,25 @@ declare(strict_types=1);
namespace WerkraumMedia\ThueCat\Controller\Backend;
use Psr\Http\Message\ResponseInterface;
use WerkraumMedia\ThueCat\Domain\Repository\Backend\ImportConfigurationRepository;
use WerkraumMedia\ThueCat\Domain\Repository\Backend\OrganisationRepository;
class ConfigurationController extends AbstractController
{
/**
* @var OrganisationRepository
*/
private $organisationRepository;
/**
* @var ImportConfigurationRepository
*/
private $importConfigurationRepository;
public function __construct(
OrganisationRepository $organisationRepository,
ImportConfigurationRepository $importConfigurationRepository
private readonly OrganisationRepository $organisationRepository,
private readonly ImportConfigurationRepository $importConfigurationRepository
) {
$this->organisationRepository = $organisationRepository;
$this->importConfigurationRepository = $importConfigurationRepository;
}
public function indexAction(): void
public function indexAction(): ResponseInterface
{
$this->view->assignMultiple([
$this->moduleTemplate->assignMultiple([
'importConfigurations' => $this->importConfigurationRepository->findAll(),
'organisations' => $this->organisationRepository->findAll(),
]);
return $this->htmlResponse();
}
}

View file

@ -23,8 +23,9 @@ declare(strict_types=1);
namespace WerkraumMedia\ThueCat\Controller\Backend;
use TYPO3\CMS\Core\Messaging\AbstractMessage;
use TYPO3\CMS\Extbase\Annotation as Extbase;
use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity;
use TYPO3\CMS\Extbase\Annotation\IgnoreValidation;
use WerkraumMedia\ThueCat\Domain\Import\Importer;
use WerkraumMedia\ThueCat\Domain\Model\Backend\ImportConfiguration;
use WerkraumMedia\ThueCat\Domain\Repository\Backend\ImportLogRepository;
@ -33,42 +34,24 @@ use WerkraumMedia\ThueCat\Typo3Wrapper\TranslationService;
class ImportController extends AbstractController
{
/**
* @var Importer
*/
private $importer;
/**
* @var ImportLogRepository
*/
private $repository;
/**
* @var TranslationService
*/
private $translation;
public function __construct(
Importer $importer,
ImportLogRepository $repository,
TranslationService $translation
private readonly Importer $importer,
private readonly ImportLogRepository $repository,
private readonly TranslationService $translation
) {
$this->importer = $importer;
$this->repository = $repository;
$this->translation = $translation;
}
public function indexAction(): void
public function indexAction(): ResponseInterface
{
$this->view->assignMultiple([
$this->moduleTemplate->assignMultiple([
'imports' => $this->repository->findAll(),
]);
return $this->htmlResponse();
}
/**
* @Extbase\IgnoreValidation("importConfiguration")
*/
public function importAction(ImportConfiguration $importConfiguration): void
#[IgnoreValidation(['argumentName' => 'importConfiguration'])]
public function importAction(ImportConfiguration $importConfiguration): ResponseInterface
{
$importLog = $this->importer->importConfiguration($importConfiguration);
@ -78,7 +61,7 @@ class ImportController extends AbstractController
$this->createImportDoneFlashMessage($importConfiguration);
}
$this->redirect('index', 'Backend\Configuration');
return $this->redirect('index', 'Backend\Configuration');
}
private function createImportErrorFlashMessage(ImportConfiguration $importConfiguration): void
@ -93,7 +76,7 @@ class ImportController extends AbstractController
'controller.backend.import.import.error.title',
Extension::EXTENSION_NAME
),
AbstractMessage::ERROR
ContextualFeedbackSeverity::ERROR
);
}
@ -109,7 +92,7 @@ class ImportController extends AbstractController
'controller.backend.import.import.success.title',
Extension::EXTENSION_NAME
),
AbstractMessage::OK
ContextualFeedbackSeverity::OK
);
}
}

View file

@ -29,7 +29,7 @@ use WerkraumMedia\ThueCat\Domain\Import\Typo3Converter\Registry;
class ConverterPass implements CompilerPassInterface
{
public const TAG = 'thuecat.typo3.converter';
final public const TAG = 'thuecat.typo3.converter';
public function process(ContainerBuilder $container): void
{

View file

@ -29,7 +29,7 @@ use WerkraumMedia\ThueCat\Domain\Import\EntityMapper\EntityRegistry;
class EntityPass implements CompilerPassInterface
{
public const TAG = 'thuecat.entity';
final public const TAG = 'thuecat.entity';
public function process(ContainerBuilder $container): void
{

View file

@ -29,7 +29,7 @@ use WerkraumMedia\ThueCat\Domain\Import\UrlProvider\Registry;
class UrlProvidersPass implements CompilerPassInterface
{
public const TAG = 'thuecat:urlprovider';
final public const TAG = 'thuecat:urlprovider';
public function process(ContainerBuilder $container): void
{

View file

@ -27,45 +27,21 @@ use WerkraumMedia\ThueCat\Domain\Import\EntityMapper\PropertyValues;
class AccessibilityCertification implements MapsToType
{
/**
* @var string
*/
protected $accessibilityCertificationStatus = '';
protected string $accessibilityCertificationStatus = '';
/**
* @var string
*/
protected $certificationAccessibilityDeaf = '';
protected string $certificationAccessibilityDeaf = '';
/**
* @var string
*/
protected $certificationAccessibilityMental = '';
protected string $certificationAccessibilityMental = '';
/**
* @var string
*/
protected $certificationAccessibilityPartiallyDeaf = '';
protected string $certificationAccessibilityPartiallyDeaf = '';
/**
* @var string
*/
protected $certificationAccessibilityPartiallyVisual = '';
protected string $certificationAccessibilityPartiallyVisual = '';
/**
* @var string
*/
protected $certificationAccessibilityVisual = '';
protected string $certificationAccessibilityVisual = '';
/**
* @var string
*/
protected $certificationAccessibilityWalking = '';
protected string $certificationAccessibilityWalking = '';
/**
* @var string
*/
protected $certificationAccessibilityWheelchair = '';
protected string $certificationAccessibilityWheelchair = '';
public function getAccessibilityCertificationStatus(): string
{
@ -109,6 +85,7 @@ class AccessibilityCertification implements MapsToType
/**
* @internal for mapping via Symfony component.
*
* @param string|array $accessibilityCertificationStatus
*/
public function setAccessibilityCertificationStatus($accessibilityCertificationStatus): void
@ -121,6 +98,7 @@ class AccessibilityCertification implements MapsToType
/**
* @internal for mapping via Symfony component.
*
* @param string|array $certificationAccessibilityDeaf
*/
public function setCertificationAccessibilityDeaf($certificationAccessibilityDeaf): void
@ -133,6 +111,7 @@ class AccessibilityCertification implements MapsToType
/**
* @internal for mapping via Symfony component.
*
* @param string|array $certificationAccessibilityMental
*/
public function setCertificationAccessibilityMental($certificationAccessibilityMental): void
@ -145,6 +124,7 @@ class AccessibilityCertification implements MapsToType
/**
* @internal for mapping via Symfony component.
*
* @param string|array $certificationAccessibilityPartiallyDeaf
*/
public function setCertificationAccessibilityPartiallyDeaf($certificationAccessibilityPartiallyDeaf): void
@ -157,6 +137,7 @@ class AccessibilityCertification implements MapsToType
/**
* @internal for mapping via Symfony component.
*
* @param string|array $certificationAccessibilityPartiallyVisual
*/
public function setCertificationAccessibilityPartiallyVisual($certificationAccessibilityPartiallyVisual): void
@ -169,6 +150,7 @@ class AccessibilityCertification implements MapsToType
/**
* @internal for mapping via Symfony component.
*
* @param string|array $certificationAccessibilityVisual
*/
public function setCertificationAccessibilityVisual($certificationAccessibilityVisual): void
@ -181,6 +163,7 @@ class AccessibilityCertification implements MapsToType
/**
* @internal for mapping via Symfony component.
*
* @param string|array $certificationAccessibilityWalking
*/
public function setCertificationAccessibilityWalking($certificationAccessibilityWalking): void
@ -193,6 +176,7 @@ class AccessibilityCertification implements MapsToType
/**
* @internal for mapping via Symfony component.
*
* @param string|array $certificationAccessibilityWheelchair
*/
public function setCertificationAccessibilityWheelchair($certificationAccessibilityWheelchair): void

View file

@ -27,45 +27,21 @@ use WerkraumMedia\ThueCat\Domain\Import\EntityMapper\PropertyValues;
class AccessibilitySpecification implements MapsToType
{
/**
* @var AccessibilityCertification
*/
protected $accessibilityCertification;
protected AccessibilityCertification $accessibilityCertification;
/**
* @var array
*/
protected $accessibilitySearchCriteria = [];
protected array $accessibilitySearchCriteria = [];
/**
* @var string
*/
protected $shortDescriptionAccessibilityAllGenerations = '';
protected string $shortDescriptionAccessibilityAllGenerations = '';
/**
* @var string
*/
protected $shortDescriptionAccessibilityAllergic = '';
protected string $shortDescriptionAccessibilityAllergic = '';
/**
* @var string
*/
protected $shortDescriptionAccessibilityDeaf = '';
protected string $shortDescriptionAccessibilityDeaf = '';
/**
* @var string
*/
protected $shortDescriptionAccessibilityMental = '';
protected string $shortDescriptionAccessibilityMental = '';
/**
* @var string
*/
protected $shortDescriptionAccessibilityVisual = '';
protected string $shortDescriptionAccessibilityVisual = '';
/**
* @var string
*/
protected $shortDescriptionAccessibilityWalking = '';
protected string $shortDescriptionAccessibilityWalking = '';
public function getAccessibilityCertification(): ?AccessibilityCertification
{

View file

@ -30,17 +30,14 @@ class Base extends Minimum
{
use ManagedBy;
/**
* @var ForeignReference
*/
protected $photo;
protected ?ForeignReference $photo = null;
/**
* Images of this Thing.
*
* @var ForeignReference[]
*/
protected $images = [];
protected array $images = [];
public function getPhoto(): ?ForeignReference
{
@ -65,6 +62,7 @@ class Base extends Minimum
/**
* @internal for mapping via Symfony component.
*
* @return ForeignReference[]
*/
public function getImage(): array

View file

@ -35,6 +35,7 @@ interface MapsToType
* - thuecat:TouristInformation
* - thuecat:Town
* -
*
* @return string[]
*/
public static function getSupportedTypes(): array;

View file

@ -27,30 +27,18 @@ use WerkraumMedia\ThueCat\Domain\Import\Entity\Properties\ForeignReference;
class MediaObject extends Minimum implements MapsToType
{
/**
* @var int
*/
protected $copyrightYear = 0;
protected int $copyrightYear = 0;
/**
* @var string
*/
protected $license = '';
protected string $license = '';
/**
* @var string
*/
protected $licenseAuthor = '';
protected string $licenseAuthor = '';
/**
* @var string|ForeignReference
*/
protected $author;
/**
* @var string
*/
protected $type = '';
protected string $type = '';
public function getCopyrightYear(): int
{
@ -85,7 +73,7 @@ class MediaObject extends Minimum implements MapsToType
*/
public function setCopyrightYear(string $copyrightYear): void
{
$this->copyrightYear = (int) $copyrightYear;
$this->copyrightYear = (int)$copyrightYear;
}
/**
@ -106,6 +94,7 @@ class MediaObject extends Minimum implements MapsToType
/**
* @internal for mapping via Symfony component.
*
* @param string|ForeignReference $author
*/
public function setAuthor($author): void

View file

@ -29,33 +29,27 @@ abstract class Minimum
* URL to the original source at ThüCAT.
* Not unique within our system. We have one entity per language,
* while ThüCAT has a single entity containing all languages.
*
* @var string
*/
protected $id = '';
protected string $id = '';
/**
* Short name of the thing.
* Can be translated.
*
* @var string
*/
protected $name = '';
protected string $name = '';
/**
* Long text describing the thing.
* Can be translated.
*
* @var string
*/
protected $description = '';
protected string $description = '';
/**
* URL to official version of this thing outside of ThüCAT.
*
* @var string[]
*/
protected $urls = [];
protected array $urls = [];
public function getId(): string
{
@ -108,6 +102,7 @@ abstract class Minimum
/**
* @internal for mapping via Symfony component.
*
* @param string|array $url
*/
public function setUrl($url): void

View file

@ -25,15 +25,9 @@ namespace WerkraumMedia\ThueCat\Domain\Import\Entity;
class Person extends Base implements MapsToType
{
/**
* @var string
*/
protected $givenName = '';
protected string $givenName = '';
/**
* @var string
*/
protected $familyName = '';
protected string $familyName = '';
public function getGivenName(): string
{

View file

@ -23,14 +23,15 @@ declare(strict_types=1);
namespace WerkraumMedia\ThueCat\Domain\Import\Entity;
use DateTimeImmutable;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use WerkraumMedia\ThueCat\Domain\Import\EntityMapper\PropertyValues;
use WerkraumMedia\ThueCat\Domain\Import\Entity\Properties\Address;
use WerkraumMedia\ThueCat\Domain\Import\Entity\Properties\ForeignReference;
use WerkraumMedia\ThueCat\Domain\Import\Entity\Properties\Geo;
use WerkraumMedia\ThueCat\Domain\Import\Entity\Properties\OpeningHour;
use WerkraumMedia\ThueCat\Domain\Import\Entity\Shared\ContainedInPlace;
use WerkraumMedia\ThueCat\Domain\Import\Entity\Shared\Organization;
use WerkraumMedia\ThueCat\Domain\Import\EntityMapper\PropertyValues;
use WerkraumMedia\ThueCat\Service\DateBasedFilter;
class Place extends Base
@ -38,60 +39,48 @@ class Place extends Base
use Organization;
use ContainedInPlace;
/**
* @var Address
*/
protected $address;
protected ?Address $address = null;
/**
* @var Geo
*/
protected $geo;
protected ?Geo $geo = null;
/**
* @var OpeningHour[]
*/
protected $openingHoursSpecifications = [];
protected array $openingHoursSpecifications = [];
/**
* @var OpeningHour[]
*/
protected $specialOpeningHours = [];
protected array $specialOpeningHours = [];
/**
* @var ForeignReference[]
*/
protected $parkingFacilitiesNearBy = [];
protected array $parkingFacilitiesNearBy = [];
/**
* @var string[]
*/
protected $sanitations = [];
protected array $sanitations = [];
/**
* @var string[]
*/
protected $otherServices = [];
protected array $otherServices = [];
/**
* @var string[]
*/
protected $trafficInfrastructures = [];
protected array $trafficInfrastructures = [];
/**
* @var string[]
*/
protected $paymentsAccepted = [];
protected array $paymentsAccepted = [];
/**
* @var string
*/
protected $distanceToPublicTransport = '';
protected string $distanceToPublicTransport = '';
/**
* @var ForeignReference
*/
protected $accessibilitySpecification;
protected ?ForeignReference $accessibilitySpecification = null;
public function getAddress(): ?Address
{
@ -161,10 +150,11 @@ class Place extends Base
return GeneralUtility::makeInstance(DateBasedFilter::class)
->filterOutPreviousDates(
$this->openingHoursSpecifications,
function (OpeningHour $hour): ?\DateTimeImmutable {
function (OpeningHour $hour): ?DateTimeImmutable {
return $hour->getValidThrough();
}
);
)
;
}
/**
@ -175,10 +165,11 @@ class Place extends Base
return GeneralUtility::makeInstance(DateBasedFilter::class)
->filterOutPreviousDates(
$this->specialOpeningHours,
function (OpeningHour $hour): ?\DateTimeImmutable {
function (OpeningHour $hour): ?DateTimeImmutable {
return $hour->getValidThrough();
}
);
)
;
}
/**
@ -252,6 +243,7 @@ class Place extends Base
/**
* @internal for mapping via Symfony component.
*
* @param string|array $sanitation
*/
public function setSanitation($sanitation): void
@ -265,6 +257,7 @@ class Place extends Base
/**
* @internal for mapping via Symfony component.
*
* @param string|array $otherService
*/
public function setOtherService($otherService): void
@ -278,6 +271,7 @@ class Place extends Base
/**
* @internal for mapping via Symfony component.
*
* @param string|array $trafficInfrastructure
*/
public function setTrafficInfrastructure($trafficInfrastructure): void
@ -291,6 +285,7 @@ class Place extends Base
/**
* @internal for mapping via Symfony component.
*
* @param string|array $paymentAccepted
*/
public function setPaymentAccepted($paymentAccepted): void

View file

@ -25,35 +25,17 @@ namespace WerkraumMedia\ThueCat\Domain\Import\Entity\Properties;
class Address
{
/**
* @var string
*/
protected $streetAddress = '';
protected string $streetAddress = '';
/**
* @var string
*/
protected $addressLocality = '';
protected string $addressLocality = '';
/**
* @var string
*/
protected $postalCode = '';
protected string $postalCode = '';
/**
* @var string
*/
protected $telephone = '';
protected string $telephone = '';
/**
* @var string
*/
protected $faxNumber = '';
protected string $faxNumber = '';
/**
* @var string
*/
protected $email = '';
protected string $email = '';
public function getStreetAddress(): string
{

View file

@ -25,14 +25,8 @@ namespace WerkraumMedia\ThueCat\Domain\Import\Entity\Properties;
class DayOfWeek
{
/**
* @var string
*/
protected $dayOfWeek = '';
public function __construct(
string $dayOfWeek
protected string $dayOfWeek
) {
$this->dayOfWeek = $dayOfWeek;
}
}

View file

@ -33,10 +33,8 @@ class ForeignReference
* URL to the original source at ThüCAT.
* Not unique within our system. We have one entity per language,
* while ThüCAT has a single entity containing all languages.
*
* @var string
*/
protected $id = '';
protected string $id = '';
public function getId(): string
{

View file

@ -25,15 +25,9 @@ namespace WerkraumMedia\ThueCat\Domain\Import\Entity\Properties;
class Geo
{
/**
* @var float
*/
protected $longitude = 0.00;
protected float $longitude = 0.00;
/**
* @var float
*/
protected $latitude = 0.00;
protected float $latitude = 0.00;
public function getLongitude(): float
{
@ -50,7 +44,7 @@ class Geo
*/
public function setLongitude(string $longitude): void
{
$this->longitude = (float) $longitude;
$this->longitude = (float)$longitude;
}
/**
@ -58,6 +52,6 @@ class Geo
*/
public function setLatitude(string $latitude): void
{
$this->latitude = (float) $latitude;
$this->latitude = (float)$latitude;
}
}

View file

@ -23,20 +23,20 @@ declare(strict_types=1);
namespace WerkraumMedia\ThueCat\Domain\Import\Entity\Properties;
use WerkraumMedia\ThueCat\Domain\Import\EntityMapper\PropertyValues;
use WerkraumMedia\ThueCat\Domain\Import\Entity\Minimum;
use WerkraumMedia\ThueCat\Domain\Import\EntityMapper\PropertyValues;
class Offer extends Minimum
{
/**
* @var string[]
*/
protected $offerTypes = [];
protected array $offerTypes = [];
/**
* @var PriceSpecification[]
*/
protected $prices = [];
protected array $prices = [];
/**
* @return string[]
@ -48,6 +48,7 @@ class Offer extends Minimum
/**
* @internal for mapping via Symfony component.
*
* @param string|array $offerType
*/
public function setOfferType($offerType): void
@ -57,7 +58,7 @@ class Offer extends Minimum
}
$this->offerTypes = array_map(
[PropertyValues::class, 'removePrefixFromEntry'],
PropertyValues::removePrefixFromEntry(...),
$offerType
);
}
@ -72,6 +73,7 @@ class Offer extends Minimum
/**
* @return PriceSpecification[]
*
* @internal for mapping via Symfony component.
*/
public function getPriceSpecification(): array

View file

@ -23,49 +23,39 @@ declare(strict_types=1);
namespace WerkraumMedia\ThueCat\Domain\Import\Entity\Properties;
use DateTimeImmutable;
class OpeningHour
{
/**
* @var \DateTimeImmutable|null
*/
protected $validFrom = null;
protected ?DateTimeImmutable $validFrom = null;
/**
* @var \DateTimeImmutable|null
*/
protected $validThrough = null;
protected ?DateTimeImmutable $validThrough = null;
/**
* @var \DateTimeImmutable
*/
protected $opens;
protected DateTimeImmutable $opens;
/**
* @var \DateTimeImmutable
*/
protected $closes;
protected DateTimeImmutable $closes;
/**
* @var string[]
*/
protected $daysOfWeek = [];
protected array $daysOfWeek = [];
public function getValidFrom(): ?\DateTimeImmutable
public function getValidFrom(): ?DateTimeImmutable
{
return $this->validFrom;
}
public function getValidThrough(): ?\DateTimeImmutable
public function getValidThrough(): ?DateTimeImmutable
{
return $this->validThrough;
}
public function getOpens(): \DateTimeImmutable
public function getOpens(): DateTimeImmutable
{
return $this->opens;
}
public function getCloses(): \DateTimeImmutable
public function getCloses(): DateTimeImmutable
{
return $this->closes;
}
@ -81,7 +71,7 @@ class OpeningHour
/**
* @internal for mapping via Symfony component.
*/
public function setValidFrom(\DateTimeImmutable $validFrom): void
public function setValidFrom(DateTimeImmutable $validFrom): void
{
$this->validFrom = $validFrom;
}
@ -89,7 +79,7 @@ class OpeningHour
/**
* @internal for mapping via Symfony component.
*/
public function setValidThrough(\DateTimeImmutable $validThrough): void
public function setValidThrough(DateTimeImmutable $validThrough): void
{
$this->validThrough = $validThrough;
}
@ -97,7 +87,7 @@ class OpeningHour
/**
* @internal for mapping via Symfony component.
*/
public function setOpens(\DateTimeImmutable $opens): void
public function setOpens(DateTimeImmutable $opens): void
{
$this->opens = $opens;
}
@ -105,7 +95,7 @@ class OpeningHour
/**
* @internal for mapping via Symfony component.
*/
public function setCloses(\DateTimeImmutable $closes): void
public function setCloses(DateTimeImmutable $closes): void
{
$this->closes = $closes;
}

View file

@ -23,31 +23,24 @@ declare(strict_types=1);
namespace WerkraumMedia\ThueCat\Domain\Import\Entity\Properties;
use WerkraumMedia\ThueCat\Domain\Import\EntityMapper\PropertyValues;
use WerkraumMedia\ThueCat\Domain\Import\Entity\Minimum;
use WerkraumMedia\ThueCat\Domain\Import\EntityMapper\PropertyValues;
class PriceSpecification extends Minimum
{
/**
* @var float
*/
protected $price = 0.00;
protected float $price = 0.00;
/**
* E.g. 'EUR'
* ThueCat specific format.
*
* @var string
*/
protected $currency = '';
protected string $currency = '';
/**
* E.g. 'PerPerson'
* ThueCat specific property.
*
* @var array
*/
protected $calculationRules = [];
protected array $calculationRules = [];
public function getPrice(): float
{
@ -85,6 +78,7 @@ class PriceSpecification extends Minimum
/**
* @internal for mapping via Symfony component.
*
* @param string|array $calculationRule
*/
public function setCalculationRule($calculationRule): void

View file

@ -42,6 +42,7 @@ trait ContainedInPlace
/**
* @return ForeignReference[]
*
* @internal for mapping via Symfony component.
*/
public function getContainedInPlace(): array

View file

@ -29,10 +29,8 @@ trait ManagedBy
{
/**
* The Thing responsible for the data within this Thing.
*
* @var ForeignReference
*/
protected $managedBy;
protected ?ForeignReference $managedBy = null;
public function getManagedBy(): ?ForeignReference
{

View file

@ -34,7 +34,7 @@ trait Organization
/**
* @var Offer[]
*/
protected $offers = [];
protected array $offers = [];
/**
* @return Offer[]
@ -46,6 +46,7 @@ trait Organization
/**
* @internal for mapping via Symfony component.
*
* @return Offer[]
*/
public function getMakesOffer(): array

View file

@ -27,55 +27,40 @@ use WerkraumMedia\ThueCat\Domain\Import\EntityMapper\PropertyValues;
class TouristAttraction extends Place implements MapsToType