diff --git a/Classes/Core/Model/TypeInterface.php b/Classes/Core/Model/TypeInterface.php index 0c0f0454..2a98df16 100644 --- a/Classes/Core/Model/TypeInterface.php +++ b/Classes/Core/Model/TypeInterface.php @@ -43,7 +43,7 @@ public function getProperty(string $propertyName); * @param mixed $propertyValue The value of the property * @return self */ - public function setProperty(string $propertyName, $propertyValue); + public function setProperty(string $propertyName, mixed $propertyValue); /** * Adds a value to a property @@ -52,7 +52,7 @@ public function setProperty(string $propertyName, $propertyValue); * @param mixed $propertyValue The property value * @return self */ - public function addProperty(string $propertyName, $propertyValue); + public function addProperty(string $propertyName, mixed $propertyValue); /** * Set multiple properties at once diff --git a/Classes/Core/ViewHelpers/AbstractBaseTypeViewHelper.php b/Classes/Core/ViewHelpers/AbstractBaseTypeViewHelper.php index 1aea6f8d..ddd4afc2 100644 --- a/Classes/Core/ViewHelpers/AbstractBaseTypeViewHelper.php +++ b/Classes/Core/ViewHelpers/AbstractBaseTypeViewHelper.php @@ -16,12 +16,13 @@ use Brotkrueml\Schema\Core\TypeStack; use Brotkrueml\Schema\Manager\SchemaManager; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3Fluid\Fluid\Core\ViewHelper; +use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; +use TYPO3Fluid\Fluid\Core\ViewHelper\Exception; /** * @internal */ -abstract class AbstractBaseTypeViewHelper extends ViewHelper\AbstractViewHelper +abstract class AbstractBaseTypeViewHelper extends AbstractViewHelper { protected const ARGUMENT_AS = '-as'; protected const ARGUMENT_ID = '-id'; @@ -88,7 +89,7 @@ private function checkAsAttribute(): void $parentPropertyNameFromArgument = $this->arguments[static::ARGUMENT_AS]; if ($parentPropertyNameFromArgument === '') { - throw new ViewHelper\Exception( + throw new Exception( \sprintf( 'The child view helper of schema type "%s" must have an "%s" argument for embedding into the parent type', $this->getType(), @@ -110,7 +111,7 @@ private function checkIsMainEntityOfWebPage(): void $this->isMainEntityOfWebPage = $isMainEntityOfWebPage === 'true' ? 1 : (int)$isMainEntityOfWebPage; if ($this->isMainEntityOfWebPage < 0 || $this->isMainEntityOfWebPage > 2) { - throw new ViewHelper\Exception( + throw new Exception( \sprintf( 'The value of argument "%s" must be between 0 and 2, "%d" given (allowed: 0 = not a main entity, 1 = main entity, 2 = prioritised main entity', static::ARGUMENT_IS_MAIN_ENTITY_OF_WEBPAGE, @@ -121,7 +122,7 @@ private function checkIsMainEntityOfWebPage(): void } if ($this->isMainEntityOfWebPage > 0 && ! $this->stack->isEmpty()) { - throw new ViewHelper\Exception( + throw new Exception( \sprintf( 'The argument "%s" must not be used in the child type "%s", only the main type is allowed', static::ARGUMENT_IS_MAIN_ENTITY_OF_WEBPAGE, @@ -168,7 +169,7 @@ private function assignIdToModel(): void } if (! \is_string($id) && ! $id instanceof NodeIdentifierInterface) { - throw new ViewHelper\Exception( + throw new Exception( \sprintf( 'The %s argument has to be either a string or an instance of %s, %s given', static::ARGUMENT_ID, diff --git a/Classes/EventListener/RegisterTypePropertiesMovedFromOfficialToPending.php b/Classes/EventListener/RegisterTypePropertiesMovedFromOfficialToPending.php index 905a4950..ee10594c 100644 --- a/Classes/EventListener/RegisterTypePropertiesMovedFromOfficialToPending.php +++ b/Classes/EventListener/RegisterTypePropertiesMovedFromOfficialToPending.php @@ -12,7 +12,159 @@ namespace Brotkrueml\Schema\EventListener; use Brotkrueml\Schema\Event\RegisterAdditionalTypePropertiesEvent; -use Brotkrueml\Schema\Model\Type; +use Brotkrueml\Schema\Model\Type\AboutPage; +use Brotkrueml\Schema\Model\Type\ActionAccessSpecification; +use Brotkrueml\Schema\Model\Type\AggregateOffer; +use Brotkrueml\Schema\Model\Type\Answer; +use Brotkrueml\Schema\Model\Type\APIReference; +use Brotkrueml\Schema\Model\Type\Article; +use Brotkrueml\Schema\Model\Type\AudioObject; +use Brotkrueml\Schema\Model\Type\BankAccount; +use Brotkrueml\Schema\Model\Type\Barcode; +use Brotkrueml\Schema\Model\Type\Blog; +use Brotkrueml\Schema\Model\Type\BlogPosting; +use Brotkrueml\Schema\Model\Type\Book; +use Brotkrueml\Schema\Model\Type\BookSeries; +use Brotkrueml\Schema\Model\Type\BroadcastEvent; +use Brotkrueml\Schema\Model\Type\BroadcastService; +use Brotkrueml\Schema\Model\Type\BusReservation; +use Brotkrueml\Schema\Model\Type\BusTrip; +use Brotkrueml\Schema\Model\Type\CableOrSatelliteService; +use Brotkrueml\Schema\Model\Type\Car; +use Brotkrueml\Schema\Model\Type\CheckoutPage; +use Brotkrueml\Schema\Model\Type\ClaimReview; +use Brotkrueml\Schema\Model\Type\Clip; +use Brotkrueml\Schema\Model\Type\CollectionPage; +use Brotkrueml\Schema\Model\Type\Comment; +use Brotkrueml\Schema\Model\Type\ContactPage; +use Brotkrueml\Schema\Model\Type\Conversation; +use Brotkrueml\Schema\Model\Type\Course; +use Brotkrueml\Schema\Model\Type\CreativeWork; +use Brotkrueml\Schema\Model\Type\CreativeWorkSeason; +use Brotkrueml\Schema\Model\Type\CreativeWorkSeries; +use Brotkrueml\Schema\Model\Type\CreditCard; +use Brotkrueml\Schema\Model\Type\CurrencyConversionService; +use Brotkrueml\Schema\Model\Type\DataCatalog; +use Brotkrueml\Schema\Model\Type\DataDownload; +use Brotkrueml\Schema\Model\Type\DataFeed; +use Brotkrueml\Schema\Model\Type\Dataset; +use Brotkrueml\Schema\Model\Type\DeliveryChargeSpecification; +use Brotkrueml\Schema\Model\Type\Demand; +use Brotkrueml\Schema\Model\Type\DepositAccount; +use Brotkrueml\Schema\Model\Type\DigitalDocument; +use Brotkrueml\Schema\Model\Type\DiscussionForumPosting; +use Brotkrueml\Schema\Model\Type\EmailMessage; +use Brotkrueml\Schema\Model\Type\Episode; +use Brotkrueml\Schema\Model\Type\EventReservation; +use Brotkrueml\Schema\Model\Type\FAQPage; +use Brotkrueml\Schema\Model\Type\FinancialProduct; +use Brotkrueml\Schema\Model\Type\Flight; +use Brotkrueml\Schema\Model\Type\FlightReservation; +use Brotkrueml\Schema\Model\Type\FoodEstablishmentReservation; +use Brotkrueml\Schema\Model\Type\FoodService; +use Brotkrueml\Schema\Model\Type\Game; +use Brotkrueml\Schema\Model\Type\GovernmentService; +use Brotkrueml\Schema\Model\Type\HowTo; +use Brotkrueml\Schema\Model\Type\HowToDirection; +use Brotkrueml\Schema\Model\Type\HowToSection; +use Brotkrueml\Schema\Model\Type\HowToStep; +use Brotkrueml\Schema\Model\Type\HowToTip; +use Brotkrueml\Schema\Model\Type\ImageGallery; +use Brotkrueml\Schema\Model\Type\ImageObject; +use Brotkrueml\Schema\Model\Type\IndividualProduct; +use Brotkrueml\Schema\Model\Type\InvestmentOrDeposit; +use Brotkrueml\Schema\Model\Type\Invoice; +use Brotkrueml\Schema\Model\Type\ItemPage; +use Brotkrueml\Schema\Model\Type\JobPosting; +use Brotkrueml\Schema\Model\Type\LiveBlogPosting; +use Brotkrueml\Schema\Model\Type\LoanOrCredit; +use Brotkrueml\Schema\Model\Type\LodgingReservation; +use Brotkrueml\Schema\Model\Type\Map; +use Brotkrueml\Schema\Model\Type\MediaGallery; +use Brotkrueml\Schema\Model\Type\MediaObject; +use Brotkrueml\Schema\Model\Type\Menu; +use Brotkrueml\Schema\Model\Type\MenuSection; +use Brotkrueml\Schema\Model\Type\Message; +use Brotkrueml\Schema\Model\Type\MobileApplication; +use Brotkrueml\Schema\Model\Type\Movie; +use Brotkrueml\Schema\Model\Type\MovieClip; +use Brotkrueml\Schema\Model\Type\MovieSeries; +use Brotkrueml\Schema\Model\Type\MusicAlbum; +use Brotkrueml\Schema\Model\Type\MusicComposition; +use Brotkrueml\Schema\Model\Type\MusicPlaylist; +use Brotkrueml\Schema\Model\Type\MusicRecording; +use Brotkrueml\Schema\Model\Type\MusicRelease; +use Brotkrueml\Schema\Model\Type\MusicVideoObject; +use Brotkrueml\Schema\Model\Type\NewsArticle; +use Brotkrueml\Schema\Model\Type\NoteDigitalDocument; +use Brotkrueml\Schema\Model\Type\Occupation; +use Brotkrueml\Schema\Model\Type\Offer; +use Brotkrueml\Schema\Model\Type\Painting; +use Brotkrueml\Schema\Model\Type\ParcelDelivery; +use Brotkrueml\Schema\Model\Type\PaymentCard; +use Brotkrueml\Schema\Model\Type\PaymentService; +use Brotkrueml\Schema\Model\Type\Periodical; +use Brotkrueml\Schema\Model\Type\Person; +use Brotkrueml\Schema\Model\Type\Photograph; +use Brotkrueml\Schema\Model\Type\PresentationDigitalDocument; +use Brotkrueml\Schema\Model\Type\Product; +use Brotkrueml\Schema\Model\Type\ProductModel; +use Brotkrueml\Schema\Model\Type\ProfilePage; +use Brotkrueml\Schema\Model\Type\PublicationIssue; +use Brotkrueml\Schema\Model\Type\PublicationVolume; +use Brotkrueml\Schema\Model\Type\QAPage; +use Brotkrueml\Schema\Model\Type\Question; +use Brotkrueml\Schema\Model\Type\RadioClip; +use Brotkrueml\Schema\Model\Type\RadioEpisode; +use Brotkrueml\Schema\Model\Type\RadioSeason; +use Brotkrueml\Schema\Model\Type\RadioSeries; +use Brotkrueml\Schema\Model\Type\Recipe; +use Brotkrueml\Schema\Model\Type\RentalCarReservation; +use Brotkrueml\Schema\Model\Type\Report; +use Brotkrueml\Schema\Model\Type\Reservation; +use Brotkrueml\Schema\Model\Type\ReservationPackage; +use Brotkrueml\Schema\Model\Type\Review; +use Brotkrueml\Schema\Model\Type\ScholarlyArticle; +use Brotkrueml\Schema\Model\Type\ScreeningEvent; +use Brotkrueml\Schema\Model\Type\Sculpture; +use Brotkrueml\Schema\Model\Type\SearchResultsPage; +use Brotkrueml\Schema\Model\Type\Service; +use Brotkrueml\Schema\Model\Type\SiteNavigationElement; +use Brotkrueml\Schema\Model\Type\SocialMediaPosting; +use Brotkrueml\Schema\Model\Type\SoftwareApplication; +use Brotkrueml\Schema\Model\Type\SoftwareSourceCode; +use Brotkrueml\Schema\Model\Type\SomeProducts; +use Brotkrueml\Schema\Model\Type\SportsEvent; +use Brotkrueml\Schema\Model\Type\SportsOrganization; +use Brotkrueml\Schema\Model\Type\SportsTeam; +use Brotkrueml\Schema\Model\Type\SpreadsheetDigitalDocument; +use Brotkrueml\Schema\Model\Type\Table; +use Brotkrueml\Schema\Model\Type\TaxiReservation; +use Brotkrueml\Schema\Model\Type\TaxiService; +use Brotkrueml\Schema\Model\Type\TechArticle; +use Brotkrueml\Schema\Model\Type\TextDigitalDocument; +use Brotkrueml\Schema\Model\Type\TrainReservation; +use Brotkrueml\Schema\Model\Type\TrainTrip; +use Brotkrueml\Schema\Model\Type\Trip; +use Brotkrueml\Schema\Model\Type\TVClip; +use Brotkrueml\Schema\Model\Type\TVEpisode; +use Brotkrueml\Schema\Model\Type\TVSeason; +use Brotkrueml\Schema\Model\Type\TVSeries; +use Brotkrueml\Schema\Model\Type\Vehicle; +use Brotkrueml\Schema\Model\Type\VideoGallery; +use Brotkrueml\Schema\Model\Type\VideoGame; +use Brotkrueml\Schema\Model\Type\VideoGameClip; +use Brotkrueml\Schema\Model\Type\VideoGameSeries; +use Brotkrueml\Schema\Model\Type\VideoObject; +use Brotkrueml\Schema\Model\Type\VisualArtwork; +use Brotkrueml\Schema\Model\Type\WebApplication; +use Brotkrueml\Schema\Model\Type\WebPage; +use Brotkrueml\Schema\Model\Type\WebPageElement; +use Brotkrueml\Schema\Model\Type\WebSite; +use Brotkrueml\Schema\Model\Type\WPAdBlock; +use Brotkrueml\Schema\Model\Type\WPFooter; +use Brotkrueml\Schema\Model\Type\WPHeader; +use Brotkrueml\Schema\Model\Type\WPSideBar; /** * The following properties has been available as official @@ -26,200 +178,200 @@ final class RegisterTypePropertiesMovedFromOfficialToPending { /** - * @var array + * @var list */ private array $hasEnergyConsumptionDetails = [ - Type\Car::class, - Type\IndividualProduct::class, - Type\Product::class, - Type\ProductModel::class, - Type\SomeProducts::class, - Type\Vehicle::class, + Car::class, + IndividualProduct::class, + Product::class, + ProductModel::class, + SomeProducts::class, + Vehicle::class, ]; /** - * @var array + * @var list */ private array $ineligibleRegionTypes = [ - Type\ActionAccessSpecification::class, - Type\AggregateOffer::class, - Type\DeliveryChargeSpecification::class, - Type\Demand::class, - Type\Offer::class, + ActionAccessSpecification::class, + AggregateOffer::class, + DeliveryChargeSpecification::class, + Demand::class, + Offer::class, ]; /** - * @var array + * @var list */ private array $occupationalCategoryTypes = [ - Type\JobPosting::class, - Type\Occupation::class, + JobPosting::class, + Occupation::class, ]; /** - * @var array + * @var list */ private array $providerTypes = [ - Type\AboutPage::class, - Type\Answer::class, - Type\APIReference::class, - Type\Article::class, - Type\AudioObject::class, - Type\BankAccount::class, - Type\Barcode::class, - Type\Blog::class, - Type\BlogPosting::class, - Type\Book::class, - Type\BookSeries::class, - Type\BroadcastService::class, - Type\BusReservation::class, - Type\BusTrip::class, - Type\CableOrSatelliteService::class, - Type\CheckoutPage::class, - Type\ClaimReview::class, - Type\Clip::class, - Type\CollectionPage::class, - Type\Comment::class, - Type\ContactPage::class, - Type\Conversation::class, - Type\Course::class, - Type\CreativeWork::class, - Type\CreativeWorkSeason::class, - Type\CreativeWorkSeries::class, - Type\CreditCard::class, - Type\CurrencyConversionService::class, - Type\DataCatalog::class, - Type\DataDownload::class, - Type\DataFeed::class, - Type\Dataset::class, - Type\DepositAccount::class, - Type\DigitalDocument::class, - Type\DiscussionForumPosting::class, - Type\EmailMessage::class, - Type\Episode::class, - Type\EventReservation::class, - Type\FAQPage::class, - Type\FinancialProduct::class, - Type\Flight::class, - Type\FlightReservation::class, - Type\FoodEstablishmentReservation::class, - Type\FoodService::class, - Type\Game::class, - Type\GovernmentService::class, - Type\HowTo::class, - Type\HowToDirection::class, - Type\HowToSection::class, - Type\HowToStep::class, - Type\HowToTip::class, - Type\ImageGallery::class, - Type\ImageObject::class, - Type\InvestmentOrDeposit::class, - Type\Invoice::class, - Type\ItemPage::class, - Type\LiveBlogPosting::class, - Type\LoanOrCredit::class, - Type\LodgingReservation::class, - Type\Map::class, - Type\MediaGallery::class, - Type\MediaObject::class, - Type\Menu::class, - Type\MenuSection::class, - Type\Message::class, - Type\MobileApplication::class, - Type\Movie::class, - Type\MovieClip::class, - Type\MovieSeries::class, - Type\MusicAlbum::class, - Type\MusicComposition::class, - Type\MusicPlaylist::class, - Type\MusicRecording::class, - Type\MusicRelease::class, - Type\MusicVideoObject::class, - Type\NewsArticle::class, - Type\NoteDigitalDocument::class, - Type\Painting::class, - Type\ParcelDelivery::class, - Type\PaymentCard::class, - Type\PaymentService::class, - Type\Periodical::class, - Type\Photograph::class, - Type\PresentationDigitalDocument::class, - Type\ProfilePage::class, - Type\PublicationIssue::class, - Type\PublicationVolume::class, - Type\QAPage::class, - Type\Question::class, - Type\RadioClip::class, - Type\RadioEpisode::class, - Type\RadioSeason::class, - Type\RadioSeries::class, - Type\Recipe::class, - Type\RentalCarReservation::class, - Type\Report::class, - Type\Reservation::class, - Type\ReservationPackage::class, - Type\Review::class, - Type\ScholarlyArticle::class, - Type\Sculpture::class, - Type\SearchResultsPage::class, - Type\Service::class, - Type\SiteNavigationElement::class, - Type\SocialMediaPosting::class, - Type\SoftwareApplication::class, - Type\SoftwareSourceCode::class, - Type\SpreadsheetDigitalDocument::class, - Type\Table::class, - Type\TaxiReservation::class, - Type\TaxiService::class, - Type\TechArticle::class, - Type\TextDigitalDocument::class, - Type\TrainReservation::class, - Type\TrainTrip::class, - Type\Trip::class, - Type\TVClip::class, - Type\TVEpisode::class, - Type\TVSeason::class, - Type\TVSeries::class, - Type\VideoGallery::class, - Type\VideoGame::class, - Type\VideoGameClip::class, - Type\VideoGameSeries::class, - Type\VideoObject::class, - Type\VisualArtwork::class, - Type\WebApplication::class, - Type\WebPage::class, - Type\WebPageElement::class, - Type\WebSite::class, - Type\WPAdBlock::class, - Type\WPFooter::class, - Type\WPHeader::class, - Type\WPSideBar::class, + AboutPage::class, + Answer::class, + APIReference::class, + Article::class, + AudioObject::class, + BankAccount::class, + Barcode::class, + Blog::class, + BlogPosting::class, + Book::class, + BookSeries::class, + BroadcastService::class, + BusReservation::class, + BusTrip::class, + CableOrSatelliteService::class, + CheckoutPage::class, + ClaimReview::class, + Clip::class, + CollectionPage::class, + Comment::class, + ContactPage::class, + Conversation::class, + Course::class, + CreativeWork::class, + CreativeWorkSeason::class, + CreativeWorkSeries::class, + CreditCard::class, + CurrencyConversionService::class, + DataCatalog::class, + DataDownload::class, + DataFeed::class, + Dataset::class, + DepositAccount::class, + DigitalDocument::class, + DiscussionForumPosting::class, + EmailMessage::class, + Episode::class, + EventReservation::class, + FAQPage::class, + FinancialProduct::class, + Flight::class, + FlightReservation::class, + FoodEstablishmentReservation::class, + FoodService::class, + Game::class, + GovernmentService::class, + HowTo::class, + HowToDirection::class, + HowToSection::class, + HowToStep::class, + HowToTip::class, + ImageGallery::class, + ImageObject::class, + InvestmentOrDeposit::class, + Invoice::class, + ItemPage::class, + LiveBlogPosting::class, + LoanOrCredit::class, + LodgingReservation::class, + Map::class, + MediaGallery::class, + MediaObject::class, + Menu::class, + MenuSection::class, + Message::class, + MobileApplication::class, + Movie::class, + MovieClip::class, + MovieSeries::class, + MusicAlbum::class, + MusicComposition::class, + MusicPlaylist::class, + MusicRecording::class, + MusicRelease::class, + MusicVideoObject::class, + NewsArticle::class, + NoteDigitalDocument::class, + Painting::class, + ParcelDelivery::class, + PaymentCard::class, + PaymentService::class, + Periodical::class, + Photograph::class, + PresentationDigitalDocument::class, + ProfilePage::class, + PublicationIssue::class, + PublicationVolume::class, + QAPage::class, + Question::class, + RadioClip::class, + RadioEpisode::class, + RadioSeason::class, + RadioSeries::class, + Recipe::class, + RentalCarReservation::class, + Report::class, + Reservation::class, + ReservationPackage::class, + Review::class, + ScholarlyArticle::class, + Sculpture::class, + SearchResultsPage::class, + Service::class, + SiteNavigationElement::class, + SocialMediaPosting::class, + SoftwareApplication::class, + SoftwareSourceCode::class, + SpreadsheetDigitalDocument::class, + Table::class, + TaxiReservation::class, + TaxiService::class, + TechArticle::class, + TextDigitalDocument::class, + TrainReservation::class, + TrainTrip::class, + Trip::class, + TVClip::class, + TVEpisode::class, + TVSeason::class, + TVSeries::class, + VideoGallery::class, + VideoGame::class, + VideoGameClip::class, + VideoGameSeries::class, + VideoObject::class, + VisualArtwork::class, + WebApplication::class, + WebPage::class, + WebPageElement::class, + WebSite::class, + WPAdBlock::class, + WPFooter::class, + WPHeader::class, + WPSideBar::class, ]; /** - * @var array + * @var list */ private array $sportTypes = [ - Type\SportsEvent::class, - Type\SportsOrganization::class, - Type\SportsTeam::class, + SportsEvent::class, + SportsOrganization::class, + SportsTeam::class, ]; /** - * @var array + * @var list */ private array $subtitleLanguageTypes = [ - Type\BroadcastEvent::class, - Type\Movie::class, - Type\ScreeningEvent::class, - Type\TVEpisode::class, + BroadcastEvent::class, + Movie::class, + ScreeningEvent::class, + TVEpisode::class, ]; public function __invoke(RegisterAdditionalTypePropertiesEvent $event): void { $type = $event->getType(); - if ($type === Type\Person::class) { + if ($type === Person::class) { // @see https://github.com/schemaorg/schemaorg/issues/2499 $event->registerAdditionalProperty('gender'); diff --git a/Classes/ViewHelpers/AdminPanel/PropertyValueViewHelper.php b/Classes/ViewHelpers/AdminPanel/PropertyValueViewHelper.php index af439298..373170f6 100644 --- a/Classes/ViewHelpers/AdminPanel/PropertyValueViewHelper.php +++ b/Classes/ViewHelpers/AdminPanel/PropertyValueViewHelper.php @@ -19,12 +19,12 @@ use TYPO3\CMS\Core\Localization\LanguageService; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface; -use TYPO3Fluid\Fluid\Core\ViewHelper; +use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; /** * @internal */ -final class PropertyValueViewHelper extends ViewHelper\AbstractViewHelper +final class PropertyValueViewHelper extends AbstractViewHelper { /** * @var list @@ -171,7 +171,7 @@ private static function renderIconLink(Link $typeLink): string private static function getIconFactory(): IconFactory { - if (! self::$iconFactory instanceof \TYPO3\CMS\Core\Imaging\IconFactory) { + if (! self::$iconFactory instanceof IconFactory) { self::$iconFactory = GeneralUtility::makeInstance(IconFactory::class); } @@ -180,7 +180,7 @@ private static function getIconFactory(): IconFactory private static function getTypeProvider(): TypeProvider { - if (! self::$typeProvider instanceof \Brotkrueml\Schema\Type\TypeProvider) { + if (! self::$typeProvider instanceof TypeProvider) { self::$typeProvider = GeneralUtility::makeInstance(TypeProvider::class); } diff --git a/Classes/ViewHelpers/BreadcrumbViewHelper.php b/Classes/ViewHelpers/BreadcrumbViewHelper.php index ae760972..a1af50d8 100644 --- a/Classes/ViewHelpers/BreadcrumbViewHelper.php +++ b/Classes/ViewHelpers/BreadcrumbViewHelper.php @@ -15,7 +15,8 @@ use Brotkrueml\Schema\Type\TypeFactory; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface; -use TYPO3Fluid\Fluid\Core\ViewHelper; +use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; +use TYPO3Fluid\Fluid\Core\ViewHelper\Exception; /** * ViewHelper for building the breadcrumb structure and assigning it @@ -52,7 +53,7 @@ * * */ -final class BreadcrumbViewHelper extends ViewHelper\AbstractViewHelper +final class BreadcrumbViewHelper extends AbstractViewHelper { private const ARGUMENT_BREADCRUMB = 'breadcrumb'; private const ARGUMENT_RENDER_FIRST_ITEM = 'renderFirstItem'; @@ -103,7 +104,7 @@ public static function renderStatic( $itemsCount = \count($arguments[self::ARGUMENT_BREADCRUMB]); for ($i = 0; $i < $itemsCount; $i++) { $id = (string)$arguments[self::ARGUMENT_BREADCRUMB][$i]['link']; - if (! \str_starts_with($id, $siteUrl)) { + if (! \str_starts_with($id, (string)$siteUrl)) { $id = $siteUrl . \ltrim($id, '/'); } @@ -139,14 +140,14 @@ private static function checkBreadcrumbStructure(array $breadcrumb): void { foreach ($breadcrumb as $item) { if (! isset($item['title'])) { - throw new ViewHelper\Exception( + throw new Exception( 'An item in the given breadcrumb structure does not have the "title" key.', 1561890280, ); } if (! isset($item['link'])) { - throw new ViewHelper\Exception( + throw new Exception( 'An item in the given breadcrumb structure does not have the "link" key.', 1561890281, ); diff --git a/Classes/ViewHelpers/PropertyViewHelper.php b/Classes/ViewHelpers/PropertyViewHelper.php index dbf31010..70b87200 100644 --- a/Classes/ViewHelpers/PropertyViewHelper.php +++ b/Classes/ViewHelpers/PropertyViewHelper.php @@ -14,7 +14,8 @@ use Brotkrueml\Schema\Core\Model\TypeInterface; use Brotkrueml\Schema\Core\TypeStack; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3Fluid\Fluid\Core\ViewHelper; +use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; +use TYPO3Fluid\Fluid\Core\ViewHelper\Exception; /** * ViewHelper for adding a property with a string value to a @@ -28,7 +29,7 @@ * * */ -final class PropertyViewHelper extends ViewHelper\AbstractViewHelper +final class PropertyViewHelper extends AbstractViewHelper { private const ARGUMENT_AS = '-as'; private const ARGUMENT_VALUE = 'value'; @@ -53,7 +54,7 @@ public function render(): void $this->checkAttributes(); if ($this->typeStack->isEmpty()) { - throw new ViewHelper\Exception( + throw new Exception( 'The property view helper can only be used as a child of a type view helper', 1561838013, ); @@ -70,14 +71,14 @@ private function checkAttributes(): void $emptyMessage = 'The argument "%s" cannot be empty'; if ($this->arguments[self::ARGUMENT_AS] === '') { - throw new ViewHelper\Exception( + throw new Exception( \sprintf($emptyMessage, self::ARGUMENT_AS), 1561838834, ); } if ($this->arguments[self::ARGUMENT_VALUE] === '') { - throw new ViewHelper\Exception( + throw new Exception( \sprintf($emptyMessage, self::ARGUMENT_VALUE), 1561838999, ); diff --git a/Tests/Fixtures/Configuration/TxSchema/TypeModels.php b/Tests/Fixtures/Configuration/TxSchema/TypeModels.php index b3d632e9..fa35b660 100644 --- a/Tests/Fixtures/Configuration/TxSchema/TypeModels.php +++ b/Tests/Fixtures/Configuration/TxSchema/TypeModels.php @@ -9,11 +9,18 @@ * LICENSE.txt file that was distributed with this source code. */ +use Brotkrueml\Schema\Tests\Fixtures\Model\Type\BreadcrumbList; +use Brotkrueml\Schema\Tests\Fixtures\Model\Type\Image; +use Brotkrueml\Schema\Tests\Fixtures\Model\Type\Table; +use Brotkrueml\Schema\Tests\Fixtures\Model\Type\Thing; +use Brotkrueml\Schema\Tests\Fixtures\Model\Type\WebPage; +use Brotkrueml\Schema\Tests\Fixtures\Model\Type\WebSite; + return [ - \Brotkrueml\Schema\Tests\Fixtures\Model\Type\WebPage::class, - \Brotkrueml\Schema\Tests\Fixtures\Model\Type\Image::class, - \Brotkrueml\Schema\Tests\Fixtures\Model\Type\BreadcrumbList::class, - \Brotkrueml\Schema\Tests\Fixtures\Model\Type\Thing::class, - \Brotkrueml\Schema\Tests\Fixtures\Model\Type\Table::class, - \Brotkrueml\Schema\Tests\Fixtures\Model\Type\WebSite::class, + WebPage::class, + Image::class, + BreadcrumbList::class, + Thing::class, + Table::class, + WebSite::class, ]; diff --git a/Tests/Functional/ViewHelpers/BreadcrumbViewHelperTest.php b/Tests/Functional/ViewHelpers/BreadcrumbViewHelperTest.php index 4bd3d7ba..64756032 100644 --- a/Tests/Functional/ViewHelpers/BreadcrumbViewHelperTest.php +++ b/Tests/Functional/ViewHelpers/BreadcrumbViewHelperTest.php @@ -24,7 +24,7 @@ use TYPO3\CMS\Core\Cache\Frontend\PhpFrontend; use TYPO3\CMS\Core\Package\PackageManager; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3Fluid\Fluid\Core\Parser; +use TYPO3Fluid\Fluid\Core\Parser\Exception; use TYPO3Fluid\Fluid\Core\ViewHelper; #[CoversClass(BreadcrumbViewHelper::class)] @@ -246,7 +246,7 @@ public static function fluidTemplatesProviderForExceptions(): iterable yield 'Missing breadcrumb attribute' => [ '', [], - Parser\Exception::class, + Exception::class, 1237823699, ]; diff --git a/Tests/Functional/ViewHelpers/MultipleTypeViewHelperTest.php b/Tests/Functional/ViewHelpers/MultipleTypeViewHelperTest.php index 61af3ae2..ccf39d30 100644 --- a/Tests/Functional/ViewHelpers/MultipleTypeViewHelperTest.php +++ b/Tests/Functional/ViewHelpers/MultipleTypeViewHelperTest.php @@ -20,7 +20,7 @@ use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\Test; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3Fluid\Fluid\Core\ViewHelper; +use TYPO3Fluid\Fluid\Core\ViewHelper\Exception; #[CoversClass(MultipleTypeViewHelper::class)] final class MultipleTypeViewHelperTest extends ViewHelperTestCase @@ -137,7 +137,7 @@ public static function fluidTemplatesProvider(): iterable #[Test] public function itThrowsExceptionWhenUsedAsAChildTypeWithoutAsArgument(): void { - $this->expectException(ViewHelper\Exception::class); + $this->expectException(Exception::class); $this->expectExceptionMessage('The child view helper of schema type "ProductStub / ServiceStub" must have an "-as" argument for embedding into the parent type'); $template = <<< EOF diff --git a/Tests/Functional/ViewHelpers/PropertyViewHelperTest.php b/Tests/Functional/ViewHelpers/PropertyViewHelperTest.php index 2e3ebf99..a9af6d51 100644 --- a/Tests/Functional/ViewHelpers/PropertyViewHelperTest.php +++ b/Tests/Functional/ViewHelpers/PropertyViewHelperTest.php @@ -21,7 +21,7 @@ use PHPUnit\Framework\Attributes\Test; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3Fluid\Fluid\Core\Parser; -use TYPO3Fluid\Fluid\Core\ViewHelper; +use TYPO3Fluid\Fluid\Core\ViewHelper\Exception; #[CoversClass(PropertyViewHelper::class)] final class PropertyViewHelperTest extends ViewHelperTestCase @@ -99,7 +99,7 @@ public static function fluidTemplatesProviderForExceptions(): iterable { yield 'View helper is not a child of a type' => [ '', - ViewHelper\Exception::class, + Exception::class, 1561838013, ]; @@ -117,13 +117,13 @@ public static function fluidTemplatesProviderForExceptions(): iterable yield 'Empty -as attribute' => [ '', - ViewHelper\Exception::class, + Exception::class, 1561838834, ]; yield 'Empty value attribute' => [ '', - ViewHelper\Exception::class, + Exception::class, 1561838999, ]; } diff --git a/Tests/Functional/ViewHelpers/Type/ThingViewHelperTest.php b/Tests/Functional/ViewHelpers/Type/ThingViewHelperTest.php index 5ae4a343..4a538287 100644 --- a/Tests/Functional/ViewHelpers/Type/ThingViewHelperTest.php +++ b/Tests/Functional/ViewHelpers/Type/ThingViewHelperTest.php @@ -12,7 +12,16 @@ namespace Brotkrueml\Schema\Tests\Functional\ViewHelpers\Type; use Brotkrueml\Schema\Extension; -use Brotkrueml\Schema\Model\Type; +use Brotkrueml\Schema\Model\Type\Action; +use Brotkrueml\Schema\Model\Type\ContactPoint; +use Brotkrueml\Schema\Model\Type\Corporation; +use Brotkrueml\Schema\Model\Type\CreativeWork; +use Brotkrueml\Schema\Model\Type\Event; +use Brotkrueml\Schema\Model\Type\Offer; +use Brotkrueml\Schema\Model\Type\Organization; +use Brotkrueml\Schema\Model\Type\Person; +use Brotkrueml\Schema\Model\Type\Thing; +use Brotkrueml\Schema\Model\Type\WebPage; use Brotkrueml\Schema\Tests\Functional\ViewHelpers\ViewHelperTestCase; use Brotkrueml\Schema\Tests\Helper\SchemaCacheTrait; use Brotkrueml\Schema\Type\TypeProvider; @@ -21,7 +30,7 @@ use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\Test; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3Fluid\Fluid\Core\ViewHelper; +use TYPO3Fluid\Fluid\Core\ViewHelper\Exception; #[CoversClass(ThingViewHelper::class)] final class ThingViewHelperTest extends ViewHelperTestCase @@ -34,16 +43,16 @@ protected function setUp(): void $this->defineCacheStubsWhichReturnEmptyEntry(); $typeProvider = new TypeProvider(); - $typeProvider->addType('Action', Type\Action::class); - $typeProvider->addType('ContactPoint', Type\ContactPoint::class); - $typeProvider->addType('Corporation', Type\Corporation::class); - $typeProvider->addType('CreativeWork', Type\CreativeWork::class); - $typeProvider->addType('Event', Type\Event::class); - $typeProvider->addType('Offer', Type\Offer::class); - $typeProvider->addType('Organization', Type\Organization::class); - $typeProvider->addType('Person', Type\Person::class); - $typeProvider->addType('Thing', Type\Thing::class); - $typeProvider->addType('WebPage', Type\WebPage::class); + $typeProvider->addType('Action', Action::class); + $typeProvider->addType('ContactPoint', ContactPoint::class); + $typeProvider->addType('Corporation', Corporation::class); + $typeProvider->addType('CreativeWork', CreativeWork::class); + $typeProvider->addType('Event', Event::class); + $typeProvider->addType('Offer', Offer::class); + $typeProvider->addType('Organization', Organization::class); + $typeProvider->addType('Person', Person::class); + $typeProvider->addType('Thing', Thing::class); + $typeProvider->addType('WebPage', WebPage::class); GeneralUtility::setSingletonInstance(TypeProvider::class, $typeProvider); } @@ -379,7 +388,7 @@ public function itThrowsExceptionWhenViewHelperIsUsedIncorrectly( int $expectedExceptionCode, string $expectedExceptionMessage, ): void { - $this->expectException(ViewHelper\Exception::class); + $this->expectException(Exception::class); $this->expectExceptionCode($expectedExceptionCode); $this->expectExceptionMessage($expectedExceptionMessage); diff --git a/Tests/Unit/EventListener/RegisterTypePropertiesMovedFromOfficialToPendingTest.php b/Tests/Unit/EventListener/RegisterTypePropertiesMovedFromOfficialToPendingTest.php index 96d135bc..26fa665b 100644 --- a/Tests/Unit/EventListener/RegisterTypePropertiesMovedFromOfficialToPendingTest.php +++ b/Tests/Unit/EventListener/RegisterTypePropertiesMovedFromOfficialToPendingTest.php @@ -13,7 +13,28 @@ use Brotkrueml\Schema\Event\RegisterAdditionalTypePropertiesEvent; use Brotkrueml\Schema\EventListener\RegisterTypePropertiesMovedFromOfficialToPending; -use Brotkrueml\Schema\Model\Type; +use Brotkrueml\Schema\Model\Type\AboutPage; +use Brotkrueml\Schema\Model\Type\ActionAccessSpecification; +use Brotkrueml\Schema\Model\Type\AggregateOffer; +use Brotkrueml\Schema\Model\Type\BroadcastEvent; +use Brotkrueml\Schema\Model\Type\Car; +use Brotkrueml\Schema\Model\Type\DeliveryChargeSpecification; +use Brotkrueml\Schema\Model\Type\Demand; +use Brotkrueml\Schema\Model\Type\IndividualProduct; +use Brotkrueml\Schema\Model\Type\JobPosting; +use Brotkrueml\Schema\Model\Type\Movie; +use Brotkrueml\Schema\Model\Type\Occupation; +use Brotkrueml\Schema\Model\Type\Offer; +use Brotkrueml\Schema\Model\Type\Person; +use Brotkrueml\Schema\Model\Type\Product; +use Brotkrueml\Schema\Model\Type\ProductModel; +use Brotkrueml\Schema\Model\Type\ScreeningEvent; +use Brotkrueml\Schema\Model\Type\SomeProducts; +use Brotkrueml\Schema\Model\Type\SportsEvent; +use Brotkrueml\Schema\Model\Type\SportsOrganization; +use Brotkrueml\Schema\Model\Type\SportsTeam; +use Brotkrueml\Schema\Model\Type\TVEpisode; +use Brotkrueml\Schema\Model\Type\Vehicle; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; @@ -30,7 +51,7 @@ protected function setUp(): void #[Test] public function additionalPropertiesForPersonTypeAreRegistered(): void { - $event = new RegisterAdditionalTypePropertiesEvent(Type\Person::class); + $event = new RegisterAdditionalTypePropertiesEvent(Person::class); ($this->subject)($event); self::assertContains('gender', $event->getAdditionalProperties()); @@ -49,12 +70,12 @@ public function additionalPropertyHasEnergyConsumptionDetailsIsRegisteredCorrect public static function dataProviderForHasEnergyConsumptionDetails(): \Iterator { - yield [Type\Car::class]; - yield [Type\IndividualProduct::class]; - yield [Type\Product::class]; - yield [Type\ProductModel::class]; - yield [Type\SomeProducts::class]; - yield [Type\Vehicle::class]; + yield [Car::class]; + yield [IndividualProduct::class]; + yield [Product::class]; + yield [ProductModel::class]; + yield [SomeProducts::class]; + yield [Vehicle::class]; } #[Test] @@ -69,11 +90,11 @@ public function additionalPropertyIneligibleRegionIsRegisteredCorrectly(string $ public static function dataProviderForIneligibleRegion(): \Iterator { - yield [Type\ActionAccessSpecification::class]; - yield [Type\AggregateOffer::class]; - yield [Type\DeliveryChargeSpecification::class]; - yield [Type\Demand::class]; - yield [Type\Offer::class]; + yield [ActionAccessSpecification::class]; + yield [AggregateOffer::class]; + yield [DeliveryChargeSpecification::class]; + yield [Demand::class]; + yield [Offer::class]; } /** @@ -83,7 +104,7 @@ public static function dataProviderForIneligibleRegion(): \Iterator #[Test] public function additionalPropertyProviderIsRegisteredCorrectly(): void { - $event = new RegisterAdditionalTypePropertiesEvent(Type\AboutPage::class); + $event = new RegisterAdditionalTypePropertiesEvent(AboutPage::class); ($this->subject)($event); self::assertContains('provider', $event->getAdditionalProperties()); @@ -101,9 +122,9 @@ public function additionalPropertySportIsRegisteredCorrectly(string $type): void public static function dataProviderForSport(): \Iterator { - yield [Type\SportsEvent::class]; - yield [Type\SportsOrganization::class]; - yield [Type\SportsTeam::class]; + yield [SportsEvent::class]; + yield [SportsOrganization::class]; + yield [SportsTeam::class]; } #[Test] @@ -118,10 +139,10 @@ public function additionalPropertySubtitleLanguageIsRegisteredCorrectly(string $ public static function dataProviderForSubtitleLanguage(): \Iterator { - yield [Type\BroadcastEvent::class]; - yield [Type\Movie::class]; - yield [Type\ScreeningEvent::class]; - yield [Type\TVEpisode::class]; + yield [BroadcastEvent::class]; + yield [Movie::class]; + yield [ScreeningEvent::class]; + yield [TVEpisode::class]; } #[Test] @@ -136,7 +157,7 @@ public function additionalPropertyOccupationalCategorIsRegisteredCorrectly(strin public static function dataProviderForOccupationalCategory(): \Iterator { - yield [Type\JobPosting::class]; - yield [Type\Occupation::class]; + yield [JobPosting::class]; + yield [Occupation::class]; } } diff --git a/composer.json b/composer.json index cb70ed76..e695fb2c 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,7 @@ "phpstan/extension-installer": "^1.3", "phpstan/phpstan": "1.10.57", "phpunit/phpunit": "^10.5", - "rector/rector": "0.19.5", + "rector/rector": "1.0.0", "saschaegerer/phpstan-typo3": "^1.10", "symfony/yaml": "^5.4 || ^6.4 || ^7.0", "symplify/phpstan-rules": "^12.4", diff --git a/ecs.php b/ecs.php index 6657f49b..c1503790 100644 --- a/ecs.php +++ b/ecs.php @@ -2,6 +2,9 @@ declare (strict_types=1); +use PhpCsFixer\Fixer\Comment\HeaderCommentFixer; +use PhpCsFixer\Fixer\ClassNotation\ClassAttributesSeparationFixer; +use PhpCsFixer\Fixer\Strict\DeclareStrictTypesFixer; use Symplify\EasyCodingStandard\Config\ECSConfig; return static function (ECSConfig $config): void { @@ -20,16 +23,16 @@ __DIR__ . '/Configuration', __DIR__ . '/Tests', ]); - $config->ruleWithConfiguration(\PhpCsFixer\Fixer\Comment\HeaderCommentFixer::class, [ + $config->ruleWithConfiguration(HeaderCommentFixer::class, [ 'comment_type' => 'comment', 'header' => $header, 'separate' => 'both', ]); $config->skip([ - \PhpCsFixer\Fixer\ClassNotation\ClassAttributesSeparationFixer::class => [ + ClassAttributesSeparationFixer::class => [ __DIR__ . '/Classes/Extension.php', ], - \PhpCsFixer\Fixer\Strict\DeclareStrictTypesFixer::class => [ + DeclareStrictTypesFixer::class => [ __DIR__ . '/Configuration/TCA/*', ], ]); diff --git a/ext_localconf.php b/ext_localconf.php index 60b047e9..03e8a6e4 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -1,25 +1,33 @@ execute'; + SchemaMarkupInjection::class . '->execute'; $GLOBALS['TYPO3_CONF_VARS']['SYS']['fluid']['namespaces']['schema'] = ['Brotkrueml\\Schema\\ViewHelpers']; -$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][Brotkrueml\Schema\Extension::CACHE_IDENTIFIER] ??= []; +$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][Extension::CACHE_IDENTIFIER] ??= []; // This configuration can be removed once compatibility with TYPO3 v11 is gone -$GLOBALS['TYPO3_CONF_VARS']['FE']['ContentObjects']['SCHEMA'] = Brotkrueml\Schema\TypoScript\SchemaContentObject::class; +$GLOBALS['TYPO3_CONF_VARS']['FE']['ContentObjects']['SCHEMA'] = SchemaContentObject::class; -if (TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('adminpanel')) { +if (ExtensionManagementUtility::isLoaded('adminpanel')) { $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']['ext-schema'] = [ - 'module' => Brotkrueml\Schema\AdminPanel\SchemaModule::class, + 'module' => SchemaModule::class, 'after' => ['tsdebug'], 'submodules' => [ 'types' => [ - 'module' => Brotkrueml\Schema\AdminPanel\TypesInformation::class, + 'module' => TypesInformation::class, ], ], ]; diff --git a/phpstan.baseline.neon b/phpstan.baseline.neon index c05e5521..1e7d9a5b 100644 --- a/phpstan.baseline.neon +++ b/phpstan.baseline.neon @@ -5,6 +5,11 @@ parameters: count: 1 path: Classes/Cache/PagesCacheService.php + - + message: "#^Offset 'uid' does not exist on array\\|null\\.$#" + count: 1 + path: Classes/Cache/PagesCacheService.php + - message: "#^Instanceof between mixed and Brotkrueml\\\\Schema\\\\Core\\\\Model\\\\TypeInterface will always evaluate to false\\.$#" count: 1 diff --git a/rector.php b/rector.php index 591e8394..fcf45367 100644 --- a/rector.php +++ b/rector.php @@ -3,58 +3,43 @@ declare(strict_types=1); use Rector\Config\RectorConfig; -use Rector\DeadCode\Rector\Cast\RecastingRemovalRector; use Rector\DeadCode\Rector\StaticCall\RemoveParentCallWithoutParentRector; use Rector\Php74\Rector\LNumber\AddLiteralSeparatorToNumberRector; use Rector\PHPUnit\CodeQuality\Rector\Class_\PreferPHPUnitThisCallRector; use Rector\PHPUnit\CodeQuality\Rector\ClassMethod\ReplaceTestAnnotationWithPrefixedFunctionRector; use Rector\PHPUnit\Set\PHPUnitSetList; -use Rector\Set\ValueObject\LevelSetList; -use Rector\Set\ValueObject\SetList; -use Rector\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedStrictParamTypeRector; -use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictTypedPropertyRector; -use Rector\TypeDeclaration\Rector\FunctionLike\AddReturnTypeDeclarationFromYieldsRector; -use Rector\ValueObject\PhpVersion; -return static function (RectorConfig $config): void { - $config->import(LevelSetList::UP_TO_PHP_81); - $config->import(PHPUnitSetList::PHPUNIT_100); - $config->import(PHPUnitSetList::PHPUNIT_CODE_QUALITY); - $config->import(SetList::CODE_QUALITY); - $config->import(SetList::DEAD_CODE); - $config->import(SetList::EARLY_RETURN); - $config->import(SetList::TYPE_DECLARATION); - - $config->phpVersion(PhpVersion::PHP_81); - - $config->autoloadPaths([ - __DIR__ . '/.Build/vendor/autoload.php', - ]); - $config->paths([ +return RectorConfig::configure() + ->withPaths([ __DIR__ . '/Classes', __DIR__ . '/Tests', - ]); - $config->skip([ + ]) + ->withPhpSets() + ->withAutoloadPaths([ + __DIR__ . '/.Build/vendor/autoload.php', + ]) + ->withImportNames( + importShortClasses: false, + removeUnusedImports: true, + ) + ->withPreparedSets( + deadCode: true, + codeQuality: true, + typeDeclarations: true, + earlyReturn: true, + ) + ->withSets([ + PHPUnitSetList::PHPUNIT_CODE_QUALITY, + PHPUnitSetList::PHPUNIT_100, + ]) + ->withRootFiles() + ->withSkip([ __DIR__ . '/Classes/Model/Type/*', __DIR__ . '/Classes/ViewHelpers/Type/*', AddLiteralSeparatorToNumberRector::class, - AddMethodCallBasedStrictParamTypeRector::class => [ - __DIR__ . '/Tests/*', - ], - AddReturnTypeDeclarationFromYieldsRector::class => [ - __DIR__ . '/Tests/*', - ], PreferPHPUnitThisCallRector::class, - RecastingRemovalRector::class => [ - __DIR__ . '/Tests/Functional/ViewHelpers/ViewHelperTestCase.php', - ], RemoveParentCallWithoutParentRector::class => [ __DIR__ . '/Classes/AdminPanel/SchemaModule', // can be removed with minimum compatibility to TYPO3 v12 LTS ], ReplaceTestAnnotationWithPrefixedFunctionRector::class, - ReturnTypeFromStrictTypedPropertyRector::class => [ - __DIR__ . '/Classes/Core/Model/AbstractType.php', - __DIR__ . '/Classes/Core/Model/MultipleType.php', - ], ]); -};