Skip to content

Commit 2457a0e

Browse files
authored
Update new-deprecations.md for CMSObject (#50)
Update new-deprecations.md
1 parent 1f6ce8d commit 2457a0e

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

migrations/42-43/new-deprecations.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,3 +190,38 @@ Example:
190190
// Usally used in the module context which implements \Joomla\CMS\Helper\HelperFactoryAwareInterface
191191
$articles = $this->getHelperFactory()->getHelper('ArticlesNewsHelper')->getArticles($data['params'], $this->getApplication());
192192
```
193+
194+
#### CMSObject legacy traits
195+
196+
File: libraries/src/Object/CMSObject.php
197+
Replacement: The CMSObject should be replaced by stdclass or \Joomla\Registry\Registry
198+
Example:
199+
```php
200+
$data = new \stdClass();
201+
// Or
202+
$data = (object) ['foo' => 1, 'bar' => 2];
203+
```
204+
205+
File: libraries/src/Object/LegacyErrorHandlingTrait.php
206+
Replacement: The `setError` and `getError` functions should not be used anymore and an exception should be thrown.
207+
Example:
208+
```php
209+
throw new \Exception(...);
210+
```
211+
212+
File: libraries/src/Object/LegacyPropertyManagementTrait.php
213+
Replacement: Dynamic properties should not be used anymore in regard to the deprecated [dynamic properties change in PHP 8.2](https://wiki.php.net/rfc/deprecate_dynamic_properties). Properties should be declared in the class and proper getter and setters be used.
214+
Example:
215+
```php
216+
class MyDataObject {
217+
private $foo;
218+
219+
public function getFoo() {
220+
return $foo;
221+
}
222+
223+
public function setFoo($foo) {
224+
$this->foo = $foo;
225+
}
226+
}
227+
```

0 commit comments

Comments
 (0)