Skip to content

Throw UnknownPropertyException when setting unknown property #782

Throw UnknownPropertyException when setting unknown property

Throw UnknownPropertyException when setting unknown property #782

Triggered via pull request December 13, 2023 09:05
Status Success
Total duration 22m 37s
Artifacts

mutation.yml

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

Annotations

7 warnings
PHP 8-ubuntu-latest: src/ActiveRelationTrait.php#L374
Escaped Mutant for Mutator "InstanceOf_": --- Original +++ New @@ @@ return; } $model = reset($models); - if ($model instanceof ActiveRecordInterface) { + if (false) { /** @var ActiveQuery $relation */ $relation = $model->getRelation($name); } else {
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#L79
Escaped Mutant for Mutator "UnwrapUcFirst": --- Original +++ New @@ @@ /** read property, e.g. getName() */ return $this->{$getter}(); } - if (method_exists($this, 'set' . ucfirst($name))) { + if (method_exists($this, 'set' . $name)) { throw new InvalidCallException('Getting write-only property: ' . static::class . '::' . $name); } throw new UnknownPropertyException('Getting unknown property: ' . static::class . '::' . $name);
PHP 8-ubuntu-latest: src/BaseActiveRecordTrait.php#L207
Escaped Mutant for Mutator "Concat": --- Original +++ New @@ @@ return; } if (method_exists($this, 'get' . ucfirst($name))) { - throw new InvalidCallException('Setting read-only property: ' . static::class . '::' . $name); + throw new InvalidCallException('Setting read-only property: ' . static::class . $name . '::'); } throw new UnknownPropertyException('Setting unknown property: ' . static::class . '::' . $name); }
PHP 8-ubuntu-latest: src/BaseActiveRecordTrait.php#L301
Escaped Mutant for Mutator "LogicalOr": --- Original +++ New @@ @@ */ public function hasProperty(string $name, bool $checkVars = true) : bool { - return $this->canGetProperty($name, $checkVars) || $this->canSetProperty($name, false); + return $this->canGetProperty($name, $checkVars) && $this->canSetProperty($name, false); } public function canGetProperty(string $name, bool $checkVars = true) : bool {
PHP 8-ubuntu-latest: src/BaseActiveRecordTrait.php#L305
Escaped Mutant for Mutator "TrueValue": --- Original +++ New @@ @@ { return $this->canGetProperty($name, $checkVars) || $this->canSetProperty($name, false); } - public function canGetProperty(string $name, bool $checkVars = true) : bool + public function canGetProperty(string $name, bool $checkVars = false) : bool { if (method_exists($this, 'get' . ucfirst($name)) || $checkVars && property_exists($this, $name)) { return true;
PHP 8-ubuntu-latest: src/BaseActiveRecordTrait.php#L307
Escaped Mutant for Mutator "UnwrapUcFirst": --- Original +++ New @@ @@ } public function canGetProperty(string $name, bool $checkVars = true) : bool { - if (method_exists($this, 'get' . ucfirst($name)) || $checkVars && property_exists($this, $name)) { + if (method_exists($this, 'get' . $name) || $checkVars && property_exists($this, $name)) { return true; } try {