Skip to content

Commit

Permalink
fixed CS
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Sep 22, 2014
1 parent ea8b654 commit 6929b2c
Show file tree
Hide file tree
Showing 51 changed files with 87 additions and 101 deletions.
2 changes: 1 addition & 1 deletion Constraints/AbstractComparisonValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function validate($value, Constraint $constraint)
$this->context->addViolation($constraint->message, array(
'{{ value }}' => $this->formatValue($value, self::OBJECT_TO_STRING | self::PRETTY_DATE),
'{{ compared_value }}' => $this->formatValue($constraint->value, self::OBJECT_TO_STRING | self::PRETTY_DATE),
'{{ compared_value_type }}' => $this->formatTypeOf($constraint->value)
'{{ compared_value_type }}' => $this->formatTypeOf($constraint->value),
));
}
}
Expand Down
2 changes: 1 addition & 1 deletion Constraints/BlankValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function validate($value, Constraint $constraint)
{
if ('' !== $value && null !== $value) {
$this->context->addViolation($constraint->message, array(
'{{ value }}' => $this->formatValue($value)
'{{ value }}' => $this->formatValue($value),
));
}
}
Expand Down
18 changes: 9 additions & 9 deletions Constraints/CardSchemeValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ class CardSchemeValidator extends ConstraintValidator
* American Express card numbers start with 34 or 37 and have 15 digits.
*/
'AMEX' => array(
'/^3[47][0-9]{13}$/'
'/^3[47][0-9]{13}$/',
),
/**
* China UnionPay cards start with 62 and have between 16 and 19 digits.
* Please note that these cards do not follow Luhn Algorithm as a checksum.
*/
'CHINA_UNIONPAY' => array(
'/^62[0-9]{14,17}$/'
'/^62[0-9]{14,17}$/',
),
/**
* Diners Club card numbers begin with 300 through 305, 36 or 38. All have 14 digits.
Expand All @@ -53,45 +53,45 @@ class CardSchemeValidator extends ConstraintValidator
'/^6011[0-9]{12}$/',
'/^64[4-9][0-9]{13}$/',
'/^65[0-9]{14}$/',
'/^622(12[6-9]|1[3-9][0-9]|[2-8][0-9][0-9]|91[0-9]|92[0-5])[0-9]{10}$/'
'/^622(12[6-9]|1[3-9][0-9]|[2-8][0-9][0-9]|91[0-9]|92[0-5])[0-9]{10}$/',
),
/**
* InstaPayment cards begin with 637 through 639 and have 16 digits
*/
'INSTAPAYMENT' => array(
'/^63[7-9][0-9]{13}$/'
'/^63[7-9][0-9]{13}$/',
),
/**
* JCB cards beginning with 2131 or 1800 have 15 digits.
* JCB cards beginning with 35 have 16 digits.
*/
'JCB' => array(
'/^(?:2131|1800|35[0-9]{3})[0-9]{11}$/'
'/^(?:2131|1800|35[0-9]{3})[0-9]{11}$/',
),
/**
* Laser cards begin with either 6304, 6706, 6709 or 6771 and have between 16 and 19 digits
*/
'LASER' => array(
'/^(6304|670[69]|6771)[0-9]{12,15}$/'
'/^(6304|670[69]|6771)[0-9]{12,15}$/',
),
/**
* Maestro cards begin with either 5018, 5020, 5038, 5893, 6304, 6759, 6761, 6762, 6763 or 0604
* They have between 12 and 19 digits
*/
'MAESTRO' => array(
'/^(5018|5020|5038|6304|6759|6761|676[23]|0604)[0-9]{8,15}$/'
'/^(5018|5020|5038|6304|6759|6761|676[23]|0604)[0-9]{8,15}$/',
),
/**
* All MasterCard numbers start with the numbers 51 through 55. All have 16 digits.
*/
'MASTERCARD' => array(
'/^5[1-5][0-9]{14}$/'
'/^5[1-5][0-9]{14}$/',
),
/**
* All Visa card numbers start with a 4. New cards have 16 digits. Old cards have 13.
*/
'VISA' => array(
'/^4([0-9]{12}|[0-9]{15})$/'
'/^4([0-9]{12}|[0-9]{15})$/',
),
);

Expand Down
6 changes: 3 additions & 3 deletions Constraints/ChoiceValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,22 +69,22 @@ public function validate($value, Constraint $constraint)

if ($constraint->min !== null && $count < $constraint->min) {
$this->context->addViolation($constraint->minMessage, array(
'{{ limit }}' => $constraint->min
'{{ limit }}' => $constraint->min,
), $value, (int) $constraint->min);

return;
}

if ($constraint->max !== null && $count > $constraint->max) {
$this->context->addViolation($constraint->maxMessage, array(
'{{ limit }}' => $constraint->max
'{{ limit }}' => $constraint->max,
), $value, (int) $constraint->max);

return;
}
} elseif (!in_array($value, $choices, $constraint->strict)) {
$this->context->addViolation($constraint->message, array(
'{{ value }}' => $this->formatValue($value)
'{{ value }}' => $this->formatValue($value),
));
}
}
Expand Down
4 changes: 2 additions & 2 deletions Constraints/CollectionValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function validate($value, Constraint $constraint)
$this->context->validateValue($value[$field], $fieldConstraint->constraints, '['.$field.']', $group);
} elseif (!$fieldConstraint instanceof Optional && !$constraint->allowMissingFields) {
$this->context->addViolationAt('['.$field.']', $constraint->missingFieldsMessage, array(
'{{ field }}' => $this->formatValue($field)
'{{ field }}' => $this->formatValue($field),
), null);
}
}
Expand All @@ -55,7 +55,7 @@ public function validate($value, Constraint $constraint)
foreach ($value as $field => $fieldValue) {
if (!isset($constraint->fields[$field])) {
$this->context->addViolationAt('['.$field.']', $constraint->extraFieldsMessage, array(
'{{ field }}' => $this->formatValue($field)
'{{ field }}' => $this->formatValue($field),
), $fieldValue);
}
}
Expand Down
4 changes: 2 additions & 2 deletions Constraints/FileValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@ public function validate($value, Constraint $constraint)

if (!is_file($path)) {
$this->context->addViolation($constraint->notFoundMessage, array(
'{{ file }}' => $this->formatValue($path)
'{{ file }}' => $this->formatValue($path),
));

return;
}

if (!is_readable($path)) {
$this->context->addViolation($constraint->notReadableMessage, array(
'{{ file }}' => $this->formatValue($path)
'{{ file }}' => $this->formatValue($path),
));

return;
Expand Down
8 changes: 4 additions & 4 deletions Constraints/ImageValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function validate($value, Constraint $constraint)
if ($width < $constraint->minWidth) {
$this->context->addViolation($constraint->minWidthMessage, array(
'{{ width }}' => $width,
'{{ min_width }}' => $constraint->minWidth
'{{ min_width }}' => $constraint->minWidth,
));

return;
Expand All @@ -75,7 +75,7 @@ public function validate($value, Constraint $constraint)
if ($width > $constraint->maxWidth) {
$this->context->addViolation($constraint->maxWidthMessage, array(
'{{ width }}' => $width,
'{{ max_width }}' => $constraint->maxWidth
'{{ max_width }}' => $constraint->maxWidth,
));

return;
Expand All @@ -90,7 +90,7 @@ public function validate($value, Constraint $constraint)
if ($height < $constraint->minHeight) {
$this->context->addViolation($constraint->minHeightMessage, array(
'{{ height }}' => $height,
'{{ min_height }}' => $constraint->minHeight
'{{ min_height }}' => $constraint->minHeight,
));

return;
Expand All @@ -105,7 +105,7 @@ public function validate($value, Constraint $constraint)
if ($height > $constraint->maxHeight) {
$this->context->addViolation($constraint->maxHeightMessage, array(
'{{ height }}' => $height,
'{{ max_height }}' => $constraint->maxHeight
'{{ max_height }}' => $constraint->maxHeight,
));
}
}
Expand Down
3 changes: 2 additions & 1 deletion Constraints/IsbnValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ private function isValidIsbn13($isbn)
}

for ($i = 1; $i < 12; $i += 2) {
$checkSum += $isbn{$i} * 3;
$checkSum += $isbn{$i}
* 3;
}

return 0 === $checkSum % 10;
Expand Down
3 changes: 2 additions & 1 deletion Constraints/IssnValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ public function validate($value, Constraint $constraint)
$canonical = strtoupper(str_replace('-', '', $value));

// Calculate a checksum. "X" equals 10.
$checkSum = 'X' === $canonical{7} ? 10 : $canonical{7};
$checkSum = 'X' === $canonical{7}
? 10 : $canonical{7};

for ($i = 0; $i < 7; ++$i) {
// Multiply the first digit by 8, the second by 7, etc.
Expand Down
2 changes: 1 addition & 1 deletion Mapping/ClassMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public function __sleep()
'members',
'name',
'properties',
'defaultGroup'
'defaultGroup',
));
}

Expand Down
2 changes: 1 addition & 1 deletion Tests/ConstraintTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function testInvalidAndRequiredOptionsPassed()

new ConstraintC(array(
'option1' => 'default',
'foo' => 'bar'
'foo' => 'bar',
));
}

Expand Down
2 changes: 1 addition & 1 deletion Tests/Constraints/AbstractComparisonValidatorTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function testInvalidComparisonToValue($dirtyValue, $dirtyValueAsString, $
$this->assertViolation('Constraint Message', array(
'{{ value }}' => $dirtyValueAsString,
'{{ compared_value }}' => $comparedValueString,
'{{ compared_value_type }}' => $comparedValueType
'{{ compared_value_type }}' => $comparedValueType,
));
}

Expand Down
2 changes: 1 addition & 1 deletion Tests/Constraints/AbstractConstraintValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ protected function createContext()
$this->metadata,
$this->value,
$this->group,
$this->propertyPath
$this->propertyPath,
))
->setMethods(array('validate', 'validateValue'))
->getMock();
Expand Down
2 changes: 1 addition & 1 deletion Tests/Constraints/BlankValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function testBlankIsValid()
public function testInvalidValues($value, $valueAsString)
{
$constraint = new Blank(array(
'message' => 'myMessage'
'message' => 'myMessage',
));

$this->validator->validate($value, $constraint);
Expand Down
2 changes: 1 addition & 1 deletion Tests/Constraints/CallbackValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function testSingleStaticMethod()
{
$object = new CallbackValidatorTest_Object();
$constraint = new Callback(array(
array(__CLASS__.'_Class', 'validateCallback')
array(__CLASS__.'_Class', 'validateCallback'),
));

$this->validator->validate($object, $constraint);
Expand Down
6 changes: 3 additions & 3 deletions Tests/Constraints/ChoiceValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function testValidChoiceCallbackClosure()
{
$constraint = new Choice(array('callback' => function () {
return array('foo', 'bar');
}));
},));

$this->validator->validate('bar', $constraint);

Expand Down Expand Up @@ -228,7 +228,7 @@ public function testStrictDisallowsDifferentType()
$constraint = new Choice(array(
'choices' => array(1, 2),
'strict' => true,
'message' => 'myMessage'
'message' => 'myMessage',
));

$this->validator->validate('2', $constraint);
Expand All @@ -243,7 +243,7 @@ public function testNonStrictWithMultipleChoices()
$constraint = new Choice(array(
'choices' => array(1, 2, 3),
'multiple' => true,
'strict' => false
'strict' => false,
));

$this->validator->validate(array('2', 3), $constraint);
Expand Down
14 changes: 7 additions & 7 deletions Tests/Constraints/CollectionValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function testWalkMultipleConstraints()
'fields' => array(
'foo' => $constraints,
'bar' => $constraints,
)
),
)));

$this->assertNoViolation();
Expand All @@ -137,7 +137,7 @@ public function testExtraFieldsDisallowed()
)));

$this->assertViolation('myMessage', array(
'{{ field }}' => '"baz"'
'{{ field }}' => '"baz"',
), 'property.path[baz]', 6);
}

Expand Down Expand Up @@ -196,7 +196,7 @@ public function testMissingFieldsDisallowed()
)));

$this->assertViolation('myMessage', array(
'{{ field }}' => '"foo"'
'{{ field }}' => '"foo"',
), 'property.path[foo]', null);
}

Expand Down Expand Up @@ -306,7 +306,7 @@ public function testRequiredFieldNotPresent()
)));

$this->assertViolation('myMessage', array(
'{{ field }}' => '"foo"'
'{{ field }}' => '"foo"',
), 'property.path[foo]', null);
}

Expand Down Expand Up @@ -354,7 +354,7 @@ public function testRequiredFieldMultipleConstraints()
public function testObjectShouldBeLeftUnchanged()
{
$value = new \ArrayObject(array(
'foo' => 3
'foo' => 3,
));

$constraint = new Range(array('min' => 2));
Expand All @@ -364,11 +364,11 @@ public function testObjectShouldBeLeftUnchanged()
$this->validator->validate($value, new Collection(array(
'fields' => array(
'foo' => $constraint,
)
),
)));

$this->assertEquals(array(
'foo' => 3
'foo' => 3,
), (array) $value);
}
}
6 changes: 3 additions & 3 deletions Tests/Constraints/CountValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public function testInvalidValuesMax($value)
{
$constraint = new Count(array(
'max' => 4,
'maxMessage' => 'myMessage'
'maxMessage' => 'myMessage',
));

$this->validator->validate($value, $constraint);
Expand All @@ -134,7 +134,7 @@ public function testInvalidValuesMin($value)
{
$constraint = new Count(array(
'min' => 4,
'minMessage' => 'myMessage'
'minMessage' => 'myMessage',
));

$this->validator->validate($value, $constraint);
Expand All @@ -153,7 +153,7 @@ public function testInvalidValuesExact($value)
$constraint = new Count(array(
'min' => 4,
'max' => 4,
'exactMessage' => 'myMessage'
'exactMessage' => 'myMessage',
));

$this->validator->validate($value, $constraint);
Expand Down
2 changes: 1 addition & 1 deletion Tests/Constraints/CountryValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function getValidCountries()
public function testInvalidCountries($country)
{
$constraint = new Country(array(
'message' => 'myMessage'
'message' => 'myMessage',
));

$this->validator->validate($country, $constraint);
Expand Down
2 changes: 1 addition & 1 deletion Tests/Constraints/CurrencyValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function getValidCurrencies()
public function testInvalidCurrencies($currency)
{
$constraint = new Currency(array(
'message' => 'myMessage'
'message' => 'myMessage',
));

$this->validator->validate($currency, $constraint);
Expand Down
2 changes: 1 addition & 1 deletion Tests/Constraints/DateTimeValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function getValidDateTimes()
public function testInvalidDateTimes($dateTime)
{
$constraint = new DateTime(array(
'message' => 'myMessage'
'message' => 'myMessage',
));

$this->validator->validate($dateTime, $constraint);
Expand Down
Loading

0 comments on commit 6929b2c

Please sign in to comment.