mirror of
https://github.com/Respect/Validation.git
synced 2024-05-04 15:33:13 +02:00
Update version of PHPStan packages
Some amazing features had to be ignored because it conflicts with out coring standards. I hope to soon fix them so we can use PHPStan to its fullest potential. Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
This commit is contained in:
parent
fc14c6c669
commit
642602fd43
|
@ -23,9 +23,9 @@
|
|||
"egulias/email-validator": "^2.1",
|
||||
"malukenho/docheader": "^0.1",
|
||||
"mikey179/vfsstream": "^1.6",
|
||||
"phpstan/phpstan": "^0.11",
|
||||
"phpstan/phpstan-deprecation-rules": "^0.11.0",
|
||||
"phpstan/phpstan-phpunit": "^0.11.0",
|
||||
"phpstan/phpstan": "^0.12",
|
||||
"phpstan/phpstan-deprecation-rules": "^0.12",
|
||||
"phpstan/phpstan-phpunit": "^0.12",
|
||||
"phpunit/phpunit": "^7.5",
|
||||
"respect/coding-standard": "^2.1",
|
||||
"squizlabs/php_codesniffer": "^3.5",
|
||||
|
|
|
@ -22,6 +22,7 @@ use function count;
|
|||
use function current;
|
||||
use function implode;
|
||||
use function is_array;
|
||||
use function is_string;
|
||||
use function spl_object_hash;
|
||||
use function sprintf;
|
||||
use function str_repeat;
|
||||
|
@ -39,6 +40,8 @@ use const PHP_EOL;
|
|||
* @author Henrique Moody <henriquemoody@gmail.com>
|
||||
* @author Jonathan Stewmon <jstewmon@rmn.com>
|
||||
* @author Wojciech Frącz <fraczwojciech@gmail.com>
|
||||
*
|
||||
* @implements IteratorAggregate<ValidationException>
|
||||
*/
|
||||
class NestedValidationException extends ValidationException implements IteratorAggregate
|
||||
{
|
||||
|
@ -215,11 +218,11 @@ class NestedValidationException extends ValidationException implements IteratorA
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string[] $templates
|
||||
* @param string[]|string[][] $templates
|
||||
*/
|
||||
private function renderMessage(ValidationException $exception, array $templates): string
|
||||
{
|
||||
if (isset($templates[$exception->getId()])) {
|
||||
if (isset($templates[$exception->getId()]) && is_string($templates[$exception->getId()])) {
|
||||
$exception->updateTemplate($templates[$exception->getId()]);
|
||||
}
|
||||
|
||||
|
@ -227,10 +230,10 @@ class NestedValidationException extends ValidationException implements IteratorA
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string[] $templates
|
||||
* @param string[]|string[][] $templates
|
||||
* @param mixed ...$ids
|
||||
*
|
||||
* @return string[]
|
||||
* @return string[]|string[][]
|
||||
*/
|
||||
private function findTemplates(array $templates, ...$ids): array
|
||||
{
|
||||
|
|
|
@ -24,7 +24,7 @@ use UnexpectedValueException;
|
|||
final class RecursiveExceptionIterator implements RecursiveIterator, Countable
|
||||
{
|
||||
/**
|
||||
* @var ArrayIterator|ValidationException[]
|
||||
* @var ArrayIterator<int, ValidationException>
|
||||
*/
|
||||
private $exceptions;
|
||||
|
||||
|
@ -67,7 +67,7 @@ final class RecursiveExceptionIterator implements RecursiveIterator, Countable
|
|||
|
||||
public function key(): int
|
||||
{
|
||||
return $this->exceptions->key();
|
||||
return (int) $this->exceptions->key();
|
||||
}
|
||||
|
||||
public function next(): void
|
||||
|
|
|
@ -131,9 +131,11 @@ final class Factory
|
|||
{
|
||||
foreach ($this->rulesNamespaces as $namespace) {
|
||||
try {
|
||||
/** @var class-string<Validatable> $name */
|
||||
$name = $namespace . '\\' . ucfirst($ruleName);
|
||||
/** @var Validatable $rule */
|
||||
$rule = $this
|
||||
->createReflectionClass($namespace . '\\' . ucfirst($ruleName), Validatable::class)
|
||||
->createReflectionClass($name, Validatable::class)
|
||||
->newInstanceArgs($arguments);
|
||||
|
||||
return $rule;
|
||||
|
@ -160,13 +162,16 @@ final class Factory
|
|||
$ruleName = $reflection->getShortName();
|
||||
$params = ['input' => $input] + $extraParams + $this->extractPropertiesValues($validatable, $reflection);
|
||||
$id = lcfirst($ruleName);
|
||||
if ($validatable->getName()) {
|
||||
if ($validatable->getName() !== null) {
|
||||
$id = $params['name'] = $validatable->getName();
|
||||
}
|
||||
foreach ($this->exceptionsNamespaces as $namespace) {
|
||||
try {
|
||||
/** @var class-string<ValidationException> $exceptionName */
|
||||
$exceptionName = $namespace . '\\' . $ruleName . 'Exception';
|
||||
|
||||
return $this->createValidationException(
|
||||
$namespace . '\\' . $ruleName . 'Exception',
|
||||
$exceptionName,
|
||||
$id,
|
||||
$input,
|
||||
$params,
|
||||
|
@ -183,6 +188,9 @@ final class Factory
|
|||
/**
|
||||
* Creates a reflection based on class name.
|
||||
*
|
||||
* @param class-string $name
|
||||
* @param class-string $parentName
|
||||
*
|
||||
* @throws InvalidClassException
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
|
@ -203,6 +211,8 @@ final class Factory
|
|||
/**
|
||||
* Creates a Validation exception.
|
||||
*
|
||||
* @param class-string<ValidationException> $exceptionName
|
||||
*
|
||||
* @param mixed $input
|
||||
* @param mixed[] $params
|
||||
*
|
||||
|
|
|
@ -34,7 +34,7 @@ final class Subdivisions
|
|||
throw new ComponentException(sprintf('"%s" is not a supported country code', $countryCode));
|
||||
}
|
||||
|
||||
$this->data = (array) json_decode(file_get_contents($filename), true);
|
||||
$this->data = (array) json_decode((string) file_get_contents($filename), true);
|
||||
}
|
||||
|
||||
public function getCountry(): string
|
||||
|
|
|
@ -67,7 +67,7 @@ abstract class AbstractComposite extends AbstractRule
|
|||
*/
|
||||
public function addRule(Validatable $rule): self
|
||||
{
|
||||
if ($this->shouldHaveNameOverwritten($rule)) {
|
||||
if ($this->shouldHaveNameOverwritten($rule) && $this->getName() !== null) {
|
||||
$rule->setName($this->getName());
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ abstract class AbstractRelated extends AbstractRule
|
|||
$this->rule = $rule;
|
||||
$this->mandatory = $mandatory;
|
||||
|
||||
if ($rule && $rule->getName()) {
|
||||
if ($rule && $rule->getName() !== null) {
|
||||
$this->setName($rule->getName());
|
||||
} elseif (is_scalar($reference)) {
|
||||
$this->setName((string) $reference);
|
||||
|
|
|
@ -51,12 +51,21 @@ final class Callback extends AbstractRule
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
public function validate($input): bool
|
||||
{
|
||||
return (bool) call_user_func_array($this->callback, $this->getArguments($input));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $input
|
||||
* @return mixed[]
|
||||
*/
|
||||
private function getArguments($input): array
|
||||
{
|
||||
$arguments = [$input];
|
||||
if (count($this->arguments) > 0) {
|
||||
$arguments = array_merge($arguments, $this->arguments);
|
||||
if (count($this->arguments) === 0) {
|
||||
return $arguments;
|
||||
}
|
||||
|
||||
return (bool) call_user_func_array($this->callback, $arguments);
|
||||
return array_merge($arguments, $this->arguments);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ final class Cnh extends AbstractRule
|
|||
}
|
||||
|
||||
// Canonicalize input
|
||||
$input = preg_replace('{\D}', '', (string) $input);
|
||||
$input = (string) preg_replace('{\D}', '', (string) $input);
|
||||
|
||||
// Validate length and invalid numbers
|
||||
if (mb_strlen($input) != 11 || ((int) $input === 0)) {
|
||||
|
|
|
@ -80,7 +80,7 @@ final class Cnpj extends AbstractRule
|
|||
return array_map(
|
||||
'intval',
|
||||
str_split(
|
||||
preg_replace('/\D/', '', $input)
|
||||
(string) preg_replace('/\D/', '', $input)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ final class Contains extends AbstractRule
|
|||
return false;
|
||||
}
|
||||
|
||||
$encoding = mb_detect_encoding($haystack);
|
||||
$encoding = (string) mb_detect_encoding($haystack);
|
||||
if ($this->identical) {
|
||||
return mb_strpos($haystack, $needle, 0, $encoding) !== false;
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ final class CreditCard extends AbstractRule
|
|||
return false;
|
||||
}
|
||||
|
||||
$input = preg_replace('/[ .-]/', '', (string) $input);
|
||||
$input = (string) preg_replace('/[ .-]/', '', (string) $input);
|
||||
if (!(new Luhn())->validate($input)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ final class EndsWith extends AbstractRule
|
|||
return end($input) == $this->endValue;
|
||||
}
|
||||
|
||||
$encoding = mb_detect_encoding($input);
|
||||
$encoding = (string) mb_detect_encoding($input);
|
||||
$endPosition = mb_strlen($input, $encoding) - mb_strlen($this->endValue, $encoding);
|
||||
|
||||
return mb_strripos($input, $this->endValue, -1, $encoding) === $endPosition;
|
||||
|
@ -85,7 +85,7 @@ final class EndsWith extends AbstractRule
|
|||
return end($input) === $this->endValue;
|
||||
}
|
||||
|
||||
$encoding = mb_detect_encoding($input);
|
||||
$encoding = (string) mb_detect_encoding($input);
|
||||
$endPosition = mb_strlen($input, $encoding) - mb_strlen($this->endValue, $encoding);
|
||||
|
||||
return mb_strrpos($input, $this->endValue, 0, $encoding) === $endPosition;
|
||||
|
|
|
@ -55,7 +55,7 @@ final class Factor extends AbstractRule
|
|||
return false;
|
||||
}
|
||||
|
||||
$input = (int) abs($input);
|
||||
$input = (int) abs((int) $input);
|
||||
$dividend = (int) abs($this->dividend);
|
||||
|
||||
// The dividend divided by the input must be an integer if input is a
|
||||
|
|
|
@ -141,7 +141,7 @@ final class Iban extends AbstractRule
|
|||
|
||||
private function convertToInteger(string $reArrangedIban): string
|
||||
{
|
||||
return preg_replace_callback(
|
||||
return (string) preg_replace_callback(
|
||||
'/[A-Z]/',
|
||||
static function (array $match): int {
|
||||
return ord($match[0]) - 55;
|
||||
|
|
|
@ -61,6 +61,6 @@ final class Image extends AbstractRule
|
|||
return false;
|
||||
}
|
||||
|
||||
return mb_strpos($this->fileInfo->file($input), 'image/') === 0;
|
||||
return mb_strpos((string) $this->fileInfo->file($input), 'image/') === 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ final class Imei extends AbstractRule
|
|||
return false;
|
||||
}
|
||||
|
||||
$numbers = preg_replace('/\D/', '', $input);
|
||||
$numbers = (string) preg_replace('/\D/', '', (string) $input);
|
||||
if (mb_strlen($numbers) != self::IMEI_SIZE) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ use function mb_strpos;
|
|||
final class In extends AbstractRule
|
||||
{
|
||||
/**
|
||||
* @var mixed[]|string
|
||||
* @var mixed[]|mixed
|
||||
*/
|
||||
private $haystack;
|
||||
|
||||
|
@ -41,7 +41,7 @@ final class In extends AbstractRule
|
|||
/**
|
||||
* Initializes the rule with the haystack and optionally compareIdentical flag.
|
||||
*
|
||||
* @param mixed[]|string $haystack
|
||||
* @param mixed[]|mixed $haystack
|
||||
*/
|
||||
public function __construct($haystack, bool $compareIdentical = false)
|
||||
{
|
||||
|
@ -76,7 +76,7 @@ final class In extends AbstractRule
|
|||
|
||||
$inputString = (string) $input;
|
||||
|
||||
return mb_stripos($this->haystack, $inputString, 0, mb_detect_encoding($inputString)) !== false;
|
||||
return mb_stripos($this->haystack, $inputString, 0, (string) mb_detect_encoding($inputString)) !== false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -94,6 +94,6 @@ final class In extends AbstractRule
|
|||
|
||||
$inputString = (string) $input;
|
||||
|
||||
return mb_strpos($this->haystack, $inputString, 0, mb_detect_encoding($inputString)) !== false;
|
||||
return mb_strpos($this->haystack, $inputString, 0, (string) mb_detect_encoding($inputString)) !== false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -125,11 +125,11 @@ final class Ip extends AbstractRule
|
|||
if (mb_strpos($input, '-') !== false) {
|
||||
[$this->startAddress, $this->endAddress] = explode('-', $input);
|
||||
|
||||
if (!$this->verifyAddress($this->startAddress)) {
|
||||
if ($this->startAddress !== null && !$this->verifyAddress($this->startAddress)) {
|
||||
throw new ComponentException('Invalid network range');
|
||||
}
|
||||
|
||||
if (!$this->verifyAddress($this->endAddress)) {
|
||||
if ($this->endAddress !== null && !$this->verifyAddress($this->endAddress)) {
|
||||
throw new ComponentException('Invalid network range');
|
||||
}
|
||||
|
||||
|
@ -193,13 +193,15 @@ final class Ip extends AbstractRule
|
|||
{
|
||||
$input = sprintf('%u', ip2long($input));
|
||||
|
||||
return bccomp($input, sprintf('%u', ip2long($this->startAddress))) >= 0
|
||||
&& bccomp($input, sprintf('%u', ip2long($this->endAddress))) <= 0;
|
||||
return $this->startAddress !== null
|
||||
&& $this->endAddress !== null
|
||||
&& bccomp($input, sprintf('%u', ip2long($this->startAddress))) >= 0
|
||||
&& bccomp($input, sprintf('%u', ip2long($this->endAddress))) <= 0;
|
||||
}
|
||||
|
||||
private function belongsToSubnet(string $input): bool
|
||||
{
|
||||
if ($this->mask === null) {
|
||||
if ($this->mask === null || $this->startAddress === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,6 @@ final class Isbn extends AbstractRule
|
|||
return false;
|
||||
}
|
||||
|
||||
return preg_match(sprintf('/%s/', implode(self::PIECES)), $input) > 0;
|
||||
return preg_match(sprintf('/%s/', implode(self::PIECES)), (string) $input) > 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ final class KeyValue extends AbstractRule
|
|||
|
||||
try {
|
||||
$rule = Factory::getDefaultInstance()->rule($this->ruleName, [$input[$this->baseKey]]);
|
||||
$rule->setName($this->comparedKey);
|
||||
$rule->setName((string) $this->comparedKey);
|
||||
} catch (ComponentException $exception) {
|
||||
throw parent::reportError($input, ['component' => true]);
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ final class Length extends AbstractRule
|
|||
private function extractLength($input): ?int
|
||||
{
|
||||
if (is_string($input)) {
|
||||
return (int) mb_strlen($input, mb_detect_encoding($input));
|
||||
return (int) mb_strlen($input, (string) mb_detect_encoding($input));
|
||||
}
|
||||
|
||||
if (is_array($input) || $input instanceof CountableInterface) {
|
||||
|
|
|
@ -36,6 +36,6 @@ final class Lowercase extends AbstractRule
|
|||
return false;
|
||||
}
|
||||
|
||||
return $input === mb_strtolower($input, mb_detect_encoding($input));
|
||||
return $input === mb_strtolower($input, (string) mb_detect_encoding($input));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ final class Nip extends AbstractRule
|
|||
}
|
||||
|
||||
$weights = [6, 5, 7, 2, 3, 4, 5, 6, 7];
|
||||
$digits = array_map('intval', str_split($input));
|
||||
$digits = array_map('intval', str_split((string) $input));
|
||||
|
||||
$targetControlNumber = $digits[9];
|
||||
$calculateControlNumber = 0;
|
||||
|
|
|
@ -45,7 +45,7 @@ final class Pesel extends AbstractRule
|
|||
$calculateControlNumber = 0;
|
||||
|
||||
for ($i = 0; $i < 10; ++$i) {
|
||||
$calculateControlNumber += $stringInput[$i] * $weights[$i];
|
||||
$calculateControlNumber += (int) $stringInput[$i] * $weights[$i];
|
||||
}
|
||||
|
||||
$calculateControlNumber = (10 - $calculateControlNumber % 10) % 10;
|
||||
|
|
|
@ -36,7 +36,7 @@ final class Pis extends AbstractRule
|
|||
return false;
|
||||
}
|
||||
|
||||
$digits = preg_replace('/\D/', '', $input);
|
||||
$digits = (string) preg_replace('/\D/', '', (string) $input);
|
||||
if (mb_strlen($digits) != 11 || preg_match('/^' . $digits[0] . '{11}$/', $digits)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ use function sprintf;
|
|||
final class Size extends AbstractRule
|
||||
{
|
||||
/**
|
||||
* @var string|null
|
||||
* @var string|int|null
|
||||
*/
|
||||
private $minSize;
|
||||
|
||||
|
@ -41,7 +41,7 @@ final class Size extends AbstractRule
|
|||
private $minValue;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
* @var string|int|null
|
||||
*/
|
||||
private $maxSize;
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ final class StartsWith extends AbstractRule
|
|||
return reset($input) == $this->startValue;
|
||||
}
|
||||
|
||||
return mb_stripos($input, $this->startValue, 0, mb_detect_encoding($input)) === 0;
|
||||
return mb_stripos($input, $this->startValue, 0, (string) mb_detect_encoding($input)) === 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -80,6 +80,6 @@ final class StartsWith extends AbstractRule
|
|||
return reset($input) === $this->startValue;
|
||||
}
|
||||
|
||||
return mb_strpos($input, $this->startValue, 0, mb_detect_encoding($input)) === 0;
|
||||
return mb_strpos($input, $this->startValue, 0, (string) mb_detect_encoding($input)) === 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,6 @@ final class Uppercase extends AbstractRule
|
|||
return false;
|
||||
}
|
||||
|
||||
return $input === mb_strtoupper($input, mb_detect_encoding($input));
|
||||
return $input === mb_strtoupper($input, (string) mb_detect_encoding($input));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ use function sprintf;
|
|||
final class VideoUrl extends AbstractRule
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
* @var string|null
|
||||
*/
|
||||
private $service;
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ use Throwable;
|
|||
use Zend\Validator\ValidatorInterface;
|
||||
|
||||
use function array_map;
|
||||
use function class_exists;
|
||||
use function current;
|
||||
use function is_string;
|
||||
use function sprintf;
|
||||
|
@ -125,6 +126,10 @@ final class Zend extends AbstractRule
|
|||
$className = stripos($validator, 'Zend') === false ? 'Zend\\Validator\\' . $validator : '\\' . $validator;
|
||||
|
||||
try {
|
||||
if (!class_exists($className)) {
|
||||
throw new ComponentException(sprintf('"%s" is not a valid class name', $className));
|
||||
}
|
||||
|
||||
$reflection = new ReflectionClass($className);
|
||||
if (!$reflection->isInstantiable()) {
|
||||
throw new ComponentException(sprintf('"%s" is not instantiable', $className));
|
||||
|
|
|
@ -7,9 +7,20 @@ parameters:
|
|||
fileExtensions:
|
||||
- php
|
||||
- phpt
|
||||
checkGenericClassInNonGenericObjectType: false
|
||||
checkMissingIterableValueType: false
|
||||
ignoreErrors:
|
||||
- '/Call to an undefined static method Respect\\Validation\\Validator::iDoNotExistSoIShouldThrowException/'
|
||||
- '/Parameter #2 $locale of function setlocale expects array|string|null, int given./'
|
||||
-
|
||||
message: '/Instanceof between mixed and SimpleXMLElement will always evaluate to false\./'
|
||||
path: library/Rules/ArrayVal.php
|
||||
-
|
||||
message: '/Parameter #1 \$error_handler of function set_error_handler expects \(callable\(int, string, string, int, array\): bool\)\|null, Closure\(\): void given\./'
|
||||
paths:
|
||||
- library/Rules/Call.php
|
||||
- tests/unit/Rules/CallTest.php
|
||||
-
|
||||
message: '/Call to an undefined static method Respect\\Validation\\Validator::iDoNotExistSoIShouldThrowException/'
|
||||
path: tests/unit/ValidatorTest.php
|
||||
level: 7
|
||||
paths:
|
||||
- library/
|
||||
|
|
|
@ -26,7 +26,7 @@ try {
|
|||
'schema' => 'schema',
|
||||
],
|
||||
];
|
||||
$object = json_decode(json_encode($array));
|
||||
$object = json_decode((string) json_encode($array));
|
||||
v::create()
|
||||
->attribute(
|
||||
'mysql',
|
||||
|
|
|
@ -64,7 +64,7 @@ abstract class RuleTestCase extends TestCase
|
|||
*/
|
||||
public function getFixtureDirectory(): string
|
||||
{
|
||||
return realpath(__DIR__ . '/../fixtures');
|
||||
return (string) realpath(__DIR__ . '/../fixtures');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -27,8 +27,10 @@ final class ZendValidator implements ValidatorInterface
|
|||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getMessages()
|
||||
public function getMessages(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
|
|
@ -50,6 +50,10 @@ final class CheckExceptionsTest extends TestCase
|
|||
}
|
||||
|
||||
$className = 'Respect\\Validation\\Rules\\' . $ruleName;
|
||||
if (!class_exists($className)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$reflectionClass = new ReflectionClass($className);
|
||||
if ($reflectionClass->isAbstract() || $reflectionClass->isInterface()) {
|
||||
continue;
|
||||
|
|
|
@ -28,7 +28,7 @@ use Respect\Validation\Test\TestCase;
|
|||
final class AlwaysInvalidTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @return mixed[][]
|
||||
*/
|
||||
public function providerForInvalidInput(): array
|
||||
{
|
||||
|
|
|
@ -28,7 +28,7 @@ use Respect\Validation\Test\TestCase;
|
|||
final class AlwaysValidTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @return mixed[][]
|
||||
*/
|
||||
public function providerForValidInput(): array
|
||||
{
|
||||
|
|
|
@ -40,7 +40,7 @@ final class NoTest extends RuleTestCase
|
|||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->locale = setlocale(LC_ALL, 0);
|
||||
$this->locale = (string) setlocale(LC_ALL, '0');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -117,7 +117,7 @@ final class NoTest extends RuleTestCase
|
|||
{
|
||||
setlocale(LC_ALL, $locale);
|
||||
|
||||
if ($locale !== setlocale(LC_ALL, 0)) {
|
||||
if ($locale !== setlocale(LC_ALL, '0')) {
|
||||
$this->markTestSkipped(sprintf('Could not set locale information to "%s"', $locale));
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ final class NoTest extends RuleTestCase
|
|||
{
|
||||
setlocale(LC_ALL, $locale);
|
||||
|
||||
if ($locale !== setlocale(LC_ALL, 0)) {
|
||||
if ($locale !== setlocale(LC_ALL, '0')) {
|
||||
$this->markTestSkipped(sprintf('Could not set locale information to "%s"', $locale));
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ final class YesTest extends RuleTestCase
|
|||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->locale = setlocale(LC_ALL, 0);
|
||||
$this->locale = (string) setlocale(LC_ALL, '0');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -124,7 +124,7 @@ final class YesTest extends RuleTestCase
|
|||
{
|
||||
setlocale(LC_ALL, $locale);
|
||||
|
||||
if ($locale !== setlocale(LC_ALL, 0)) {
|
||||
if ($locale !== setlocale(LC_ALL, '0')) {
|
||||
$this->markTestSkipped(sprintf('Could not set locale information to "%s"', $locale));
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,7 @@ final class YesTest extends RuleTestCase
|
|||
{
|
||||
setlocale(LC_ALL, $locale);
|
||||
|
||||
if ($locale !== setlocale(LC_ALL, 0)) {
|
||||
if ($locale !== setlocale(LC_ALL, '0')) {
|
||||
$this->markTestSkipped(sprintf('Could not set locale information to "%s"', $locale));
|
||||
}
|
||||
|
||||
|
|
|
@ -92,8 +92,6 @@ final class ZendTest extends RuleTestCase
|
|||
* @test
|
||||
*
|
||||
* @dataProvider providerForUnbuildableValidator
|
||||
*
|
||||
* @param mixed $validator
|
||||
*/
|
||||
public function itShouldThrowAnExceptionWhenValidatorCannotBeCreated(string $validator): void
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue