Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[PropertyInfo] Add type-hints to public interfaces and classes #32233

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function __construct(DocBlockFactoryInterface $docBlockFactory = null, ar
/**
* {@inheritdoc}
*/
public function getShortDescription($class, $property, array $context = [])
public function getShortDescription(string $class, string $property, array $context = [])
fabpot marked this conversation as resolved.
Show resolved Hide resolved
{
/** @var $docBlock DocBlock */
list($docBlock) = $this->getDocBlock($class, $property);
Expand All @@ -94,7 +94,7 @@ public function getShortDescription($class, $property, array $context = [])
/**
* {@inheritdoc}
*/
public function getLongDescription($class, $property, array $context = [])
public function getLongDescription(string $class, string $property, array $context = [])
{
/** @var $docBlock DocBlock */
list($docBlock) = $this->getDocBlock($class, $property);
Expand All @@ -110,7 +110,7 @@ public function getLongDescription($class, $property, array $context = [])
/**
* {@inheritdoc}
*/
public function getTypes($class, $property, array $context = [])
public function getTypes(string $class, string $property, array $context = [])
{
/** @var $docBlock DocBlock */
list($docBlock, $source, $prefix) = $this->getDocBlock($class, $property);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function __construct(array $mutatorPrefixes = null, array $accessorPrefix
/**
* {@inheritdoc}
*/
public function getProperties($class, array $context = [])
public function getProperties(string $class, array $context = [])
{
try {
$reflectionClass = new \ReflectionClass($class);
Expand Down Expand Up @@ -131,7 +131,7 @@ public function getProperties($class, array $context = [])
/**
* {@inheritdoc}
*/
public function getTypes($class, $property, array $context = [])
public function getTypes(string $class, $property, array $context = [])
{
if ($fromMutator = $this->extractFromMutator($class, $property)) {
return $fromMutator;
Expand All @@ -156,7 +156,7 @@ public function getTypes($class, $property, array $context = [])
/**
* {@inheritdoc}
*/
public function isReadable($class, $property, array $context = []): bool
public function isReadable(string $class, $property, array $context = []): bool
{
if ($this->isAllowedProperty($class, $property)) {
return true;
Expand All @@ -170,7 +170,7 @@ public function isReadable($class, $property, array $context = []): bool
/**
* {@inheritdoc}
*/
public function isWritable($class, $property, array $context = []): bool
public function isWritable(string $class, $property, array $context = []): bool
{
if ($this->isAllowedProperty($class, $property)) {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function __construct(ClassMetadataFactoryInterface $classMetadataFactory)
/**
* {@inheritdoc}
*/
public function getProperties($class, array $context = [])
public function getProperties(string $class, array $context = [])
{
if (!isset($context['serializer_groups']) || !\is_array($context['serializer_groups'])) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,14 @@ interface PropertyAccessExtractorInterface
/**
* Is the property readable?
*
* @param string $class
* @param string $property
* @param array $context
*
* @return bool|null
*/
public function isReadable($class, $property, array $context = []);
public function isReadable(string $class, string $property, array $context = []);

/**
* Is the property writable?
*
* @param string $class
* @param string $property
* @param array $context
*
* @return bool|null
*/
public function isWritable($class, $property, array $context = []);
public function isWritable(string $class, string $property, array $context = []);
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,14 @@ interface PropertyDescriptionExtractorInterface
/**
* Gets the short description of the property.
*
* @param string $class
* @param string $property
* @param array $context
*
* @return string|null
*/
public function getShortDescription($class, $property, array $context = []);
public function getShortDescription(string $class, string $property, array $context = []);

/**
* Gets the long description of the property.
*
* @param string $class
* @param string $property
* @param array $context
*
* @return string|null
*/
public function getLongDescription($class, $property, array $context = []);
public function getLongDescription(string $class, string $property, array $context = []);
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,47 +35,47 @@ public function __construct(PropertyInfoExtractorInterface $propertyInfoExtracto
/**
* {@inheritdoc}
*/
public function isReadable($class, $property, array $context = [])
public function isReadable(string $class, string $property, array $context = [])
{
return $this->extract('isReadable', [$class, $property, $context]);
}

/**
* {@inheritdoc}
*/
public function isWritable($class, $property, array $context = [])
public function isWritable(string $class, string $property, array $context = [])
{
return $this->extract('isWritable', [$class, $property, $context]);
}

/**
* {@inheritdoc}
*/
public function getShortDescription($class, $property, array $context = [])
public function getShortDescription(string $class, string $property, array $context = [])
{
return $this->extract('getShortDescription', [$class, $property, $context]);
}

/**
* {@inheritdoc}
*/
public function getLongDescription($class, $property, array $context = [])
public function getLongDescription(string $class, string $property, array $context = [])
{
return $this->extract('getLongDescription', [$class, $property, $context]);
}

/**
* {@inheritdoc}
*/
public function getProperties($class, array $context = [])
public function getProperties(string $class, array $context = [])
{
return $this->extract('getProperties', [$class, $context]);
}

/**
* {@inheritdoc}
*/
public function getTypes($class, $property, array $context = [])
public function getTypes(string $class, string $property, array $context = [])
{
return $this->extract('getTypes', [$class, $property, $context]);
}
Expand Down
12 changes: 6 additions & 6 deletions 12 src/Symfony/Component/PropertyInfo/PropertyInfoExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,47 +45,47 @@ public function __construct(iterable $listExtractors = [], iterable $typeExtract
/**
* {@inheritdoc}
*/
public function getProperties($class, array $context = [])
public function getProperties(string $class, array $context = [])
{
return $this->extract($this->listExtractors, 'getProperties', [$class, $context]);
}

/**
* {@inheritdoc}
*/
public function getShortDescription($class, $property, array $context = [])
public function getShortDescription(string $class, string $property, array $context = [])
{
return $this->extract($this->descriptionExtractors, 'getShortDescription', [$class, $property, $context]);
}

/**
* {@inheritdoc}
*/
public function getLongDescription($class, $property, array $context = [])
public function getLongDescription(string $class, string $property, array $context = [])
{
return $this->extract($this->descriptionExtractors, 'getLongDescription', [$class, $property, $context]);
}

/**
* {@inheritdoc}
*/
public function getTypes($class, $property, array $context = [])
public function getTypes(string $class, string $property, array $context = [])
{
return $this->extract($this->typeExtractors, 'getTypes', [$class, $property, $context]);
}

/**
* {@inheritdoc}
*/
public function isReadable($class, $property, array $context = [])
public function isReadable(string $class, string $property, array $context = [])
{
return $this->extract($this->accessExtractors, 'isReadable', [$class, $property, $context]);
}

/**
* {@inheritdoc}
*/
public function isWritable($class, $property, array $context = [])
public function isWritable(string $class, string $property, array $context = [])
{
return $this->extract($this->accessExtractors, 'isWritable', [$class, $property, $context]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ interface PropertyListExtractorInterface
/**
* Gets the list of properties available for the given class.
*
* @param string $class
* @param array $context
*
* @return string[]|null
*/
public function getProperties($class, array $context = []);
public function getProperties(string $class, array $context = []);
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@ interface PropertyTypeExtractorInterface
/**
* Gets types of a property.
*
* @param string $class
* @param string $property
* @param array $context
*
* @return Type[]|null
*/
public function getTypes($class, $property, array $context = []);
public function getTypes(string $class, string $property, array $context = []);
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.