Skip to content

Commit

Permalink
refactor: Cleanup phpstan baseline
Browse files Browse the repository at this point in the history
Also adjust the readme file.
  • Loading branch information
justusmoroni committed Mar 18, 2024
1 parent 2c5c524 commit 045bd4b
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 78 deletions.
4 changes: 2 additions & 2 deletions Classes/DataProcessing/ResponsiveImagesProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function process(
return $processedData;
}

$this->contentElementSizes = Rootline::make($processedData['data'])->getFinalSizes();
$this->contentElementSizes = (new Rootline($processedData['data']))->getFinalSizes();
$this->fetchContentElementFieldConfiguration();
$this->calculateFileDimensions();

Expand Down Expand Up @@ -175,7 +175,7 @@ private function getBreakpoints(): array

if (is_iterable($breakpointsByPath)) {
foreach ($breakpointsByPath as $breakpointIdentifier => $breakpointData) {
$breakpoints[$breakpointIdentifier] = Breakpoint::make($breakpointIdentifier, $breakpointData);
$breakpoints[$breakpointIdentifier] = new Breakpoint($breakpointIdentifier, $breakpointData);
}
}

Expand Down
11 changes: 3 additions & 8 deletions Classes/Sizes/BackendLayout.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ public function __construct(
$this->determineColumns();
}

public static function make(mixed ...$arguments): static
{
return new self(...$arguments);
}

public function getSizes(): array
{
return $this->sizes;
Expand All @@ -71,7 +66,7 @@ public function setActiveColumn(Column $column): void
$this->activeColumn = $column;
}

public function getActiveColumn(): ?Column
public function getActiveColumn(): Column
{
return $this->activeColumn;
}
Expand Down Expand Up @@ -100,8 +95,8 @@ private function determineColumns(): array
$breakpointsByPath = $this->configurationManager->getByPath($sizesPath);

if (is_iterable($breakpointsByPath)) {
foreach ($this->configurationManager->getByPath($sizesPath) as $columnIdentifier => $columnData) {
$this->columns[$columnIdentifier] = Column::make((string) $columnIdentifier, $columnData);
foreach ($breakpointsByPath as $columnIdentifier => $columnData) {
$this->columns[$columnIdentifier] = new Column((string) $columnIdentifier, $columnData);
}
}

Expand Down
5 changes: 0 additions & 5 deletions Classes/Sizes/BackendLayout/Column.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ public function __construct(
$this->multiplier = array_map(static fn ($multiplier): float => Multiplier::parse($multiplier), $data['multiplier']);
}

public static function make(mixed ...$arguments): self
{
return new self(...$arguments);
}

public function getIdentifier(): string
{
return $this->identifier;
Expand Down
5 changes: 0 additions & 5 deletions Classes/Sizes/Breakpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@ public function __construct(
) {
}

public static function make(mixed ...$arguments): static
{
return new self(...$arguments);
}

public function getIdentifier(): string
{
return $this->identifier;
Expand Down
2 changes: 1 addition & 1 deletion Classes/Sizes/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private function determineColumns(): void
$columnsByPath = $this->configurationManager->getByPath($sizesPath);
if (is_iterable($columnsByPath)) {
foreach ($columnsByPath as $columnIdentifier => $columnData) {
$this->columns[$columnIdentifier] = Column::make((string) $columnIdentifier, $columnData);
$this->columns[$columnIdentifier] = new Column((string) $columnIdentifier, $columnData);
}
}
}
Expand Down
5 changes: 0 additions & 5 deletions Classes/Sizes/ContentElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@ public function __construct(
$this->colPos = $data['colPos'];
}

public static function make(mixed ...$arguments): static
{
return new static(...$arguments);
}

public function getData(?string $dataIdentifier = null): mixed
{
if ($dataIdentifier === null) {
Expand Down
2 changes: 0 additions & 2 deletions Classes/Sizes/ContentElementInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ interface ContentElementInterface
{
public function __construct(array $data);

public static function make(mixed ...$arguments): static;

public function getData(?string $dataIdentifier = null): mixed;

public function getContentType(): string;
Expand Down
11 changes: 3 additions & 8 deletions Classes/Sizes/Rootline.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,6 @@ public function __construct(array $data)
$this->calculateSizes();
}

public static function make(mixed ...$arguments): static
{
return new self(...$arguments);
}

public function getFinalSizes(): array
{
return $this->finalSizes;
Expand Down Expand Up @@ -82,16 +77,16 @@ private function determineBackendLayout(): void
->getLayoutForPage($typoscriptFrontendController->page, $typoscriptFrontendController->rootLine)
;

$this->backendLayout = BackendLayout::make($backendLayoutIdentifier);
$this->backendLayout = new BackendLayout($backendLayoutIdentifier);
}

private function determineContentElement(array $data): ContentElementInterface
{
if (str_contains((string) $data['CType'], '_container-')) {
return Container::make($data);
return new Container($data);
}

return ContentElement::make($data);
return new ContentElement($data);
}

private function determineRootline(): void
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ In this development state the extension is only used in one project.
## Missing Features

The extension does not yet:
- contains tests.
- work out of the box without configuration.
- handles b13/containers as optional.
- support other grid/container frameworks.
- support content block grids.
- provide flexible enough configuration for more use cases.
- support EXT:fluid_styled_content.
39 changes: 0 additions & 39 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,41 +1,2 @@
parameters:
ignoreErrors:
-
message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#"
count: 1
path: Classes/Sizes/BackendLayout.php

-
message: "#^Cannot cast mixed to string\\.$#"
count: 1
path: Classes/Sizes/BackendLayout.php

-
message: "#^Parameter \\#1 \\$identifier of class Codappix\\\\ResponsiveImages\\\\Sizes\\\\BackendLayout constructor expects string, mixed given\\.$#"
count: 1
path: Classes/Sizes/BackendLayout.php

-
message: "#^Parameter \\#1 \\$identifier of class Codappix\\\\ResponsiveImages\\\\Sizes\\\\BackendLayout\\\\Column constructor expects string, mixed given\\.$#"
count: 1
path: Classes/Sizes/BackendLayout/Column.php

-
message: "#^Parameter \\#1 \\$identifier of class Codappix\\\\ResponsiveImages\\\\Sizes\\\\Breakpoint constructor expects string, mixed given\\.$#"
count: 1
path: Classes/Sizes/Breakpoint.php

-
message: "#^Parameter \\#1 \\$data of class Codappix\\\\ResponsiveImages\\\\Sizes\\\\ContentElement constructor expects array, mixed given\\.$#"
count: 1
path: Classes/Sizes/ContentElement.php

-
message: "#^Cannot call method getMultiplier\\(\\) on Codappix\\\\ResponsiveImages\\\\Sizes\\\\BackendLayout\\\\Column\\|null\\.$#"
count: 1
path: Classes/Sizes/Rootline.php

-
message: "#^Parameter \\#1 \\$data of class Codappix\\\\ResponsiveImages\\\\Sizes\\\\Rootline constructor expects array, mixed given\\.$#"
count: 1
path: Classes/Sizes/Rootline.php

0 comments on commit 045bd4b

Please sign in to comment.