comparison vendor/symfony/var-dumper/Caster/Caster.php @ 12:7a779792577d

Update Drupal core to v8.4.5 (via Composer)
author Chris Cannam
date Fri, 23 Feb 2018 15:52:07 +0000
parents 4c8ae668cc8c
children 129ea1e6d783
comparison
equal deleted inserted replaced
11:bfffd8d7479a 12:7a779792577d
47 * @return array The array-cast of the object, with prefixed dynamic properties 47 * @return array The array-cast of the object, with prefixed dynamic properties
48 */ 48 */
49 public static function castObject($obj, $class, $hasDebugInfo = false) 49 public static function castObject($obj, $class, $hasDebugInfo = false)
50 { 50 {
51 if ($class instanceof \ReflectionClass) { 51 if ($class instanceof \ReflectionClass) {
52 @trigger_error(sprintf('Passing a ReflectionClass to %s() is deprecated since version 3.3 and will be unsupported in 4.0. Pass the class name as string instead.', __METHOD__), E_USER_DEPRECATED); 52 @trigger_error(sprintf('Passing a ReflectionClass to %s() is deprecated since Symfony 3.3 and will be unsupported in 4.0. Pass the class name as string instead.', __METHOD__), E_USER_DEPRECATED);
53 $hasDebugInfo = $class->hasMethod('__debugInfo'); 53 $hasDebugInfo = $class->hasMethod('__debugInfo');
54 $class = $class->name; 54 $class = $class->name;
55 } 55 }
56 if ($hasDebugInfo) { 56 if ($hasDebugInfo) {
57 $a = $obj->__debugInfo(); 57 $a = $obj->__debugInfo();
116 foreach ($a as $k => $v) { 116 foreach ($a as $k => $v) {
117 $type = self::EXCLUDE_STRICT & $filter; 117 $type = self::EXCLUDE_STRICT & $filter;
118 118
119 if (null === $v) { 119 if (null === $v) {
120 $type |= self::EXCLUDE_NULL & $filter; 120 $type |= self::EXCLUDE_NULL & $filter;
121 } 121 $type |= self::EXCLUDE_EMPTY & $filter;
122 if (empty($v)) { 122 } elseif (false === $v || '' === $v || '0' === $v || 0 === $v || 0.0 === $v || array() === $v) {
123 $type |= self::EXCLUDE_EMPTY & $filter; 123 $type |= self::EXCLUDE_EMPTY & $filter;
124 } 124 }
125 if ((self::EXCLUDE_NOT_IMPORTANT & $filter) && !in_array($k, $listedProperties, true)) { 125 if ((self::EXCLUDE_NOT_IMPORTANT & $filter) && !in_array($k, $listedProperties, true)) {
126 $type |= self::EXCLUDE_NOT_IMPORTANT; 126 $type |= self::EXCLUDE_NOT_IMPORTANT;
127 } 127 }