Skip to content

Commit 78fe7e7

Browse files
authored
Further changes to fix unit tests and keep things backwards compatible.
I'm really not happy with how Magento is using the magic __call method and I would propose to deprecated the behavior.
1 parent 3deeaa1 commit 78fe7e7

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

lib/internal/Magento/Framework/DataObject.php

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -389,23 +389,17 @@ public function __call($method, $args)
389389
{
390390
switch ($method[0].($method[1] ?? '').($method[2] ?? '')) {
391391
case 'get':
392-
if (isset($args[0]) && $args[0] !== null) {
393-
return $this->getData(
394-
self::$_underscoreCache[$method] ?? $this->_underscore($method),
395-
$args[0]
396-
);
397-
}
398-
399392
return $this->_data[
400393
self::$_underscoreCache[$method] ?? $this->_underscore($method)
401394
] ?? $this->getData(
402-
self::$_underscoreCache[$method] ?? $this->_underscore($method)
395+
self::$_underscoreCache[$method] ?? $this->_underscore($method),
396+
$args[0] ?? null
403397
);
404398
case 'set':
405-
$this->_data[
406-
self::$_underscoreCache[$method] ?? $this->_underscore($method)
407-
] = $args[0] ?? null;
408-
return $this;
399+
return $this->setData(
400+
self::$_underscoreCache[$method] ?? $this->_underscore($method),
401+
$args[0] ?? null
402+
);
409403
case 'uns':
410404
return $this->unsetData(
411405
self::$_underscoreCache[$method] ?? $this->_underscore($method)

0 commit comments

Comments
 (0)