original_string: public static function castObject($obj, $class, $hasDebugInfo = false)
      {
          if ($hasDebugInfo) {
              $a = $obj->__debugInfo();
          } elseif ($obj instanceof \Closure) {
              $a = [];
          } else {
              $a = (array) $obj;
          }
          if ($obj instanceof \__PHP_Incomplete_Class) {
              return $a;
          }
  
          if ($a) {
              static $publicProperties = [];
  
              $i = 0;
              $prefixedKeys = [];
              foreach ($a as $k => $v) {
                  if (isset($k[0]) ? "\0" !== $k[0] : \PHP_VERSION_ID >= 70200) {
                      if (!isset($publicProperties[$class])) {
                          foreach (get_class_vars($class) as $prop => $v) {
                              $publicProperties[$class][$prop] = true;
                          }
                      }
                      if (!isset($publicProperties[$class][$k])) {
                          $prefixedKeys[$i] = self::PREFIX_DYNAMIC.$k;
                      }
                  } elseif (isset($k[16]) && "\0" === $k[16] && 0 === strpos($k, "\0class@anonymous\0")) {
                      $prefixedKeys[$i] = "\0".get_parent_class($class).'@anonymous'.strrchr($k, "\0");
                  }
                  ++$i;
              }
              if ($prefixedKeys) {
                  $keys = array_keys($a);
                  foreach ($prefixedKeys as $i => $k) {
                      $keys[$i] = $k;
                  }
                  $a = array_combine($keys, $a);
              }
          }
  
          return $a;
      }
code: public static function castObject($obj, $class, $hasDebugInfo = false)
      {
          if ($hasDebugInfo) {
              $a = $obj->__debugInfo();
          } elseif ($obj instanceof \Closure) {
              $a = [];
          } else {
              $a = (array) $obj;
          }
          if ($obj instanceof \__PHP_Incomplete_Class) {
              return $a;
          }
  
          if ($a) {
              static $publicProperties = [];
  
              $i = 0;
              $prefixedKeys = [];
              foreach ($a as $k => $v) {
                  if (isset($k[0]) ? "\0" !== $k[0] : \PHP_VERSION_ID >= 70200) {
                      if (!isset($publicProperties[$class])) {
                          foreach (get_class_vars($class) as $prop => $v) {
                              $publicProperties[$class][$prop] = true;
                          }
                      }
                      if (!isset($publicProperties[$class][$k])) {
                          $prefixedKeys[$i] = self::PREFIX_DYNAMIC.$k;
                      }
                  } elseif (isset($k[16]) && "\0" === $k[16] && 0 === strpos($k, "\0class@anonymous\0")) {
                      $prefixedKeys[$i] = "\0".get_parent_class($class).'@anonymous'.strrchr($k, "\0");
                  }
                  ++$i;
              }
              if ($prefixedKeys) {
                  $keys = array_keys($a);
                  foreach ($prefixedKeys as $i => $k) {
                      $keys[$i] = $k;
                  }
                  $a = array_combine($keys, $a);
              }
          }
  
          return $a;
      }
code_tokens: public static function castObject ( $ obj , $ class , $ hasDebugInfo = false ) { if ( $ hasDebugInfo ) { $ a = $ obj -> __debugInfo ( ) ; } elseif ( $ obj instanceof \ Closure ) { $ a = [ ] ; } else { $ a = ( array ) $ obj ; } if ( $ obj instanceof \ __PHP_Incomplete_Class ) { return $ a ; } if ( $ a ) { static $ publicProperties = [ ] ; $ i = 0 ; $ prefixedKeys = [ ] ; foreach ( $ a as $ k => $ v ) { if ( isset ( $ k [ 0 ] ) ? "\0" !== $ k [ 0 ] : \ PHP_VERSION_ID >= 70200 ) { if ( ! isset ( $ publicProperties [ $ class ] ) ) { foreach ( get_class_vars ( $ class ) as $ prop => $ v ) { $ publicProperties [ $ class ] [ $ prop ] = true ; } } if ( ! isset ( $ publicProperties [ $ class ] [ $ k ] ) ) { $ prefixedKeys [ $ i ] = self :: PREFIX_DYNAMIC . $ k ; } } elseif ( isset ( $ k [ 16 ] ) && "\0" === $ k [ 16 ] && 0 === strpos ( $ k , "\0class@anonymous\0" ) ) { $ prefixedKeys [ $ i ] = "\0" . get_parent_class ( $ class ) . '@anonymous' . strrchr ( $ k , "\0" ) ; } ++ $ i ; } if ( $ prefixedKeys ) { $ keys = array_keys ( $ a ) ; foreach ( $ prefixedKeys as $ i => $ k ) { $ keys [ $ i ] = $ k ; } $ a = array_combine ( $ keys , $ a ) ; } } return $ a ; }
docstring: Casts objects to arrays and adds the dynamic property prefix.
  
  @param object $obj          The object to cast
  @param string $class        The class of the object
  @param bool   $hasDebugInfo Whether the __debugInfo method exists on $obj or not
  
  @return array The array-cast of the object, with prefixed dynamic properties
docstring_tokens: Casts objects to arrays and adds the dynamic property prefix .