Changes on PHP-CS-Fixer configuration

Because of `declare(strict_types=1)` some changes were necessary.
This commit is contained in:
Henrique Moody 2017-11-19 19:01:31 +01:00
parent 0bb9b14658
commit ef975629f3
No known key found for this signature in database
GPG key ID: 221E9281655813A6
998 changed files with 3058 additions and 1122 deletions

44
.php_cs
View file

@ -1,24 +1,24 @@
<?php
$finder = Symfony\CS\Finder\DefaultFinder::create()
->files()
->name('*.php')
->name('*.phpt')
->in('library')
->in('tests');
return Symfony\CS\Config\Config::create()
->level(\Symfony\CS\FixerInterface::SYMFONY_LEVEL)
->fixers(array(
'empty_return',
'mb_str_functions',
'multiline_spaces_before_semicolon',
'newline_after_open_tag',
'no_useless_else',
'no_useless_return',
'ordered_use',
'phpdoc_order',
'short_array_syntax',
))
->setUsingCache(true)
->finder($finder);
return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules([
'@Symfony' => true,
'@PHP71Migration:risky' => true,
'phpdoc_align' => false,
'phpdoc_summary' => false,
'mb_str_functions' => true,
'no_multiline_whitespace_before_semicolons' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_imports' => true,
'phpdoc_order' => true,
'array_syntax' => ['syntax' => 'short'],
'no_short_echo_tag' => true,
])
->setFinder(
PhpCsFixer\Finder::create()
->in(['library', 'tests'])
->name('*.php')
->name('*.phpt')
);

View file

@ -17,6 +17,7 @@
},
"require-dev": {
"egulias/email-validator": "^2.0",
"friendsofphp/php-cs-fixer": "^2.8",
"malukenho/docheader": "^0.1.4",
"mikey179/vfsStream": "^1.6",
"phpunit/phpunit": "^6.4",

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class AgeException extends NestedValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class AllOfException extends GroupedValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class AlnumException extends AlphaException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class AlphaException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class AlwaysInvalidException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class AlwaysValidException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class AnyOfException extends NestedValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class ArrayTypeException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class ArrayValException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class AtLeastException extends GroupedValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class AttributeException extends NestedValidationException implements NonOmissibleExceptionInterface

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class Base64Exception extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class BaseException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class BetweenException extends NestedValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class BoolTypeException extends ValidationException

View file

@ -1,4 +1,5 @@
<?php
/*
* This file is part of Respect/Validation.
*
@ -8,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class BoolValException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
/**

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class CallException extends GroupedValidationException implements NonOmissibleExceptionInterface

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
/**

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class CallbackException extends NestedValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class CharsetException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class CnhException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class CnpjException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class CntrlException extends AlphaException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
use Exception;

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class ConsonantException extends AlphaException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class ContainsException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class CountableException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class CountryCodeException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class CpfException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class CreditCardException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class CurrencyCodeException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class DateTimeException extends ValidationException
@ -29,7 +31,7 @@ class DateTimeException extends ValidationException
public function configure($name, array $params = [])
{
$params['format'] = date(
$params['format'],
(string) $params['format'],
strtotime('2005-12-30 01:02:03')
);

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class DigitException extends AlphaException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class DirectoryException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class DomainException extends NestedValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class EachException extends NestedValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class EmailException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class EndsWithException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class EqualsException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class EvenException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
interface ExceptionInterface

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class ExecutableException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class ExistsException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
/**

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
/**

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class FalseValException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class FibonacciException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class FileException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class FilterVarException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
/**

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class FloatTypeException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class FloatValException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class GraphException extends AlphaException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class GroupedValidationException extends NestedValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class HexRgbColorException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class IdenticalException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class IdentityCardException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class ImageException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class ImeiException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class InException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
/**

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class InstanceException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class IntTypeException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class IntValException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class IpException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class IterableTypeException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class JsonException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class KeyException extends AttributeException implements NonOmissibleExceptionInterface

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class KeyNestedException extends AttributeException implements NonOmissibleExceptionInterface

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class KeySetException extends GroupedValidationException implements NonOmissibleExceptionInterface

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class KeyValueException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class LanguageCodeException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class LeapDateException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class LeapYearException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class LengthException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions\Locale;
use Respect\Validation\Exceptions\ValidationException;

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions\Locale;
use Respect\Validation\Exceptions\ValidationException;

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class LowercaseException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class LuhnException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class MacAddressException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class MaxException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
/**

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class MinException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class MinimumAgeException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class MostOfException extends AtLeastException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class MultipleException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class NegativeException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
use IteratorAggregate;
@ -139,7 +141,7 @@ class NestedValidationException extends ValidationException implements IteratorA
$relatedExceptions->rewind();
$childException = $relatedExceptions->current();
return $relatedExceptions->count() === 1 && !$childException instanceof NonOmissibleExceptionInterface;
return 1 === $relatedExceptions->count() && !$childException instanceof NonOmissibleExceptionInterface;
}
/**
@ -166,7 +168,7 @@ class NestedValidationException extends ValidationException implements IteratorA
if (isset($knownDepths[$currentDepthOriginal])) {
$currentDepth = $knownDepths[$currentDepthOriginal];
} elseif ($currentDepthOriginal > $lastDepthOriginal
&& ($this->hasCustomTemplate() || $exceptionIterator->count() != 1)) {
&& ($this->hasCustomTemplate() || 1 != $exceptionIterator->count())) {
++$currentDepth;
}
@ -217,7 +219,7 @@ class NestedValidationException extends ValidationException implements IteratorA
$messages = [];
$exceptions = $this->getIterator();
if ($this->hasCustomTemplate() || count($exceptions) != 1) {
if ($this->hasCustomTemplate() || 1 != count($exceptions)) {
$messages[] = sprintf('%s %s', $marker, $this->getMessage());
}

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class NfeAccessKeyException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
/**

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class NoException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class NoWhitespaceException extends ValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
interface NonOmissibleExceptionInterface extends ExceptionInterface

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class NoneOfException extends NestedValidationException

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class NotBlankException extends ValidationException
@ -29,6 +31,6 @@ class NotBlankException extends ValidationException
public function chooseTemplate()
{
return $this->getName() == '' ? static::STANDARD : static::NAMED;
return '' == $this->getName() ? static::STANDARD : static::NAMED;
}
}

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class NotEmptyException extends ValidationException
@ -28,6 +30,6 @@ class NotEmptyException extends ValidationException
public function chooseTemplate()
{
return $this->getName() == '' ? static::STANDARD : static::NAMED;
return '' == $this->getName() ? static::STANDARD : static::NAMED;
}
}

View file

@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
class NotException extends GroupedValidationException

Some files were not shown because too many files have changed in this diff Show more