Merge pull request #22 from Setono/serializer #203
Annotations
10 warnings
Run infection:
src/Generator/ValueBasedFingerprintGenerator.php#L16
Escaped Mutant for Mutator "MethodCallRemoval":
--- Original
+++ New
@@ @@
private readonly string $hashAlgorithm;
public function __construct(string $hashAlgorithm = 'md5')
{
- Assert::oneOf($hashAlgorithm, hash_algos());
+
$this->hashAlgorithm = $hashAlgorithm;
}
public function generate(TagInterface $tag, string $renderedValue) : string
|
Run infection:
src/Renderer/AttributesAwareRendererTrait.php#L11
Escaped Mutant for Mutator "PublicVisibility":
--- Original
+++ New
@@ @@
use Setono\TagBag\Tag\AttributesAwareInterface;
trait AttributesAwareRendererTrait
{
- public function renderAttributes(AttributesAwareInterface $tag) : string
+ protected function renderAttributes(AttributesAwareInterface $tag) : string
{
$attributes = '';
foreach ($tag->getAttributes() as $attribute => $value) {
|
Run infection:
src/Renderer/CompositeRenderer.php#L17
Escaped Mutant for Mutator "Foreach_":
--- Original
+++ New
@@ @@
private array $renderers = [];
public function __construct(RendererInterface ...$renderers)
{
- foreach ($renderers as $renderer) {
+ foreach (array() as $renderer) {
$this->add($renderer);
}
}
|
Run infection:
src/Renderer/ContentAwareRenderer.php#L23
Escaped Mutant for Mutator "MethodCallRemoval":
--- Original
+++ New
@@ @@
}
public function render(TagInterface $tag) : string
{
- Assert::true($this->supports($tag));
+
return $tag->getContent();
}
}
|
Run infection:
src/Renderer/ElementRenderer.php#L28
Escaped Mutant for Mutator "MethodCallRemoval":
--- Original
+++ New
@@ @@
*/
public function render(TagInterface $tag) : string
{
- Assert::true($this->supports($tag));
+
if ($tag->hasClosingElement()) {
return sprintf('<%s%s>%s</%s>', $tag->getElement(), $this->renderAttributes($tag), $tag->getContent(), $tag->getElement());
}
|
Run infection:
src/Serializer/JsonSerializer.php#L29
Escaped Mutant for Mutator "MethodCallRemoval":
--- Original
+++ New
@@ @@
try {
/** @var mixed $data */
$data = json_decode(json: $data, associative: true, flags: \JSON_THROW_ON_ERROR);
- Assert::isArray($data);
+
$tags = [];
foreach ($data as $section => $sectionTags) {
Assert::string($section);
|
Run infection:
src/Serializer/JsonSerializer.php#L34
Escaped Mutant for Mutator "MethodCallRemoval":
--- Original
+++ New
@@ @@
Assert::isArray($data);
$tags = [];
foreach ($data as $section => $sectionTags) {
- Assert::string($section);
+
Assert::isArray($sectionTags);
/** @var mixed $tag */
foreach ($sectionTags as $tag) {
|
Run infection:
src/Serializer/JsonSerializer.php#L35
Escaped Mutant for Mutator "MethodCallRemoval":
--- Original
+++ New
@@ @@
$tags = [];
foreach ($data as $section => $sectionTags) {
Assert::string($section);
- Assert::isArray($sectionTags);
+
/** @var mixed $tag */
foreach ($sectionTags as $tag) {
Assert::isArray($tag);
|
Run infection:
src/Serializer/JsonSerializer.php#L39
Escaped Mutant for Mutator "MethodCallRemoval":
--- Original
+++ New
@@ @@
Assert::isArray($sectionTags);
/** @var mixed $tag */
foreach ($sectionTags as $tag) {
- Assert::isArray($tag);
+
$tags[$section][] = RenderedTag::createFromArray($tag);
}
}
|
Run infection:
src/Serializer/JsonSerializer.php#L45
Escaped Mutant for Mutator "ArrayOneItem":
--- Original
+++ New
@@ @@
$tags[$section][] = RenderedTag::createFromArray($tag);
}
}
- return $tags;
+ return count($tags) > 1 ? array_slice($tags, 0, 1, true) : $tags;
} catch (Throwable $e) {
throw new SerializationException(message: $e->getMessage(), previous: $e);
}
}
}
|
Loading