No Description

ReflectionCaster.php 1013B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\VarDumper\Caster;
  11. use Symfony\Component\VarDumper\Cloner\Stub;
  12. /**
  13. * Casts Reflector related classes to array representation.
  14. *
  15. * @author Nicolas Grekas <p@tchwork.com>
  16. */
  17. class ReflectionCaster
  18. {
  19. public static function castReflector(\Reflector $c, array $a, Stub $stub, $isNested)
  20. {
  21. $a["\0~\0reflection"] = $c->__toString();
  22. return $a;
  23. }
  24. public static function castClosure(\Closure $c, array $a, Stub $stub, $isNested)
  25. {
  26. $stub->class = 'Closure'; // HHVM generates unique class names for closures
  27. $a = static::castReflector(new \ReflectionFunction($c), $a, $stub, $isNested);
  28. unset($a["\0+\0000"], $a['name'], $a["\0+\0this"], $a["\0+\0parameter"]);
  29. return $a;
  30. }
  31. }