Skip to content

Commit

Permalink
Fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
Prokyonn committed Sep 25, 2024
1 parent bf5cfd7 commit 8897da3
Show file tree
Hide file tree
Showing 79 changed files with 132 additions and 129 deletions.
23 changes: 13 additions & 10 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,33 @@

$config = new PhpCsFixer\Config();
$config->setRiskyAllowed(true)
->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect())
->setRules([
'@Symfony' => true,
'@Symfony:risky' => true,
'array_syntax' => ['syntax' => 'short'],
'class_definition' => false,
'concat_space' => ['spacing' => 'one'],
'declare_strict_types' => true,
'function_declaration' => ['closure_function_spacing' => 'none'],
'header_comment' => ['header' => $header],
'native_constant_invocation' => true,
'native_function_casing' => true,
'native_function_invocation' => ['include' => ['@internal']],
'global_namespace_import' => ['import_classes' => false, 'import_constants' => false, 'import_functions' => false],
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true, 'remove_inheritdoc' => true],
'no_useless_else' => true,
'no_useless_return' => true,
'php_unit_strict' => true,
'ordered_imports' => true,
'phpdoc_align' => ['align' => 'left'],
'phpdoc_order' => true,
'phpdoc_to_comment' => false,
'phpdoc_types_order' => false,
'single_line_throw' => false,
'strict_comparison' => true,
'strict_param' => true,
'get_class_to_class_keyword' => false, // should be enabled as soon as support for php < 8 is dropped
'single_line_comment_spacing' => false,
'phpdoc_to_comment' => [
'ignored_tags' => ['todo', 'var'],
],
'get_class_to_class_keyword' => true,
'nullable_type_declaration_for_default_null_value' => true,
'no_null_property_initialization' => false,
'fully_qualified_strict_types' => false,
'new_with_parentheses' => true,
'trailing_comma_in_multiline' => ['after_heredoc' => true, 'elements' => ['array_destructuring', 'arrays', 'match']],
])
->setFinder(
PhpCsFixer\Finder::create()
Expand Down
8 changes: 4 additions & 4 deletions Content/Application/ContentCopier/ContentCopier.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function __construct(
ContentResolverInterface $contentResolver,
ContentMergerInterface $contentMerger,
ContentPersisterInterface $contentPersister,
ContentNormalizerInterface $contentNormalizer
ContentNormalizerInterface $contentNormalizer,
) {
$this->contentResolver = $contentResolver;
$this->contentMerger = $contentMerger;
Expand All @@ -60,7 +60,7 @@ public function copy(
array $sourceDimensionAttributes,
ContentRichEntityInterface $targetContentRichEntity,
array $targetDimensionAttributes,
array $options = []
array $options = [],
): DimensionContentInterface {
$sourceDimensionContent = $this->contentResolver->resolve($sourceContentRichEntity, $sourceDimensionAttributes);

Expand All @@ -71,7 +71,7 @@ public function copyFromDimensionContentCollection(
DimensionContentCollectionInterface $dimensionContentCollection,
ContentRichEntityInterface $targetContentRichEntity,
array $targetDimensionAttributes,
array $options = []
array $options = [],
): DimensionContentInterface {
$sourceDimensionContent = $this->contentMerger->merge($dimensionContentCollection);

Expand All @@ -82,7 +82,7 @@ public function copyFromDimensionContent(
DimensionContentInterface $dimensionContent,
ContentRichEntityInterface $targetContentRichEntity,
array $targetDimensionAttributes,
array $options = []
array $options = [],
): DimensionContentInterface {
$data = \array_replace($this->contentNormalizer->normalize($dimensionContent), $options['data'] ?? []);

Expand Down
6 changes: 3 additions & 3 deletions Content/Application/ContentCopier/ContentCopierInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function copy(
array $sourceDimensionAttributes,
ContentRichEntityInterface $targetContentRichEntity,
array $targetDimensionAttributes,
array $options = []
array $options = [],
): DimensionContentInterface;

/**
Expand All @@ -52,7 +52,7 @@ public function copyFromDimensionContentCollection(
DimensionContentCollectionInterface $dimensionContentCollection,
ContentRichEntityInterface $targetContentRichEntity,
array $targetDimensionAttributes,
array $options = []
array $options = [],
): DimensionContentInterface;

/**
Expand All @@ -69,6 +69,6 @@ public function copyFromDimensionContent(
DimensionContentInterface $dimensionContent,
ContentRichEntityInterface $targetContentRichEntity,
array $targetDimensionAttributes,
array $options = []
array $options = [],
): DimensionContentInterface;
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function __construct(iterable $dataMappers)
public function map(
DimensionContentCollectionInterface $dimensionContentCollection,
array $dimensionAttributes,
array $data
array $data,
): void {
$localizedDimensionAttributes = $dimensionAttributes;
$unlocalizedDimensionAttributes = $dimensionAttributes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ interface ContentDataMapperInterface
public function map(
DimensionContentCollectionInterface $dimensionContentCollection,
array $dimensionAttributes,
array $data
array $data,
): void;
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function __construct(ContactFactoryInterface $contactFactory)
public function map(
DimensionContentInterface $unlocalizedDimensionContent,
DimensionContentInterface $localizedDimensionContent,
array $data
array $data,
): void {
if (!$localizedDimensionContent instanceof AuthorInterface) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ interface DataMapperInterface
public function map(
DimensionContentInterface $unlocalizedDimensionContent,
DimensionContentInterface $localizedDimensionContent,
array $data
array $data,
): void;
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function __construct(TagFactoryInterface $tagFactory, CategoryFactoryInte
public function map(
DimensionContentInterface $unlocalizedDimensionContent,
DimensionContentInterface $localizedDimensionContent,
array $data
array $data,
): void {
if (!$localizedDimensionContent instanceof ExcerptInterface) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function __construct(
RouteGeneratorInterface $routeGenerator,
RouteManagerInterface $routeManager,
ConflictResolverInterface $conflictResolver,
array $routeMappings
array $routeMappings,
) {
$this->factory = $factory;
$this->routeGenerator = $routeGenerator;
Expand All @@ -71,7 +71,7 @@ public function __construct(
public function map(
DimensionContentInterface $unlocalizedDimensionContent,
DimensionContentInterface $localizedDimensionContent,
array $data
array $data,
): void {
if (!$localizedDimensionContent instanceof RoutableInterface) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class SeoDataMapper implements DataMapperInterface
public function map(
DimensionContentInterface $unlocalizedDimensionContent,
DimensionContentInterface $localizedDimensionContent,
array $data
array $data,
): void {
if (!$localizedDimensionContent instanceof SeoInterface) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ShadowDataMapper implements DataMapperInterface
public function map(
DimensionContentInterface $unlocalizedDimensionContent,
DimensionContentInterface $localizedDimensionContent,
array $data
array $data,
): void {
if (!$unlocalizedDimensionContent instanceof ShadowInterface
|| !$localizedDimensionContent instanceof ShadowInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function __construct(StructureMetadataFactoryInterface $factory, array $s
public function map(
DimensionContentInterface $unlocalizedDimensionContent,
DimensionContentInterface $localizedDimensionContent,
array $data
array $data,
): void {
if (!$localizedDimensionContent instanceof TemplateInterface
|| !$unlocalizedDimensionContent instanceof TemplateInterface
Expand Down Expand Up @@ -96,7 +96,7 @@ private function getTemplateData(
string $type,
string $template,
array $unlocalizedData,
array $localizedData
array $localizedData,
): array {
$metadata = $this->factory->getStructureMetadata($type, $template);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function __construct(WebspaceManagerInterface $webspaceManager)
public function map(
DimensionContentInterface $unlocalizedDimensionContent,
DimensionContentInterface $localizedDimensionContent,
array $data
array $data,
): void {
if (!$localizedDimensionContent instanceof WebspaceInterface) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class WorkflowDataMapper implements DataMapperInterface
public function map(
DimensionContentInterface $unlocalizedDimensionContent,
DimensionContentInterface $localizedDimensionContent,
array $data
array $data,
): void {
if (!$localizedDimensionContent instanceof WorkflowInterface) {
return;
Expand Down
2 changes: 1 addition & 1 deletion Content/Application/ContentIndexer/ContentIndexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function deindexDimensionContent(DimensionContentInterface $dimensionCont
*/
private function loadDimensionContent(
ContentRichEntityInterface $contentRichEntity,
array $dimensionAttributes
array $dimensionAttributes,
): DimensionContentInterface {
$locale = $dimensionAttributes['locale'] ?? null;
$stage = $dimensionAttributes['stage'] ?? null;
Expand Down
6 changes: 3 additions & 3 deletions Content/Application/ContentManager/ContentManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function __construct(
ContentNormalizerInterface $contentNormalizer,
ContentCopierInterface $contentCopier,
ContentWorkflowInterface $contentWorkflow,
ContentIndexerInterface $contentIndexer
ContentIndexerInterface $contentIndexer,
) {
$this->contentResolver = $contentResolver;
$this->contentPersister = $contentPersister;
Expand Down Expand Up @@ -89,7 +89,7 @@ public function copy(
ContentRichEntityInterface $sourceContentRichEntity,
array $sourceDimensionAttributes,
ContentRichEntityInterface $targetContentRichEntity,
array $targetDimensionAttributes
array $targetDimensionAttributes,
): DimensionContentInterface {
return $this->contentCopier->copy(
$sourceContentRichEntity,
Expand All @@ -102,7 +102,7 @@ public function copy(
public function applyTransition(
ContentRichEntityInterface $contentRichEntity,
array $dimensionAttributes,
string $transitionName
string $transitionName,
): DimensionContentInterface {
return $this->contentWorkflow->apply($contentRichEntity, $dimensionAttributes, $transitionName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function copy(
ContentRichEntityInterface $sourceContentRichEntity,
array $sourceDimensionAttributes,
ContentRichEntityInterface $targetContentRichEntity,
array $targetDimensionAttributes
array $targetDimensionAttributes,
): DimensionContentInterface;

/**
Expand All @@ -76,7 +76,7 @@ public function copy(
public function applyTransition(
ContentRichEntityInterface $contentRichEntity,
array $dimensionAttributes,
string $transitionName
string $transitionName,
): DimensionContentInterface;

/**
Expand Down
2 changes: 1 addition & 1 deletion Content/Application/ContentMerger/ContentMerger.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class ContentMerger implements ContentMergerInterface
*/
public function __construct(
iterable $mergers,
PropertyAccessor $propertyAccessor
PropertyAccessor $propertyAccessor,
) {
$this->mergers = $mergers;
$this->propertyAccessor = $propertyAccessor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class ContentNormalizer implements ContentNormalizerInterface
*/
public function __construct(
iterable $normalizers,
?SymfonyNormalizerInterface $serializer = null
?SymfonyNormalizerInterface $serializer = null,
) {
$this->normalizers = $normalizers;
$this->serializer = $serializer ?: $this->createSerializer();
Expand Down
2 changes: 1 addition & 1 deletion Content/Application/ContentPersister/ContentPersister.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class ContentPersister implements ContentPersisterInterface

public function __construct(
DimensionContentCollectionFactoryInterface $dimensionContentCollectionFactory,
ContentMergerInterface $contentMerger
ContentMergerInterface $contentMerger,
) {
$this->dimensionContentCollectionFactory = $dimensionContentCollectionFactory;
$this->contentMerger = $contentMerger;
Expand Down
2 changes: 1 addition & 1 deletion Content/Application/ContentResolver/ContentResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ContentResolver implements ContentResolverInterface

public function __construct(
DimensionContentRepositoryInterface $dimensionContentRepository,
ContentMergerInterface $contentMerger
ContentMergerInterface $contentMerger,
) {
$this->dimensionContentRepository = $dimensionContentRepository;
$this->contentMerger = $contentMerger;
Expand Down
6 changes: 3 additions & 3 deletions Content/Application/ContentWorkflow/ContentWorkflow.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function __construct(
DimensionContentRepositoryInterface $dimensionContentRepository,
ContentMergerInterface $contentMerger,
?Registry $workflowRegistry = null,
?EventDispatcherInterface $eventDispatcher = null
?EventDispatcherInterface $eventDispatcher = null,
) {
$this->dimensionContentRepository = $dimensionContentRepository;
$this->contentMerger = $contentMerger;
Expand All @@ -75,7 +75,7 @@ public function __construct(
public function apply(
ContentRichEntityInterface $contentRichEntity,
array $dimensionAttributes,
string $transitionName
string $transitionName,
): DimensionContentInterface {
/*
* Transition should always be applied to the STAGE_DRAFT content-dimension of the given $dimensionAttributes.
Expand All @@ -94,7 +94,7 @@ public function apply(
}

if (!$localizedDimensionContent instanceof WorkflowInterface) {
throw new \RuntimeException(\sprintf('Expected "%s" but "%s" given.', WorkflowInterface::class, \get_class($localizedDimensionContent)));
throw new \RuntimeException(\sprintf('Expected "%s" but "%s" given.', WorkflowInterface::class, $localizedDimensionContent::class));
}

$workflow = $this->workflowRegistry->get(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ interface ContentWorkflowInterface
public function apply(
ContentRichEntityInterface $contentRichEntity,
array $dimensionAttributes,
string $transitionName
string $transitionName,
): DimensionContentInterface;
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class UnpublishTransitionSubscriber implements EventSubscriberInterface

public function __construct(
DimensionContentRepositoryInterface $dimensionContentRepository,
EntityManagerInterface $entityManager
EntityManagerInterface $entityManager,
) {
$this->dimensionContentRepository = $dimensionContentRepository;
$this->entityManager = $entityManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class DimensionContentCollectionFactory implements DimensionContentCollectionFac
public function __construct(
DimensionContentRepositoryInterface $dimensionContentRepository,
ContentDataMapperInterface $contentDataMapper,
PropertyAccessor $propertyAccessor
PropertyAccessor $propertyAccessor,
) {
$this->dimensionContentRepository = $dimensionContentRepository;
$this->contentDataMapper = $contentDataMapper;
Expand All @@ -53,7 +53,7 @@ public function __construct(
public function create(
ContentRichEntityInterface $contentRichEntity,
array $dimensionAttributes,
array $data
array $data,
): DimensionContentCollectionInterface {
$dimensionContentCollection = $this->dimensionContentRepository->load($contentRichEntity, $dimensionAttributes);
$dimensionAttributes = $dimensionContentCollection->getDimensionAttributes();
Expand Down Expand Up @@ -114,7 +114,7 @@ public function create(
*/
private function createContentDimension(
ContentRichEntityInterface $contentRichEntity,
array $attributes
array $attributes,
): DimensionContentInterface {
$dimensionContent = $contentRichEntity->createDimensionContent();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ interface DimensionContentCollectionFactoryInterface
public function create(
ContentRichEntityInterface $contentRichEntity,
array $dimensionAttributes,
array $data
array $data,
): DimensionContentCollectionInterface;
}
2 changes: 1 addition & 1 deletion Content/Domain/Model/DimensionContentCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class DimensionContentCollection implements \IteratorAggregate, DimensionContent
public function __construct(
array $dimensionContents,
array $dimensionAttributes,
string $dimensionContentClass
string $dimensionContentClass,
) {
$this->dimensionContentClass = $dimensionContentClass;
$this->defaultDimensionAttributes = $dimensionContentClass::getDefaultDimensionAttributes();
Expand Down
Loading

0 comments on commit 8897da3

Please sign in to comment.