diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 78c1c466..2e8f283c 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -1,5 +1,14 @@ exclude(['Tests/Application/var/cache']) - ->in(__DIR__); + ->in(__DIR__) + ->ignoreDotFiles(false) + ->exclude(['Tests/Application/var']) +; $config = new PhpCsFixer\Config(); $config->setRiskyAllowed(true) diff --git a/Content/ArticleDataItem.php b/Content/ArticleDataItem.php index 573594fc..7ecf58c0 100644 --- a/Content/ArticleDataItem.php +++ b/Content/ArticleDataItem.php @@ -66,6 +66,6 @@ public function getResource() public function getImage() { - return; + return null; } } diff --git a/Content/ArticleDataProvider.php b/Content/ArticleDataProvider.php index 8340d9ae..0951ccbb 100644 --- a/Content/ArticleDataProvider.php +++ b/Content/ArticleDataProvider.php @@ -225,7 +225,7 @@ public function resolveResourceItems( public function resolveDatasource($datasource, array $propertyParameter, array $options) { - return; + return null; } private function getWebspaceKey(array $propertyParameter, array $options): ?string diff --git a/Resources/phpcr-migrations/ContainerAwareInterface.php b/Resources/phpcr-migrations/ContainerAwareInterface.php new file mode 100644 index 00000000..5a63a884 --- /dev/null +++ b/Resources/phpcr-migrations/ContainerAwareInterface.php @@ -0,0 +1,38 @@ +-authors` and adds `i18n:-author`. */ class Version201702211450 implements VersionInterface, ContainerAwareInterface { - use ContainerAwareTrait; + /** + * @var ContainerInterface + */ + private $container; + + public function setContainer(?ContainerInterface $container = null): void + { + if (null === $container) { + throw new \RuntimeException('Container is required to run this migration.'); + } + + $this->container = $container; + } public function up(SessionInterface $session) { diff --git a/Resources/phpcr-migrations/Version201712041018.php b/Resources/phpcr-migrations/Version201712041018.php index 5bf639bb..29ed7d4f 100644 --- a/Resources/phpcr-migrations/Version201712041018.php +++ b/Resources/phpcr-migrations/Version201712041018.php @@ -17,15 +17,26 @@ use PHPCR\NodeInterface; use PHPCR\SessionInterface; use Sulu\Component\Localization\Localization; -use Symfony\Component\DependencyInjection\ContainerAwareInterface; -use Symfony\Component\DependencyInjection\ContainerAwareTrait; +use Symfony\Component\DependencyInjection\ContainerInterface; /** * Removes the property `sulu:author(ed)` and adds `i18n:-author(ed)`. */ class Version201712041018 implements VersionInterface, ContainerAwareInterface { - use ContainerAwareTrait; + /** + * @var ContainerInterface + */ + private $container; + + public function setContainer(?ContainerInterface $container = null): void + { + if (null === $container) { + throw new \RuntimeException('Container is required to run this migration.'); + } + + $this->container = $container; + } public const AUTHOR_PROPERTY_NAME = 'sulu:author'; diff --git a/Resources/phpcr-migrations/Version201811091000.php b/Resources/phpcr-migrations/Version201811091000.php index c7942618..95ff2c2d 100644 --- a/Resources/phpcr-migrations/Version201811091000.php +++ b/Resources/phpcr-migrations/Version201811091000.php @@ -17,8 +17,7 @@ use PHPCR\NodeInterface; use PHPCR\SessionInterface; use Sulu\Component\Localization\Localization; -use Symfony\Component\DependencyInjection\ContainerAwareInterface; -use Symfony\Component\DependencyInjection\ContainerAwareTrait; +use Symfony\Component\DependencyInjection\ContainerInterface; /** * Removes the property `mainWebspace` and adds `i18n:-mainWebspace`. @@ -26,7 +25,19 @@ */ class Version201811091000 implements VersionInterface, ContainerAwareInterface { - use ContainerAwareTrait; + /** + * @var ContainerInterface + */ + private $container; + + public function setContainer(?ContainerInterface $container = null): void + { + if (null === $container) { + throw new \RuntimeException('Container is required to run this migration.'); + } + + $this->container = $container; + } public const MAIN_WEBSPACE_PROPERTY_NAME = 'mainWebspace'; diff --git a/Resources/phpcr-migrations/Version201905071542.php b/Resources/phpcr-migrations/Version201905071542.php index 9040450b..4037c690 100644 --- a/Resources/phpcr-migrations/Version201905071542.php +++ b/Resources/phpcr-migrations/Version201905071542.php @@ -13,12 +13,23 @@ use PHPCR\Migrations\VersionInterface; use PHPCR\SessionInterface; -use Symfony\Component\DependencyInjection\ContainerAwareInterface; -use Symfony\Component\DependencyInjection\ContainerAwareTrait; +use Symfony\Component\DependencyInjection\ContainerInterface; class Version201905071542 implements VersionInterface, ContainerAwareInterface { - use ContainerAwareTrait; + /** + * @var ContainerInterface + */ + private $container; + + public function setContainer(?ContainerInterface $container = null): void + { + if (null === $container) { + throw new \RuntimeException('Container is required to run this migration.'); + } + + $this->container = $container; + } public function up(SessionInterface $session) { diff --git a/Resources/phpcr-migrations/Version202005151141.php b/Resources/phpcr-migrations/Version202005151141.php index f649ba2d..29a11160 100644 --- a/Resources/phpcr-migrations/Version202005151141.php +++ b/Resources/phpcr-migrations/Version202005151141.php @@ -13,12 +13,23 @@ use PHPCR\Migrations\VersionInterface; use PHPCR\SessionInterface; -use Symfony\Component\DependencyInjection\ContainerAwareInterface; -use Symfony\Component\DependencyInjection\ContainerAwareTrait; +use Symfony\Component\DependencyInjection\ContainerInterface; class Version202005151141 implements VersionInterface, ContainerAwareInterface { - use ContainerAwareTrait; + /** + * @var ContainerInterface + */ + private $container; + + public function setContainer(?ContainerInterface $container = null): void + { + if (null === $container) { + throw new \RuntimeException('Container is required to run this migration.'); + } + + $this->container = $container; + } public function up(SessionInterface $session) { diff --git a/Resources/phpcr-migrations/Version202005191117.php b/Resources/phpcr-migrations/Version202005191117.php index 40880d39..7e66412e 100644 --- a/Resources/phpcr-migrations/Version202005191117.php +++ b/Resources/phpcr-migrations/Version202005191117.php @@ -13,12 +13,23 @@ use PHPCR\Migrations\VersionInterface; use PHPCR\SessionInterface; -use Symfony\Component\DependencyInjection\ContainerAwareInterface; -use Symfony\Component\DependencyInjection\ContainerAwareTrait; +use Symfony\Component\DependencyInjection\ContainerInterface; class Version202005191117 implements VersionInterface, ContainerAwareInterface { - use ContainerAwareTrait; + /** + * @var ContainerInterface + */ + private $container; + + public function setContainer(?ContainerInterface $container = null): void + { + if (null === $container) { + throw new \RuntimeException('Container is required to run this migration.'); + } + + $this->container = $container; + } public function up(SessionInterface $session) { diff --git a/Resources/phpcr-migrations/Version202005250920.php b/Resources/phpcr-migrations/Version202005250920.php index b50a8092..9f7a645a 100644 --- a/Resources/phpcr-migrations/Version202005250920.php +++ b/Resources/phpcr-migrations/Version202005250920.php @@ -13,12 +13,23 @@ use PHPCR\Migrations\VersionInterface; use PHPCR\SessionInterface; -use Symfony\Component\DependencyInjection\ContainerAwareInterface; -use Symfony\Component\DependencyInjection\ContainerAwareTrait; +use Symfony\Component\DependencyInjection\ContainerInterface; class Version202005250920 implements VersionInterface, ContainerAwareInterface { - use ContainerAwareTrait; + /** + * @var ContainerInterface + */ + private $container; + + public function setContainer(?ContainerInterface $container = null): void + { + if (null === $container) { + throw new \RuntimeException('Container is required to run this migration.'); + } + + $this->container = $container; + } public function up(SessionInterface $session) { diff --git a/Resources/phpcr-migrations/Version202210140922.php b/Resources/phpcr-migrations/Version202210140922.php index 0c61c814..f2730cda 100644 --- a/Resources/phpcr-migrations/Version202210140922.php +++ b/Resources/phpcr-migrations/Version202210140922.php @@ -13,15 +13,26 @@ use PHPCR\Migrations\VersionInterface; use PHPCR\SessionInterface; -use Symfony\Component\DependencyInjection\ContainerAwareInterface; -use Symfony\Component\DependencyInjection\ContainerAwareTrait; +use Symfony\Component\DependencyInjection\ContainerInterface; /** * Auto-generated Migration: Please modify to your needs! */ final class Version202210140922 implements VersionInterface, ContainerAwareInterface { - use ContainerAwareTrait; + /** + * @var ContainerInterface + */ + private $container; + + public function setContainer(?ContainerInterface $container = null): void + { + if (null === $container) { + throw new \RuntimeException('Container is required to run this migration.'); + } + + $this->container = $container; + } public function up(SessionInterface $session) { diff --git a/Resources/phpcr-migrations/Version202210241106.php b/Resources/phpcr-migrations/Version202210241106.php index 0f7403b9..37fc5405 100644 --- a/Resources/phpcr-migrations/Version202210241106.php +++ b/Resources/phpcr-migrations/Version202210241106.php @@ -15,12 +15,23 @@ use PHPCR\Migrations\VersionInterface; use PHPCR\SessionInterface; use Sulu\Component\Localization\Localization; -use Symfony\Component\DependencyInjection\ContainerAwareInterface; -use Symfony\Component\DependencyInjection\ContainerAwareTrait; +use Symfony\Component\DependencyInjection\ContainerInterface; class Version202210241106 implements VersionInterface, ContainerAwareInterface { - use ContainerAwareTrait; + /** + * @var ContainerInterface + */ + private $container; + + public function setContainer(?ContainerInterface $container = null): void + { + if (null === $container) { + throw new \RuntimeException('Container is required to run this migration.'); + } + + $this->container = $container; + } public function up(SessionInterface $session) { diff --git a/Resources/phpcr-migrations/Version202407111600.php b/Resources/phpcr-migrations/Version202407111600.php index 1d996f34..a2917144 100644 --- a/Resources/phpcr-migrations/Version202407111600.php +++ b/Resources/phpcr-migrations/Version202407111600.php @@ -13,7 +13,6 @@ use Jackalope\Query\Row; use PHPCR\Migrations\VersionInterface; -use PHPCR\PhpcrMigrationsBundle\ContainerAwareInterface; use PHPCR\SessionInterface; use Sulu\Bundle\ArticleBundle\Document\Subscriber\RoutableSubscriber; use Sulu\Component\Content\Metadata\Factory\StructureMetadataFactoryInterface; diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 7c51ed89..3faf98b4 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -80,11 +80,6 @@ parameters: count: 1 path: Command/ReindexCommand.php - - - message: "#^Method Sulu\\\\Bundle\\\\ArticleBundle\\\\Content\\\\ArticleDataItem\\:\\:getImage\\(\\) should return string but empty return statement found\\.$#" - count: 1 - path: Content/ArticleDataItem.php - - message: "#^Method Sulu\\\\Bundle\\\\ArticleBundle\\\\Content\\\\ArticleDataItem\\:\\:getResource\\(\\) has no return type specified\\.$#" count: 1 @@ -170,11 +165,6 @@ parameters: count: 1 path: Content/ArticleDataProvider.php - - - message: "#^Method Sulu\\\\Bundle\\\\ArticleBundle\\\\Content\\\\ArticleDataProvider\\:\\:resolveDatasource\\(\\) should return Sulu\\\\Component\\\\SmartContent\\\\DatasourceItemInterface but empty return statement found\\.$#" - count: 1 - path: Content/ArticleDataProvider.php - - message: "#^Negated boolean expression is always false\\.$#" count: 1 @@ -255,11 +245,6 @@ parameters: count: 1 path: Content/PageTreeArticleDataProvider.php - - - message: "#^Method Sulu\\\\Bundle\\\\ArticleBundle\\\\Content\\\\PageTreeArticleDataProvider\\:\\:resolveDatasource\\(\\) should return Sulu\\\\Component\\\\SmartContent\\\\DatasourceItemInterface but returns null\\.$#" - count: 2 - path: Content/PageTreeArticleDataProvider.php - - message: "#^Parameter \\#1 \\$identifier of method Sulu\\\\Component\\\\DocumentManager\\\\DocumentManagerInterface\\:\\:find\\(\\) expects string, int\\\\|int\\<1, max\\>\\|string given\\.$#" count: 1 @@ -1905,11 +1890,6 @@ parameters: count: 1 path: Export/ArticleExport.php - - - message: "#^Method Sulu\\\\Bundle\\\\ArticleBundle\\\\Export\\\\ArticleExport\\:\\:__construct\\(\\) has parameter \\$formatFilePaths with no value type specified in iterable type array\\.$#" - count: 1 - path: Export/ArticleExport.php - - message: "#^Method Sulu\\\\Bundle\\\\ArticleBundle\\\\Export\\\\ArticleExport\\:\\:getDocuments\\(\\) should return Sulu\\\\Component\\\\DocumentManager\\\\Collection\\\\QueryResultCollection but returns mixed\\.$#" count: 1 @@ -2035,11 +2015,21 @@ parameters: count: 1 path: Import/ImportResult.php + - + message: "#^Parameter \\#1 \\$articleIds of method Sulu\\\\Bundle\\\\ArticleBundle\\\\Infrastructure\\\\Sulu\\\\Headless\\\\DataProviderResolver\\\\AbstractArticleDataProviderResolver\\:\\:loadArticleStructures\\(\\) expects array\\, array\\, int\\|string\\> given\\.$#" + count: 1 + path: Infrastructure/Sulu/Headless/DataProviderResolver/AbstractArticleDataProviderResolver.php + - message: "#^Parameter \\#1 \\$filters of method Sulu\\\\Component\\\\SmartContent\\\\DataProviderInterface\\:\\:resolveResourceItems\\(\\) expects array\\{dataSource\\?\\: int\\|string\\|null, sortMethod\\?\\: 'asc'\\|'desc', sortBy\\?\\: string, tags\\?\\: array\\, tagOperator\\?\\: 'and'\\|'or', types\\?\\: array\\, categories\\?\\: array\\, categoryOperator\\?\\: 'and'\\|'or', \\.\\.\\.\\}, array given\\.$#" count: 1 path: Infrastructure/Sulu/Headless/DataProviderResolver/AbstractArticleDataProviderResolver.php + - + message: "#^Parameter \\#1 \\$articleIds of method Sulu\\\\Bundle\\\\ArticleBundle\\\\Infrastructure\\\\SuluHeadlessBundle\\\\DataProviderResolver\\\\AbstractArticleDataProviderResolver\\:\\:loadArticleStructures\\(\\) expects array\\, array\\, int\\|string\\> given\\.$#" + count: 1 + path: Infrastructure/SuluHeadlessBundle/DataProviderResolver/AbstractArticleDataProviderResolver.php + - message: "#^Parameter \\#1 \\$filters of method Sulu\\\\Component\\\\SmartContent\\\\DataProviderInterface\\:\\:resolveResourceItems\\(\\) expects array\\{dataSource\\?\\: int\\|string\\|null, sortMethod\\?\\: 'asc'\\|'desc', sortBy\\?\\: string, tags\\?\\: array\\, tagOperator\\?\\: 'and'\\|'or', types\\?\\: array\\, categories\\?\\: array\\, categoryOperator\\?\\: 'and'\\|'or', \\.\\.\\.\\}, array given\\.$#" count: 1