Skip to content

Refactor BaseActiveRecord::getDirtyAttributes() #843

Refactor BaseActiveRecord::getDirtyAttributes()

Refactor BaseActiveRecord::getDirtyAttributes() #843

Triggered via pull request December 30, 2023 07:49
Status Success
Total duration 20m 1s
Artifacts

mutation.yml

on: pull_request
Matrix: mutation
Fit to window
Zoom out
Zoom in

Annotations

9 warnings
PHP 8-ubuntu-latest: src/ActiveRelationTrait.php#L253
Escaped Mutant for Mutator "MethodCallRemoval": --- Original +++ New @@ @@ if ($this->via instanceof self) { $viaQuery = $this->via; $viaModels = $viaQuery->findJunctionRows($primaryModels); - $this->filterByModels($viaModels); + } elseif (is_array($this->via)) { [$viaName, $viaQuery] = $this->via; if ($viaQuery->asArray === null) {
PHP 8-ubuntu-latest: src/ActiveRelationTrait.php#L387
Escaped Mutant for Mutator "InstanceOf_": --- Original +++ New @@ @@ if ($model instanceof ActiveRecordInterface) { foreach ($models as $model) { $key = $this->getModelKey($model, $relation->getLink()); - if ($model instanceof ActiveRecordInterface) { + if (true) { $model->populateRelation($name, $buckets[$key] ?? []); } }
PHP 8-ubuntu-latest: src/BaseActiveRecordTrait.php#L159
Escaped Mutant for Mutator "Catch_": --- Original +++ New @@ @@ { try { return $this->__get($name) !== null; - } catch (InvalidCallException|UnknownPropertyException) { + } catch (UnknownPropertyException) { return false; } }
PHP 8-ubuntu-latest: src/BaseActiveRecordTrait.php#L319
Escaped Mutant for Mutator "TrueValue": --- Original +++ New @@ @@ return false; } } - public function canSetProperty(string $name, bool $checkVars = true) : bool + public function canSetProperty(string $name, bool $checkVars = false) : bool { if (method_exists($this, 'set' . ucfirst($name)) || $checkVars && property_exists($this, $name)) { return true;
PHP 8-ubuntu-latest: src/BaseActiveRecordTrait.php#L321
Escaped Mutant for Mutator "UnwrapUcFirst": --- Original +++ New @@ @@ } public function canSetProperty(string $name, bool $checkVars = true) : bool { - if (method_exists($this, 'set' . ucfirst($name)) || $checkVars && property_exists($this, $name)) { + if (method_exists($this, 'set' . $name) || $checkVars && property_exists($this, $name)) { return true; } try {
PHP 8-ubuntu-latest: src/BaseActiveRecordTrait.php#L321
Escaped Mutant for Mutator "Concat": --- Original +++ New @@ @@ } public function canSetProperty(string $name, bool $checkVars = true) : bool { - if (method_exists($this, 'set' . ucfirst($name)) || $checkVars && property_exists($this, $name)) { + if (method_exists($this, ucfirst($name) . 'set') || $checkVars && property_exists($this, $name)) { return true; } try {
PHP 8-ubuntu-latest: src/BaseActiveRecordTrait.php#L321
Escaped Mutant for Mutator "ConcatOperandRemoval": --- Original +++ New @@ @@ } public function canSetProperty(string $name, bool $checkVars = true) : bool { - if (method_exists($this, 'set' . ucfirst($name)) || $checkVars && property_exists($this, $name)) { + if (method_exists($this, ucfirst($name)) || $checkVars && property_exists($this, $name)) { return true; } try {
PHP 8-ubuntu-latest: src/BaseActiveRecordTrait.php#L321
Escaped Mutant for Mutator "ConcatOperandRemoval": --- Original +++ New @@ @@ } public function canSetProperty(string $name, bool $checkVars = true) : bool { - if (method_exists($this, 'set' . ucfirst($name)) || $checkVars && property_exists($this, $name)) { + if (method_exists($this, 'set') || $checkVars && property_exists($this, $name)) { return true; } try {
PHP 8-ubuntu-latest: src/BaseActiveRecordTrait.php#L321
Escaped Mutant for Mutator "LogicalOr": --- Original +++ New @@ @@ } public function canSetProperty(string $name, bool $checkVars = true) : bool { - if (method_exists($this, 'set' . ucfirst($name)) || $checkVars && property_exists($this, $name)) { + if (method_exists($this, 'set' . ucfirst($name)) && ($checkVars && property_exists($this, $name))) { return true; } try {