Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[Validator] fixed CS

  • Loading branch information...
commit 47cb86622e0e2ca1f4a167872f5cdb8f17b8402f 1 parent 134d022
@hason hason authored
View
4 Constraint.php
@@ -81,7 +81,7 @@
public function __construct($options = null)
{
$invalidOptions = array();
- $missingOptions = array_flip((array)$this->getRequiredOptions());
+ $missingOptions = array_flip((array) $this->getRequiredOptions());
if (is_array($options) && count($options) == 1 && isset($options['value'])) {
$options = $options['value'];
@@ -127,7 +127,7 @@ public function __construct($options = null)
);
}
- $this->groups = (array)$this->groups;
+ $this->groups = (array) $this->groups;
}
/**
View
2  Constraints/CountryValidator.php
@@ -32,7 +32,7 @@ public function isValid($value, Constraint $constraint)
throw new UnexpectedTypeException($value, 'string');
}
- $value = (string)$value;
+ $value = (string) $value;
if (!in_array($value, \Symfony\Component\Locale\Locale::getCountries())) {
$this->setMessage($constraint->message, array('{{ value }}' => $value));
View
2  Constraints/DateTimeValidator.php
@@ -33,7 +33,7 @@ public function isValid($value, Constraint $constraint)
throw new UnexpectedTypeException($value, 'string');
}
- $value = (string)$value;
+ $value = (string) $value;
if (!preg_match(self::PATTERN, $value, $matches)) {
$this->setMessage($constraint->message, array('{{ value }}' => $value));
View
2  Constraints/DateValidator.php
@@ -29,7 +29,7 @@ public function isValid($value, Constraint $constraint)
throw new UnexpectedTypeException($value, 'string');
}
- $value = (string)$value;
+ $value = (string) $value;
if (!preg_match(self::PATTERN, $value, $matches)) {
$this->setMessage($constraint->message, array('{{ value }}' => $value));
View
2  Constraints/EmailValidator.php
@@ -28,7 +28,7 @@ public function isValid($value, Constraint $constraint)
throw new UnexpectedTypeException($value, 'string');
}
- $value = (string)$value;
+ $value = (string) $value;
if (!filter_var($value, FILTER_VALIDATE_EMAIL)) {
$this->setMessage($constraint->message, array('{{ value }}' => $value));
View
8 Constraints/FileValidator.php
@@ -33,7 +33,7 @@ public function isValid($value, Constraint $constraint)
return true;
}
- $path = $value instanceof FileObject ? $value->getPath() : (string)$value;
+ $path = $value instanceof FileObject ? $value->getPath() : (string) $value;
if (!file_exists($path)) {
$this->setMessage($constraint->notFoundMessage, array('{{ file }}' => $path));
@@ -48,7 +48,7 @@ public function isValid($value, Constraint $constraint)
}
if ($constraint->maxSize) {
- if (ctype_digit((string)$constraint->maxSize)) {
+ if (ctype_digit((string) $constraint->maxSize)) {
$size = filesize($path);
$limit = $constraint->maxSize;
$suffix = ' bytes';
@@ -80,10 +80,10 @@ public function isValid($value, Constraint $constraint)
$value = new FileObject($value);
}
- if (!in_array($value->getMimeType(), (array)$constraint->mimeTypes)) {
+ if (!in_array($value->getMimeType(), (array) $constraint->mimeTypes)) {
$this->setMessage($constraint->mimeTypesMessage, array(
'{{ type }}' => '"'.$value->getMimeType().'"',
- '{{ types }}' => '"'.implode('", "', (array)$constraint->mimeTypes).'"',
+ '{{ types }}' => '"'.implode('", "', (array) $constraint->mimeTypes).'"',
'{{ file }}' => $path,
));
View
2  Constraints/IpValidator.php
@@ -35,7 +35,7 @@ public function isValid($value, Constraint $constraint)
throw new UnexpectedTypeException($value, 'string');
}
- $value = (string)$value;
+ $value = (string) $value;
$valid = false;
if ($constraint->version == Ip::V4 || $constraint->version == Ip::ALL) {
View
2  Constraints/LanguageValidator.php
@@ -32,7 +32,7 @@ public function isValid($value, Constraint $constraint)
throw new UnexpectedTypeException($value, 'string');
}
- $value = (string)$value;
+ $value = (string) $value;
if (!in_array($value, \Symfony\Component\Locale\Locale::getLanguages())) {
$this->setMessage($constraint->message, array('{{ value }}' => $value));
View
2  Constraints/LocaleValidator.php
@@ -32,7 +32,7 @@ public function isValid($value, Constraint $constraint)
throw new UnexpectedTypeException($value, 'string');
}
- $value = (string)$value;
+ $value = (string) $value;
if (!in_array($value, \Symfony\Component\Locale\Locale::getLocales())) {
$this->setMessage($constraint->message, array('{{ value }}' => $value));
View
2  Constraints/MaxLengthValidator.php
@@ -27,7 +27,7 @@ public function isValid($value, Constraint $constraint)
throw new UnexpectedTypeException($value, 'string');
}
- $value = (string)$value;
+ $value = (string) $value;
$length = function_exists('mb_strlen') ? mb_strlen($value, $constraint->charset) : strlen($value);
View
2  Constraints/MinLengthValidator.php
@@ -27,7 +27,7 @@ public function isValid($value, Constraint $constraint)
throw new UnexpectedTypeException($value, 'string');
}
- $value = (string)$value;
+ $value = (string) $value;
$length = function_exists('mb_strlen') ? mb_strlen($value, $constraint->charset) : strlen($value);
View
2  Constraints/RegexValidator.php
@@ -27,7 +27,7 @@ public function isValid($value, Constraint $constraint)
throw new UnexpectedTypeException($value, 'string');
}
- $value = (string)$value;
+ $value = (string) $value;
if (
($constraint->match && !preg_match($constraint->pattern, $value))
View
2  Constraints/TimeValidator.php
@@ -29,7 +29,7 @@ public function isValid($value, Constraint $constraint)
throw new UnexpectedTypeException($value, 'string');
}
- $value = (string)$value;
+ $value = (string) $value;
if (!preg_match(self::PATTERN, $value)) {
$this->setMessage($constraint->message, array('{{ value }}' => $value));
View
2  Constraints/UrlValidator.php
@@ -38,7 +38,7 @@ public function isValid($value, Constraint $constraint)
throw new UnexpectedTypeException($value, 'string');
}
- $value = (string)$value;
+ $value = (string) $value;
$pattern = sprintf(self::PATTERN, implode('|', $constraint->protocols));
View
2  Mapping/ClassMetadata.php
@@ -96,7 +96,7 @@ public function getDefaultGroup()
*/
public function addConstraint(Constraint $constraint)
{
- if (!in_array(Constraint::CLASS_CONSTRAINT, (array)$constraint->getTargets())) {
+ if (!in_array(Constraint::CLASS_CONSTRAINT, (array) $constraint->getTargets())) {
throw new ConstraintDefinitionException(sprintf(
'The constraint %s cannot be put on classes',
get_class($constraint)
View
2  Mapping/Loader/FileLoader.php
@@ -50,7 +50,7 @@ public function __construct($file)
protected function newConstraint($name, $options)
{
if (strpos($name, '\\') !== false && class_exists($name)) {
- $className = (string)$name;
+ $className = (string) $name;
} else if (strpos($name, ':') !== false) {
list($prefix, $className) = explode(':', $name);
View
14 Mapping/Loader/XmlFileLoader.php
@@ -32,11 +32,11 @@ public function loadClassMetadata(ClassMetadata $metadata)
$xml = $this->parseFile($this->file);
foreach ($xml->namespace as $namespace) {
- $this->namespaces[(string)$namespace['prefix']] = trim((string)$namespace);
+ $this->namespaces[(string) $namespace['prefix']] = trim((string) $namespace);
}
foreach ($xml->class as $class) {
- $this->classes[(string)$class['name']] = $class;
+ $this->classes[(string) $class['name']] = $class;
}
}
@@ -49,13 +49,13 @@ public function loadClassMetadata(ClassMetadata $metadata)
foreach ($xml->property as $property) {
foreach ($this->parseConstraints($property->constraint) as $constraint) {
- $metadata->addPropertyConstraint((string)$property['name'], $constraint);
+ $metadata->addPropertyConstraint((string) $property['name'], $constraint);
}
}
foreach ($xml->getter as $getter) {
foreach ($this->parseConstraints($getter->constraint) as $constraint) {
- $metadata->addGetterConstraint((string)$getter['property'], $constraint);
+ $metadata->addGetterConstraint((string) $getter['property'], $constraint);
}
}
@@ -87,7 +87,7 @@ protected function parseConstraints(\SimpleXMLElement $nodes)
} else {
$options = array();
}
- } else if (strlen((string)$node) > 0) {
+ } else if (strlen((string) $node) > 0) {
$options = trim($node);
} else {
$options = null;
@@ -124,7 +124,7 @@ protected function parseValues(\SimpleXMLElement $nodes)
}
if (isset($node['key'])) {
- $values[(string)$node['key']] = $value;
+ $values[(string) $node['key']] = $value;
} else {
$values[] = $value;
}
@@ -157,7 +157,7 @@ protected function parseOptions(\SimpleXMLElement $nodes)
$value = trim($node);
}
- $options[(string)$node['name']] = $value;
+ $options[(string) $node['name']] = $value;
}
return $options;
View
2  Mapping/MemberMetadata.php
@@ -44,7 +44,7 @@ public function __construct($class, $name, $property)
*/
public function addConstraint(Constraint $constraint)
{
- if (!in_array(Constraint::PROPERTY_CONSTRAINT, (array)$constraint->getTargets())) {
+ if (!in_array(Constraint::PROPERTY_CONSTRAINT, (array) $constraint->getTargets())) {
throw new ConstraintDefinitionException(sprintf(
'The constraint %s cannot be put on properties or getters',
get_class($constraint)
View
2  Validator.php
@@ -95,7 +95,7 @@ public function validateValue($value, Constraint $constraint, $groups = null)
protected function validateGraph($root, \Closure $walk, $groups = null)
{
$walker = new GraphWalker($root, $this->metadataFactory, $this->validatorFactory);
- $groups = $groups ? (array)$groups : array(Constraint::DEFAULT_GROUP);
+ $groups = $groups ? (array) $groups : array(Constraint::DEFAULT_GROUP);
foreach ($groups as $group) {
$walk($walker, $group);
Please sign in to comment.
Something went wrong with that request. Please try again.