Skip to content

Commit e0bdc36

Browse files
authored
Improve performance of DataObject magic calls and addData
Add comment to not obvious switch condition
1 parent 91e1cf1 commit e0bdc36

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/internal/Magento/Framework/DataObject.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,8 @@ public function toString($format = '')
387387
*/
388388
public function __call($method, $args)
389389
{
390-
switch ($method[0].($method[1] ?? '').($method[2] ?? '')) {
390+
// Compare 3 first letters of the method name
391+
switch ($method[0] . ($method[1] ?? '') . ($method[2] ?? '')) {
391392
case 'get':
392393
if (isset($args[0]) && $args[0] !== null) {
393394
return $this->getData(

0 commit comments

Comments
 (0)