Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/Elements/AbstractElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,26 +90,26 @@
'dir' => 'auto',
];

public function __construct(?array $attributes = [], string $content = '', ?array $childNodes = [])

Check failure on line 93 in src/Elements/AbstractElement.php

View workflow job for this annotation

GitHub Actions / 3️⃣ Static analysis checks (8.3, false)

Method MadeByDenis\PhpMjmlRenderer\Elements\AbstractElement::__construct() has parameter $childNodes with no value type specified in iterable type array.

Check failure on line 93 in src/Elements/AbstractElement.php

View workflow job for this annotation

GitHub Actions / 3️⃣ Static analysis checks (8.3, false)

Method MadeByDenis\PhpMjmlRenderer\Elements\AbstractElement::__construct() has parameter $attributes with no value type specified in iterable type array.

Check failure on line 93 in src/Elements/AbstractElement.php

View workflow job for this annotation

GitHub Actions / 3️⃣ Static analysis checks (8.4, false)

Method MadeByDenis\PhpMjmlRenderer\Elements\AbstractElement::__construct() has parameter $childNodes with no value type specified in iterable type array.

Check failure on line 93 in src/Elements/AbstractElement.php

View workflow job for this annotation

GitHub Actions / 3️⃣ Static analysis checks (8.4, false)

Method MadeByDenis\PhpMjmlRenderer\Elements\AbstractElement::__construct() has parameter $attributes with no value type specified in iterable type array.
{
$this->attributes = $this->formatAttributes(

Check failure on line 95 in src/Elements/AbstractElement.php

View workflow job for this annotation

GitHub Actions / 3️⃣ Static analysis checks (8.3, false)

Property MadeByDenis\PhpMjmlRenderer\Elements\AbstractElement::$attributes (array<string, string>) does not accept array.

Check failure on line 95 in src/Elements/AbstractElement.php

View workflow job for this annotation

GitHub Actions / 3️⃣ Static analysis checks (8.4, false)

Property MadeByDenis\PhpMjmlRenderer\Elements\AbstractElement::$attributes (array<string, string>) does not accept array.
$this->defaultAttributes,
$this->allowedAttributes,
$attributes,
);

$this->content = $content;
$this->children = $childNodes;

Check failure on line 102 in src/Elements/AbstractElement.php

View workflow job for this annotation

GitHub Actions / 3️⃣ Static analysis checks (8.3, false)

Property MadeByDenis\PhpMjmlRenderer\Elements\AbstractElement::$children (array<int, MadeByDenis\PhpMjmlRenderer\Node>|null) does not accept array|null.

Check failure on line 102 in src/Elements/AbstractElement.php

View workflow job for this annotation

GitHub Actions / 3️⃣ Static analysis checks (8.4, false)

Property MadeByDenis\PhpMjmlRenderer\Elements\AbstractElement::$children (array<int, MadeByDenis\PhpMjmlRenderer\Node>|null) does not accept array|null.
}

public function isEndingTag(): bool
{
return static::ENDING_TAG;

Check failure on line 107 in src/Elements/AbstractElement.php

View workflow job for this annotation

GitHub Actions / 3️⃣ Static analysis checks (8.3, false)

Method MadeByDenis\PhpMjmlRenderer\Elements\AbstractElement::isEndingTag() should return bool but returns mixed.

Check failure on line 107 in src/Elements/AbstractElement.php

View workflow job for this annotation

GitHub Actions / 3️⃣ Static analysis checks (8.4, false)

Method MadeByDenis\PhpMjmlRenderer\Elements\AbstractElement::isEndingTag() should return bool but returns mixed.
}

public function getTagName(): string
{
return static::TAG_NAME;

Check failure on line 112 in src/Elements/AbstractElement.php

View workflow job for this annotation

GitHub Actions / 3️⃣ Static analysis checks (8.3, false)

Method MadeByDenis\PhpMjmlRenderer\Elements\AbstractElement::getTagName() should return string but returns mixed.

Check failure on line 112 in src/Elements/AbstractElement.php

View workflow job for this annotation

GitHub Actions / 3️⃣ Static analysis checks (8.4, false)

Method MadeByDenis\PhpMjmlRenderer\Elements\AbstractElement::getTagName() should return string but returns mixed.
}

public function isRawElement(): bool
Expand Down Expand Up @@ -147,6 +147,9 @@
return $this->allowedAttributes[$attributeName][$attributeProperty];
}

/**
* @return array<string, mixed>
*/
public function getChildContext(): array
{
return $this->context;
Expand All @@ -171,14 +174,14 @@
return $this->globalAttributes;
}

public function setGlobalAttributes($attribute, $value): void
public function setGlobalAttributes(string $attribute, mixed $value): void
{
$this->globalAttributes[$attribute] = $value;
}

// To-do: Override the globally set attributes if we override some from the CLI or some options.

protected function getChildren(): ?array

Check failure on line 184 in src/Elements/AbstractElement.php

View workflow job for this annotation

GitHub Actions / 3️⃣ Static analysis checks (8.3, false)

Method MadeByDenis\PhpMjmlRenderer\Elements\AbstractElement::getChildren() return type has no value type specified in iterable type array.

Check failure on line 184 in src/Elements/AbstractElement.php

View workflow job for this annotation

GitHub Actions / 3️⃣ Static analysis checks (8.4, false)

Method MadeByDenis\PhpMjmlRenderer\Elements\AbstractElement::getChildren() return type has no value type specified in iterable type array.
{
return $this->children;
}
Expand Down Expand Up @@ -228,9 +231,9 @@
return trim($attrOut);
}

abstract public function getStyles(): array;

Check failure on line 234 in src/Elements/AbstractElement.php

View workflow job for this annotation

GitHub Actions / 3️⃣ Static analysis checks (8.3, false)

Method MadeByDenis\PhpMjmlRenderer\Elements\AbstractElement::getStyles() return type has no value type specified in iterable type array.

Check failure on line 234 in src/Elements/AbstractElement.php

View workflow job for this annotation

GitHub Actions / 3️⃣ Static analysis checks (8.4, false)

Method MadeByDenis\PhpMjmlRenderer\Elements\AbstractElement::getStyles() return type has no value type specified in iterable type array.

protected function styles($styles): string

Check failure on line 236 in src/Elements/AbstractElement.php

View workflow job for this annotation

GitHub Actions / 3️⃣ Static analysis checks (8.3, false)

Method MadeByDenis\PhpMjmlRenderer\Elements\AbstractElement::styles() has parameter $styles with no type specified.

Check failure on line 236 in src/Elements/AbstractElement.php

View workflow job for this annotation

GitHub Actions / 3️⃣ Static analysis checks (8.4, false)

Method MadeByDenis\PhpMjmlRenderer\Elements\AbstractElement::styles() has parameter $styles with no type specified.
{
$stylesArray = [];

Expand All @@ -244,7 +247,7 @@

$styles = '';

array_walk($stylesArray, function ($val, $key) use (&$styles) {

Check failure on line 250 in src/Elements/AbstractElement.php

View workflow job for this annotation

GitHub Actions / 3️⃣ Static analysis checks (8.3, false)

Parameter #1 $array of function array_walk expects array|object, mixed given.

Check failure on line 250 in src/Elements/AbstractElement.php

View workflow job for this annotation

GitHub Actions / 3️⃣ Static analysis checks (8.4, false)

Parameter #1 $array of function array_walk expects array|object, mixed given.
if (!empty($val)) {
if (is_array($val)) {
$val = implode(' ', $val);
Expand Down
1 change: 1 addition & 0 deletions src/ParserFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ final class ParserFactory
*/
public static function create(): Parser
{
/** @var Parser|null $instance */
static $instance = null;

if ($instance === null) {
Expand Down
2 changes: 1 addition & 1 deletion src/Validation/TypeValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public function isTextTransform(string $transform): bool
return isset($this->allowedTextTransform[$transform]);
}

public function getValidator(string $validatorType)
public function getValidator(string $validatorType): Validatable
{
$validatorClassName = __NAMESPACE__ . '\\Validators\\' . ucwords($validatorType) . 'Validator';

Expand Down
Loading