Fix setting value for an attribute when AR class has get method for t… #777
Annotations
4 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/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#L83
Escaped Mutant for Mutator "ConcatOperandRemoval":
--- Original
+++ New
@@ @@
if (method_exists($this, 'set' . ucfirst($name))) {
throw new InvalidCallException('Getting write-only property: ' . static::class . '::' . $name);
}
- throw new UnknownPropertyException('Getting unknown property: ' . static::class . '::' . $name);
+ throw new UnknownPropertyException(static::class . '::' . $name);
}
/**
* Returns the relation object with the specified name.
|
PHP 8-ubuntu-latest:
src/BaseActiveRecordTrait.php#L300
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;
|