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

Add some missing types #41919

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 1 commit into from
Jun 30, 2021
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
5 changes: 1 addition & 4 deletions 5 src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,7 @@ private function getHash($listener): string
return spl_object_hash($listener);
}

/**
* @param object $listener
*/
private function getMethod($listener, string $event): string
private function getMethod(object $listener, string $event): string
{
if (!method_exists($listener, $event) && method_exists($listener, '__invoke')) {
return '__invoke';
Expand Down
10 changes: 2 additions & 8 deletions 10 src/Symfony/Bridge/Doctrine/DataCollector/ObjectParameter.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,15 @@ final class ObjectParameter
private $stringable;
private $class;

/**
* @param object $object
*/
public function __construct($object, ?\Throwable $error)
public function __construct(object $object, ?\Throwable $error)
{
$this->object = $object;
$this->error = $error;
$this->stringable = \is_callable([$object, '__toString']);
$this->class = \get_class($object);
}

/**
* @return object
*/
public function getObject()
public function getObject(): object
{
return $this->object;
}
Expand Down
11 changes: 6 additions & 5 deletions 11 src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public static function createChoiceName(object $choice, $key, string $value): st
* @internal This method is public to be usable as callback. It should not
* be used in user code.
*/
public function getQueryBuilderPartsForCachingHash($queryBuilder): ?array
public function getQueryBuilderPartsForCachingHash(object $queryBuilder): ?array
{
return null;
}
Expand Down Expand Up @@ -232,12 +232,13 @@ public function configureOptions(OptionsResolver $resolver)
/**
* Return the default loader object.
*
* @param mixed $queryBuilder
*
* @return EntityLoaderInterface
*/
abstract public function getLoader(ObjectManager $manager, $queryBuilder, string $class);
abstract public function getLoader(ObjectManager $manager, object $queryBuilder, string $class);

/**
* @return string
*/
public function getParent()
{
return ChoiceType::class;
Expand All @@ -263,7 +264,7 @@ private function getCachedIdReader(ObjectManager $manager, string $class): ?IdRe
return $this->idReaders[$hash] = $idReader->isSingleId() ? $idReader : null;
}

private function getCachedEntityLoader(ObjectManager $manager, $queryBuilder, string $class, array $vary): EntityLoaderInterface
private function getCachedEntityLoader(ObjectManager $manager, object $queryBuilder, string $class, array $vary): EntityLoaderInterface
{
$hash = CachingFactoryDecorator::generateHash($vary);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

namespace Symfony\Bridge\Doctrine\Validator\Constraints;

use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidator;
Expand Down Expand Up @@ -175,7 +177,7 @@ public function validate($entity, Constraint $constraint)
->addViolation();
}

private function formatWithIdentifiers($em, $class, $value)
private function formatWithIdentifiers(EntityManagerInterface $em, ClassMetadata $class, $value)
{
if (!\is_object($value) || $value instanceof \DateTimeInterface) {
return $this->formatValue($value, self::PRETTY_DATE);
Expand Down
10 changes: 5 additions & 5 deletions 10 src/Symfony/Component/BrowserKit/AbstractBrowser.php
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ public function request(string $method, string $uri, array $parameters = [], arr
*
* @throws \RuntimeException When processing returns exit code
*/
protected function doRequestInProcess($request)
protected function doRequestInProcess(object $request)
{
$deprecationsFile = tempnam(sys_get_temp_dir(), 'deprec');
putenv('SYMFONY_DEPRECATIONS_SERIALIZE='.$deprecationsFile);
Expand Down Expand Up @@ -458,7 +458,7 @@ protected function doRequestInProcess($request)
*
* @return object An origin response instance
*/
abstract protected function doRequest($request);
abstract protected function doRequest(object $request);

/**
* Returns the script to execute when the request must be insulated.
Expand All @@ -467,7 +467,7 @@ abstract protected function doRequest($request);
*
* @throws \LogicException When this abstract class is not implemented
*/
protected function getScript($request)
protected function getScript(object $request)
{
throw new \LogicException('To insulate requests, you need to override the getScript() method.');
}
Expand All @@ -489,7 +489,7 @@ protected function filterRequest(Request $request)
*
* @return Response An BrowserKit Response instance
*/
protected function filterResponse($response)
protected function filterResponse(object $response)
{
return $response;
}
Expand Down Expand Up @@ -681,7 +681,7 @@ protected function getAbsoluteUri(string $uri)
*
* @return Crawler
*/
protected function requestFromRequest(Request $request, $changeHistory = true)
protected function requestFromRequest(Request $request, bool $changeHistory = true)
{
return $this->request($request->getMethod(), $request->getUri(), $request->getParameters(), $request->getFiles(), $request->getServer(), $request->getContent(), $changeHistory);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -461,10 +461,7 @@ protected function assertNode(string $expectedName, string $expectedType, NodeDe
$this->assertSame($expectedName, $this->getField($actualNode, 'name'));
}

/**
* @param object $object
*/
protected function getField($object, string $field)
protected function getField(object $object, string $field)
{
$reflection = new \ReflectionProperty($object, $field);
$reflection->setAccessible(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,5 @@
*/
interface DescriptorInterface
{
/**
* Describes an object if supported.
*
* @param object $object
*/
public function describe(OutputInterface $output, $object, array $options = []);
public function describe(OutputInterface $output, object $object, array $options = []);
}
8 changes: 2 additions & 6 deletions 8 src/Symfony/Component/Messenger/Envelope.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,10 @@ final class Envelope
private $message;

/**
* @param object $message
* @param StampInterface[] $stamps
*/
public function __construct($message, array $stamps = [])
public function __construct(object $message, array $stamps = [])
{
if (!\is_object($message)) {
throw new \TypeError(sprintf('Invalid argument provided to "%s()": expected object but got "%s".', __METHOD__, get_debug_type($message)));
}
$this->message = $message;

foreach ($stamps as $stamp) {
Expand All @@ -45,7 +41,7 @@ public function __construct($message, array $stamps = [])
* @param object|Envelope $message
* @param StampInterface[] $stamps
*/
public static function wrap($message, array $stamps = []): self
public static function wrap(object $message, array $stamps = []): self
{
$envelope = $message instanceof self ? $message : new self($message);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ class ValidationFailedException extends RuntimeException
private $violations;
private $violatingMessage;

/**
* @param object $violatingMessage
*/
public function __construct($violatingMessage, ConstraintViolationListInterface $violations)
public function __construct(object $violatingMessage, ConstraintViolationListInterface $violations)
{
$this->violatingMessage = $violatingMessage;
$this->violations = $violations;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ interface AccessDecisionManagerInterface
/**
* Decides whether the access is possible or not.
*
* @param array $attributes An array of attributes associated with the method being invoked
* @param object $object The object to secure
* @param array $attributes An array of attributes associated with the method being invoked
* @param mixed $object The object to secure
*
* @return bool true if the access is granted, false otherwise
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,9 @@ protected function instantiateObject(array &$data, string $class, array &$contex
/**
* Gets and caches attributes for the given object, format and context.
*
* @param object $object
*
* @return string[]
*/
protected function getAttributes($object, ?string $format, array $context)
protected function getAttributes(object $object, ?string $format, array $context)
{
$class = $this->objectClassResolver ? ($this->objectClassResolver)($object) : \get_class($object);
$key = $class.'-'.$context['cache_key'];
Expand Down
6 changes: 1 addition & 5 deletions 6 src/Symfony/Component/Validator/Context/ExecutionContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -351,12 +351,8 @@ public function isObjectInitialized(string $cacheKey): bool

/**
* @internal
*
* @param object $object
*
* @return string
*/
public function generateCacheKey($object)
public function generateCacheKey(object $object): string
{
if (!isset($this->cachedObjectsRefs[$object])) {
$this->cachedObjectsRefs[$object] = spl_object_hash($object);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,5 @@
*/
interface ObjectInitializerInterface
{
/**
* Initializes an object just before validation.
*
* @param object $object The object to validate
*/
public function initialize(object $object);
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function atPath(string $path);
* {@link \Symfony\Component\Validator\Constraints\Valid} is assumed.
*
* @param mixed $value The value to validate
* @param Constraint|Constraint[] $constraints The constraint(s) to validate against
* @param Constraint|Constraint[]|null $constraints The constraint(s) to validate against
* @param string|GroupSequence|array<string|GroupSequence>|null $groups The validation groups to validate. If none is given, "Default" is assumed
*
* @return $this
Expand All @@ -52,13 +52,12 @@ public function validate($value, $constraints = null, $groups = null);
* Validates a property of an object against the constraints specified
* for this property.
*
* @param object $object The object
* @param string $propertyName The name of the validated property
* @param string|GroupSequence|array<string|GroupSequence>|null $groups The validation groups to validate. If none is given, "Default" is assumed
*
* @return $this
*/
public function validateProperty($object, string $propertyName, $groups = null);
public function validateProperty(object $object, string $propertyName, $groups = null);

/**
* Validates a value against the constraints specified for an object's
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public function validate($value, $constraints = null, $groups = null)
/**
* {@inheritdoc}
*/
public function validateProperty($object, string $propertyName, $groups = null)
public function validateProperty(object $object, string $propertyName, $groups = null)
{
$classMetadata = $this->metadataFactory->getMetadataFor($object);

Expand Down Expand Up @@ -300,7 +300,7 @@ protected function normalizeGroups($groups)
* metadata factory does not implement
* {@link ClassMetadataInterface}
*/
private function validateObject($object, string $propertyPath, array $groups, int $traversalStrategy, ExecutionContextInterface $context)
private function validateObject(object $object, string $propertyPath, array $groups, int $traversalStrategy, ExecutionContextInterface $context)
{
try {
$classMetadata = $this->metadataFactory->getMetadataFor($object);
Expand Down Expand Up @@ -765,10 +765,7 @@ private function validateInGroup($value, ?string $cacheKey, MetadataInterface $m
}
}

/**
* @param object $object
*/
private function generateCacheKey($object, bool $dependsOnPropertyPath = false): string
private function generateCacheKey(object $object, bool $dependsOnPropertyPath = false): string
{
if ($this->context instanceof ExecutionContext) {
$cacheKey = $this->context->generateCacheKey($object);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,14 @@ public function validate($value, $constraints = null, $groups = null);
* Validates a property of an object against the constraints specified
* for this property.
*
* @param object $object The object
* @param string $propertyName The name of the validated property
* @param string|GroupSequence|array<string|GroupSequence>|null $groups The validation groups to validate. If none is given, "Default" is assumed
*
* @return ConstraintViolationListInterface A list of constraint violations
* If the list is empty, validation
* succeeded
*/
public function validateProperty($object, string $propertyName, $groups = null);
public function validateProperty(object $object, string $propertyName, $groups = null);

/**
* Validates a value against the constraints specified for an object's
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.