public function testDebugInfoMethod() { $parsedRefProperty = new ReflectionProperty(self::STUB_CLASS, 'publicStaticProperty'); $originalRefProperty = new \ReflectionProperty(self::STUB_CLASS, 'publicStaticProperty'); $expectedValue = (array) $originalRefProperty; $this->assertSame($expectedValue, $parsedRefProperty->___debugInfo()); }
/** * Implementation of internal reflection initialization * * @return void */ protected function __initialize() { parent::__construct($this->className, $this->getName()); }
/** * Retrieves reflected properties. * * @param int $filter The optional filter, for filtering desired property types. * It's configured using the ReflectionProperty constants, and defaults to all property types. * * @return array|\Go\ParserReflection\ReflectionProperty[] */ public function getProperties($filter = null) { if (!isset($this->properties)) { $directProperties = ReflectionProperty::collectFromClassNode($this->classLikeNode, $this->getName()); $parentProperties = $this->recursiveCollect(function (array &$result, \ReflectionClass $instance, $isParent) { $reflectionProperties = []; foreach ($instance->getProperties() as $reflectionProperty) { if (!$isParent || !$reflectionProperty->isPrivate()) { $reflectionProperties[$reflectionProperty->name] = $reflectionProperty; } } $result += $reflectionProperties; }); $properties = $directProperties + $parentProperties; $this->properties = $properties; } // Without filter we can just return the full list if (!isset($filter)) { return array_values($this->properties); } $properties = []; foreach ($this->properties as $property) { if (!($filter & $property->getModifiers())) { continue; } $properties[] = $property; } return $properties; }