Copied!

Extracts data using the reflection API.

CloneableInstantiable
Constants
public Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor::ALLOW_MAGIC_CALL = 4
 
  • var int Allow magic __call methods
public Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor::ALLOW_MAGIC_GET = 1
 
  • var int Allow magic __get methods
public Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor::ALLOW_MAGIC_SET = 2
 
  • var int Allow magic __set methods
public Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor::ALLOW_PRIVATE = 1
public Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor::ALLOW_PROTECTED = 2
public Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor::ALLOW_PUBLIC = 4
public Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor::DISALLOW_MAGIC_METHODS = 0
 
  • var int Allow none of the magic methods
Properties
public static array $defaultAccessorPrefixes = ['get', 'is', 'has', 'can']
 
  • internal
public static array $defaultArrayMutatorPrefixes = ['add', 'remove']
 
  • internal
public static array $defaultMutatorPrefixes = ['add', 'remove', 'set']
 
  • internal
Methods
public __construct(?array $mutatorPrefixes = NULL, ?array $accessorPrefixes = NULL, ?array $arrayMutatorPrefixes = NULL, bool $enableConstructorExtraction = true, int $accessFlags = 4self::ALLOW_PUBLIC, ?Symfony\Component\String\Inflector\InflectorInterface $inflector = NULL, int $magicMethodsFlags = 3)
 
  • param string[]|null $mutatorPrefixes
  • param string[]|null $accessorPrefixes
  • param string[]|null $arrayMutatorPrefixes
public getProperties(string $class, array $context = []) : ?array
public getReadInfo(string $class, string $property, array $context = []) : ?Symfony\Component\PropertyInfo\PropertyReadInfo
public getType(string $class, string $property, array $context = []) : ?Symfony\Component\TypeInfo\Type
public getTypeFromConstructor(string $class, string $property) : ?Symfony\Component\TypeInfo\Type
public getTypes(string $class, string $property, array $context = []) : ?array
 
  • deprecated since Symfony 7.3, use "getType" instead
public getTypesFromConstructor(string $class, string $property) : ?array
 
  • deprecated since Symfony 7.3, use "getTypeFromConstructor" instead
  • return \LegacyType[]|null
public getWriteInfo(string $class, string $property, array $context = []) : ?Symfony\Component\PropertyInfo\PropertyWriteInfo
public isInitializable(string $class, string $property, array $context = []) : ?bool
public isReadable(string $class, string $property, array $context = []) : ?bool
public isWritable(string $class, string $property, array $context = []) : ?bool
Constants
private Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor::MAP_TYPES = ['integer' => 'int', 'boolean' => 'bool', 'double' => 'float']
Properties
private array $accessorPrefixes
private array $arrayMutatorPrefixes
private array $arrayMutatorPrefixesFirst
private array $arrayMutatorPrefixesLast
private bool $enableConstructorExtraction
private Symfony\Component\String\Inflector\InflectorInterface $inflector
private int $magicMethodsFlags
private int $methodReflectionFlags
private array $mutatorPrefixes
private int $propertyReflectionFlags
private Symfony\Component\TypeInfo\TypeResolver\TypeResolverInterface $typeResolver
Methods
private camelize(string $string) : string
 

Camelizes a given string.

private extractFromAccessor(string $class, string $property) : ?array
 

Tries to extract type information from accessors.

  • return \LegacyType[]|null
private extractFromConstructor(string $class, string $property) : ?array
 

Tries to extract type information from constructor.

  • return \LegacyType[]|null
private extractFromMutator(string $class, string $property) : ?array
 
  • return \LegacyType[]|null
private extractFromPropertyDeclaration(string $class, string $property) : ?array
private extractFromReflectionType(ReflectionType $reflectionType, ReflectionClass $declaringClass) : array
private extractTypeFromConstructor(ReflectionClass $reflectionClass, string $property) : ?Symfony\Component\TypeInfo\Type
private findAdderAndRemover(ReflectionClass $reflClass, array $singulars) : array
 

Searches for add and remove methods.

  • param \ReflectionClass $reflClass The reflection class for the given object
  • param array $singulars The singular form of the property name or null
  • return array An array containing the adder and remover when found and errors
private getAccessorMethod(string $class, string $property) : ?array
 

Gets the accessor method.

Returns an array with an instance of \ReflectionMethod as the first key and the prefix of the method as the second, or null if not found.

private getMethodsFlags(int $accessFlags) : int
 

Return allowed reflection method flags.

private getMutatorMethod(string $class, string $property) : ?array
 

Returns an array with an instance of \ReflectionMethod as the first key and the prefix of the method as the second, or null if not found.

private getPropertyFlags(int $accessFlags) : int
 

Return allowed reflection property flags.

private getPropertyName(string $methodName, array $reflectionProperties) : ?string
private getReadVisibilityForMethod(ReflectionMethod $reflectionMethod) : string
private getReadVisibilityForProperty(ReflectionProperty $reflectionProperty) : string
private getReflectionParameterFromConstructor(string $property, ReflectionMethod $reflectionConstructor) : ?ReflectionParameter
private getWriteVisibilityForMethod(ReflectionMethod $reflectionMethod) : string
private getWriteVisibilityForProperty(ReflectionProperty $reflectionProperty) : string
private isAllowedProperty(string $class, string $property, bool $writeAccessRequired = false) : bool
private isMethodAccessible(ReflectionClass $class, string $methodName, int $parameters) : array
 

Returns whether a method is public and has the number of required parameters and errors.

private isNullableProperty(string $class, string $property) : bool
private resolveTypeName(string $name, ReflectionClass $declaringClass) : string
Properties
public static array $defaultAccessorPrefixes = ['get', 'is', 'has', 'can']
 
  • internal
public static array $defaultArrayMutatorPrefixes = ['add', 'remove']
 
  • internal
public static array $defaultMutatorPrefixes = ['add', 'remove', 'set']
 
  • internal
© 2025 Bruce Wells
Search Namespaces \ Classes
Configuration