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 more types #41899

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 29, 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
2 changes: 1 addition & 1 deletion 2 src/Symfony/Component/Validator/ConstraintViolation.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class ConstraintViolation implements ConstraintViolationInterface
* caused the violation
* @param mixed $cause The cause of the violation
*/
public function __construct(string|\Stringable $message, ?string $messageTemplate, array $parameters, $root, ?string $propertyPath, $invalidValue, int $plural = null, string $code = null, Constraint $constraint = null, mixed $cause = null)
public function __construct(string|\Stringable $message, ?string $messageTemplate, array $parameters, mixed $root, ?string $propertyPath, mixed $invalidValue, int $plural = null, string $code = null, Constraint $constraint = null, mixed $cause = null)
{
$this->message = $message;
$this->messageTemplate = $messageTemplate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use PHPUnit\Framework\ExpectationFailedException;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Constraints\GroupSequence;
use Symfony\Component\Validator\Constraints\NotNull;
use Symfony\Component\Validator\Constraints\Valid;
use Symfony\Component\Validator\ConstraintValidatorInterface;
Expand Down Expand Up @@ -168,13 +169,13 @@ protected function createContext()
return $context;
}

protected function setGroup($group)
protected function setGroup(?string $group)
{
$this->group = $group;
$this->context->setGroup($group);
}

protected function setObject($object)
protected function setObject(mixed $object)
{
$this->object = $object;
$this->metadata = \is_object($object)
Expand All @@ -184,7 +185,7 @@ protected function setObject($object)
$this->context->setNode($this->value, $this->object, $this->metadata, $this->propertyPath);
}

protected function setProperty($object, $property)
protected function setProperty(mixed $object, string $property)
{
$this->object = $object;
$this->metadata = \is_object($object)
Expand All @@ -194,20 +195,20 @@ protected function setProperty($object, $property)
$this->context->setNode($this->value, $this->object, $this->metadata, $this->propertyPath);
}

protected function setValue($value)
protected function setValue(mixed $value)
{
$this->value = $value;
$this->context->setNode($this->value, $this->object, $this->metadata, $this->propertyPath);
}

protected function setRoot($root)
protected function setRoot(mixed $root)
{
$this->root = $root;
$this->context = $this->createContext();
$this->validator->initialize($this->context);
}

protected function setPropertyPath($propertyPath)
protected function setPropertyPath(string $propertyPath)
{
$this->propertyPath = $propertyPath;
$this->context->setNode($this->value, $this->object, $this->metadata, $this->propertyPath);
Expand All @@ -219,7 +220,7 @@ protected function expectNoValidate()
$validator->expectNoValidate();
}

protected function expectValidateAt($i, $propertyPath, $value, $group)
protected function expectValidateAt(int $i, string $propertyPath, mixed $value, string|GroupSequence|array|null $group)
{
$validator = $this->context->getValidator()->inContext($this->context);
$validator->expectValidation($i, $propertyPath, $value, $group, function ($passedConstraints) {
Expand All @@ -230,7 +231,7 @@ protected function expectValidateAt($i, $propertyPath, $value, $group)
});
}

protected function expectValidateValue(int $i, $value, array $constraints = [], $group = null)
protected function expectValidateValue(int $i, mixed $value, Constraint|array $constraints = [], string|GroupSequence|array|null $group = null)
{
$contextualValidator = $this->context->getValidator()->inContext($this->context);
$contextualValidator->expectValidation($i, '', $value, $group, function ($passedConstraints) use ($constraints) {
Expand All @@ -242,7 +243,7 @@ protected function expectValidateValue(int $i, $value, array $constraints = [],
});
}

protected function expectFailingValueValidation(int $i, $value, array $constraints, $group, ConstraintViolationInterface $violation)
protected function expectFailingValueValidation(int $i, mixed $value, Constraint|array $constraints, string|GroupSequence|array|null $group, ConstraintViolationInterface $violation)
{
$contextualValidator = $this->context->getValidator()->inContext($this->context);
$contextualValidator->expectValidation($i, '', $value, $group, function ($passedConstraints) use ($constraints) {
Expand All @@ -254,15 +255,15 @@ protected function expectFailingValueValidation(int $i, $value, array $constrain
}, $violation);
}

protected function expectValidateValueAt($i, $propertyPath, $value, $constraints, $group = null)
protected function expectValidateValueAt(int $i, string $propertyPath, mixed $value, Constraint|array $constraints, string|GroupSequence|array|null $group = null)
{
$contextualValidator = $this->context->getValidator()->inContext($this->context);
$contextualValidator->expectValidation($i, $propertyPath, $value, $group, function ($passedConstraints) use ($constraints) {
Assert::assertEquals($constraints, $passedConstraints);
});
}

protected function expectViolationsAt($i, $value, Constraint $constraint)
protected function expectViolationsAt(int $i, mixed $value, Constraint $constraint)
{
$context = $this->createContext();

Expand All @@ -283,11 +284,9 @@ protected function assertNoViolation()
}

/**
* @param $message
*
* @return ConstraintViolationAssertion
*/
protected function buildViolation($message)
protected function buildViolation(string|\Stringable $message)
{
return new ConstraintViolationAssertion($this->context, $message, $this->constraint);
}
Expand Down Expand Up @@ -334,7 +333,7 @@ public function atPath(string $path)
return $this;
}

public function setParameter(string $key, $value)
public function setParameter(string $key, string $value)
{
$this->parameters[$key] = $value;

Expand All @@ -348,14 +347,14 @@ public function setParameters(array $parameters)
return $this;
}

public function setTranslationDomain($translationDomain)
public function setTranslationDomain(?string $translationDomain)
{
// no-op for BC

return $this;
}

public function setInvalidValue($invalidValue)
public function setInvalidValue(mixed $invalidValue)
{
$this->invalidValue = $invalidValue;

Expand All @@ -376,7 +375,7 @@ public function setCode(string $code)
return $this;
}

public function setCause($cause)
public function setCause(mixed $cause)
{
$this->cause = $cause;

Expand Down Expand Up @@ -445,11 +444,11 @@ public function __construct(ExecutionContextInterface $context)
$this->context = $context;
}

public function atPath($path)
public function atPath(string $path)
{
}

public function doAtPath($path)
public function doAtPath(string $path)
{
Assert::assertFalse($this->expectNoValidate, 'No validation calls have been expected.');

Expand All @@ -462,11 +461,11 @@ public function doAtPath($path)
return $this;
}

public function validate($value, $constraints = null, $groups = null)
public function validate(mixed $value, Constraint|array|null $constraints = null, string|GroupSequence|array|null $groups = null)
{
}

public function doValidate($value, $constraints = null, $groups = null)
public function doValidate(mixed $value, Constraint|array|null $constraints = null, string|GroupSequence|array|null $groups = null)
{
Assert::assertFalse($this->expectNoValidate, 'No validation calls have been expected.');

Expand All @@ -487,20 +486,20 @@ public function doValidate($value, $constraints = null, $groups = null)
return $this;
}

public function validateProperty($object, $propertyName, $groups = null)
public function validateProperty(object $object, string $propertyName, string|GroupSequence|array|null $groups = null)
{
}

public function doValidateProperty($object, $propertyName, $groups = null)
public function doValidateProperty(object $object, string $propertyName, string|GroupSequence|array|null $groups = null)
{
return $this;
}

public function validatePropertyValue($objectOrClass, $propertyName, $value, $groups = null)
public function validatePropertyValue(object|string $objectOrClass, string $propertyName, mixed $value, string|GroupSequence|array|null $groups = null)
{
}

public function doValidatePropertyValue($objectOrClass, $propertyName, $value, $groups = null)
public function doValidatePropertyValue(object|string $objectOrClass, string $propertyName, mixed $value, string|GroupSequence|array|null $groups = null)
{
return $this;
}
Expand All @@ -519,7 +518,7 @@ public function expectNoValidate()
$this->expectNoValidate = true;
}

public function expectValidation($call, $propertyPath, $value, $group, $constraints, ConstraintViolationInterface $violation = null)
public function expectValidation(string $call, string $propertyPath, mixed $value, string|GroupSequence|array|null $group, callable $constraints, ConstraintViolationInterface $violation = null)
{
$this->expectedAtPath[$call] = $propertyPath;
$this->expectedValidate[$call] = [$value, $group, $constraints, $violation];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ 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
*/
public function validate(mixed $value, Constraint|array $constraints = null, string|GroupSequence|array|null $groups = null);
public function validate(mixed $value, Constraint|array|null $constraints = null, string|GroupSequence|array|null $groups = null);

/**
* Validates a property of an object against the constraints specified
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,9 @@ class ConstraintViolationBuilder implements ConstraintViolationBuilderInterface
private $plural;
private $constraint;
private $code;

/**
* @var mixed
*/
private $cause;

/**
* @param string $message The error message as a string or a stringable object
*/
public function __construct(ConstraintViolationList $violations, Constraint $constraint, $message, array $parameters, mixed $root, ?string $propertyPath, mixed $invalidValue, TranslatorInterface $translator, string $translationDomain = null)
public function __construct(ConstraintViolationList $violations, Constraint $constraint, string|\Stringable $message, array $parameters, mixed $root, ?string $propertyPath, mixed $invalidValue, TranslatorInterface $translator, string $translationDomain = null)
{
$this->violations = $violations;
$this->message = $message;
Expand Down Expand Up @@ -102,7 +95,7 @@ public function setTranslationDomain(string $translationDomain)
/**
* {@inheritdoc}
*/
public function setInvalidValue($invalidValue)
public function setInvalidValue(mixed $invalidValue)
{
$this->invalidValue = $invalidValue;

Expand Down Expand Up @@ -132,7 +125,7 @@ public function setCode(?string $code)
/**
* {@inheritdoc}
*/
public function setCause($cause)
public function setCause(mixed $cause)
{
$this->cause = $cause;

Expand Down
4 changes: 2 additions & 2 deletions 4 src/Symfony/Component/VarDumper/Caster/ClassStub.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ClassStub extends ConstStub
* @param string $identifier A PHP identifier, e.g. a class, method, interface, etc. name
* @param callable $callable The callable targeted by the identifier when it is ambiguous or not a real PHP identifier
*/
public function __construct(string $identifier, $callable = null)
public function __construct(string $identifier, callable|array|string $callable = null)
{
$this->value = $identifier;

Expand Down Expand Up @@ -87,7 +87,7 @@ public function __construct(string $identifier, $callable = null)
}
}

public static function wrapCallable($callable)
public static function wrapCallable(mixed $callable)
{
if (\is_object($callable) || !\is_callable($callable)) {
return $callable;
Expand Down
2 changes: 1 addition & 1 deletion 2 src/Symfony/Component/VarDumper/Caster/ConstStub.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/
class ConstStub extends Stub
{
public function __construct(string $name, $value = null)
public function __construct(string $name, string|int|float $value = null)
{
$this->class = $name;
$this->value = 1 < \func_num_args() ? $value : $name;
Expand Down
2 changes: 1 addition & 1 deletion 2 src/Symfony/Component/VarDumper/Caster/DOMCaster.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public static function castLength($dom, array $a, Stub $stub, bool $isNested)
return $a;
}

public static function castImplementation($dom, array $a, Stub $stub, bool $isNested)
public static function castImplementation(\DOMImplementation $dom, array $a, Stub $stub, bool $isNested)
{
$a += [
Caster::PREFIX_VIRTUAL.'Core' => '1.0',
Expand Down
7 changes: 1 addition & 6 deletions 7 src/Symfony/Component/VarDumper/Caster/ResourceCaster.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,7 @@
*/
class ResourceCaster
{
/**
* @param \CurlHandle|resource $h
*
* @return array
*/
public static function castCurl($h, array $a, Stub $stub, bool $isNested)
public static function castCurl(\CurlHandle $h, array $a, Stub $stub, bool $isNested)
{
return curl_getinfo($h);
}
Expand Down
2 changes: 1 addition & 1 deletion 2 src/Symfony/Component/VarDumper/Caster/SplCaster.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public static function castWeakReference(\WeakReference $c, array $a, Stub $stub
return $a;
}

private static function castSplArray($c, array $a, Stub $stub, bool $isNested): array
private static function castSplArray(\ArrayObject|\ArrayIterator $c, array $a, Stub $stub, bool $isNested): array
{
$prefix = Caster::PREFIX_VIRTUAL;
$flags = $c->getFlags();
Expand Down
1 change: 0 additions & 1 deletion 1 src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ abstract class AbstractCloner implements ClonerInterface
'Symfony\Component\VarDumper\Caster\DsPairStub' => ['Symfony\Component\VarDumper\Caster\DsCaster', 'castPairStub'],

'CurlHandle' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castCurl'],
':curl' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castCurl'],

':dba' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castDba'],
':dba persistent' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castDba'],
Expand Down
8 changes: 4 additions & 4 deletions 8 src/Symfony/Component/VarDumper/Cloner/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,22 +150,22 @@ public function __isset(string $key)
/**
* @return bool
*/
public function offsetExists($key)
public function offsetExists(mixed $key)
{
return $this->__isset($key);
}

public function offsetGet($key)
public function offsetGet(mixed $key)
{
return $this->__get($key);
}

public function offsetSet($key, $value)
public function offsetSet(mixed $key, mixed $value)
{
throw new \BadMethodCallException(self::class.' objects are immutable.');
}

public function offsetUnset($key)
public function offsetUnset(mixed $key)
{
throw new \BadMethodCallException(self::class.' objects are immutable.');
}
Expand Down
2 changes: 1 addition & 1 deletion 2 src/Symfony/Component/Workflow/Dumper/GraphvizDumper.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ protected function dotize(string $id): string
/**
* @internal
*/
protected function escape($value): string
protected function escape(string|bool $value): string
{
return \is_bool($value) ? ($value ? '1' : '0') : addslashes($value);
}
Expand Down
2 changes: 1 addition & 1 deletion 2 src/Symfony/Component/Yaml/Inline.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public static function parse(string $value = null, int $flags = 0, array &$refer
*
* @throws DumpException When trying to dump PHP resource
*/
public static function dump($value, int $flags = 0): string
public static function dump(mixed $value, int $flags = 0): string
{
switch (true) {
case \is_resource($value):
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.