Skip to content

Commit

Permalink
Honor return type for __set()
Browse files Browse the repository at this point in the history
  • Loading branch information
phansys committed Jun 19, 2023
1 parent 55e9499 commit 99075b6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ a release.
- Named arguments have precedence over the values passed in the `$data` array in annotation classes at `Gedmo\Mapping\Annotation\`
namespace
- Removed conflict against "doctrine/cache" < 1.11, as this library is not used
- Return type from `TranslationProxy::__set()` (from `TranslationProxy` to `void`)

### Fixed
- Tree: Creation of dynamic `Node::$sibling` property, which is deprecated as of PHP >= 8.2
- Return type from `TranslationProxy::__set()` in order to honor its original signature (`void`)

### Deprecated
- Tree: Not implementing `Node` interface in classes that are used as nodes
Expand Down
10 changes: 4 additions & 6 deletions src/Translator/TranslationProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,24 +123,22 @@ public function __get($property)
/**
* @param string $property
* @param mixed $value
*
* @return self
*/
public function __set($property, $value)
{
if (in_array($property, $this->properties, true)) {
if (method_exists($this, $setter = 'set'.ucfirst($property))) {
return $this->$setter($value);
$this->$setter($value);

return;
}

$this->setTranslatedValue($property, $value);

return $this;
return;
}

$this->translatable->$property = $value;

return $this;
}

/**
Expand Down

0 comments on commit 99075b6

Please sign in to comment.