Skip to content

Commit

Permalink
Fix composer lint command by adjusting phpdoc types (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasnatter authored Sep 17, 2020
1 parent 07da23b commit 0fcecd7
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function handle($workload)
return;
}

/** @var class-string $class */
/** @var class-string<ContentRichEntityInterface> $class */
$class = $workload['class'];
$repository = $this->entityManager->getRepository($class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function handle($workload)
return;
}

/** @var class-string $class */
/** @var class-string<ContentRichEntityInterface> $class */
$class = $workload['class'];
$repository = $this->entityManager->getRepository($class);

Expand Down
19 changes: 10 additions & 9 deletions Content/Infrastructure/Sulu/Sitemap/ContentSitemapProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use Doctrine\ORM\Query\Expr\Join;
use Doctrine\ORM\QueryBuilder;
use Sulu\Bundle\ContentBundle\Content\Application\ContentWorkflow\ContentWorkflowInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\ContentRichEntityInterface;
use Sulu\Bundle\ContentBundle\Content\Domain\Model\DimensionInterface;
use Sulu\Bundle\RouteBundle\Model\RouteInterface;
use Sulu\Bundle\WebsiteBundle\Sitemap\Sitemap;
Expand Down Expand Up @@ -52,12 +53,12 @@ class ContentSitemapProvider implements SitemapProviderInterface
protected $kernelEnvironment;

/**
* @var class-string
* @var class-string<ContentRichEntityInterface>
*/
protected $contentClass;
protected $contentRichEntityClass;

/**
* @var class-string
* @var class-string<RouteInterface>
*/
protected $routeClass;

Expand All @@ -68,21 +69,21 @@ class ContentSitemapProvider implements SitemapProviderInterface

/**
* @param string $kernelEnvironment Inject parameter "kernel.environment" here
* @param class-string $contentClass Classname that is used in the route table
* @param class-string $routeClass
* @param class-string<ContentRichEntityInterface> $contentRichEntityClass Classname that is used in the route table
* @param class-string<RouteInterface> $routeClass
*/
public function __construct(
EntityManagerInterface $entityManager,
WebspaceManagerInterface $webspaceManager,
string $kernelEnvironment,
string $contentClass,
string $contentRichEntityClass,
string $routeClass,
string $alias
) {
$this->entityManager = $entityManager;
$this->webspaceManager = $webspaceManager;
$this->kernelEnvironment = $kernelEnvironment;
$this->contentClass = $contentClass;
$this->contentRichEntityClass = $contentRichEntityClass;
$this->routeClass = $routeClass;
$this->alias = $alias;
}
Expand Down Expand Up @@ -206,7 +207,7 @@ protected function createRoutesQueryBuilder(): QueryBuilder
$queryBuilder = $this->entityManager->createQueryBuilder();

return $queryBuilder
->from($this->contentClass, self::CONTENT_RICH_ENTITY_ALIAS)
->from($this->contentRichEntityClass, self::CONTENT_RICH_ENTITY_ALIAS)
->innerJoin(self::CONTENT_RICH_ENTITY_ALIAS . '.dimensionContents', self::LOCALIZED_DIMENSION_CONTENT_ALIAS)
->innerJoin(self::LOCALIZED_DIMENSION_CONTENT_ALIAS . '.dimension', self::LOCALIZED_DIMENSION_ALIAS)
->innerJoin($this->routeClass, self::ROUTE_ALIAS, Join::WITH, self::ROUTE_ALIAS . '.entityId = ' . self::CONTENT_RICH_ENTITY_ALIAS . '.' . $this->getEntityIdField())
Expand All @@ -216,7 +217,7 @@ protected function createRoutesQueryBuilder(): QueryBuilder
->andWhere(self::ROUTE_ALIAS . '.locale = ' . self::LOCALIZED_DIMENSION_ALIAS . '.locale')
->setParameters([
'stage' => DimensionInterface::STAGE_LIVE,
'entityClass' => $this->contentClass,
'entityClass' => $this->contentRichEntityClass,
'history' => false,
]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ContentPublishTaskHandlerTest extends TestCase
private $entityManager;

/**
* @var ObjectRepository|ObjectProphecy
* @var ObjectRepository<ContentRichEntityInterface>|ObjectProphecy
*/
private $repository;

Expand All @@ -57,7 +57,7 @@ protected function setUp(): void
parent::setUp();

$this->entityManager = $this->prophesize(EntityManagerInterface::class);
$this->repository = $this->prophesize(ObjectRepository::class);
$this->repository = $this->prophesize(ObjectRepository::class); // @phpstan-ignore-line
$this->contentManager = $this->prophesize(ContentManagerInterface::class);
$this->translator = $this->prophesize(TranslatorInterface::class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ContentUnpublishTaskHandlerTest extends TestCase
private $entityManager;

/**
* @var ObjectRepository|ObjectProphecy
* @var ObjectRepository<ContentRichEntityInterface>|ObjectProphecy
*/
private $repository;

Expand All @@ -57,7 +57,7 @@ protected function setUp(): void
parent::setUp();

$this->entityManager = $this->prophesize(EntityManagerInterface::class);
$this->repository = $this->prophesize(ObjectRepository::class);
$this->repository = $this->prophesize(ObjectRepository::class); // @phpstan-ignore-line
$this->contentManager = $this->prophesize(ContentManagerInterface::class);
$this->translator = $this->prophesize(TranslatorInterface::class);

Expand Down

0 comments on commit 0fcecd7

Please sign in to comment.