From efc1c038669487eb2db4281083c28c9c81d105c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Thu, 2 Apr 2015 22:42:16 +0200 Subject: [PATCH] [Validator] Use strict comparisons in loaders --- .../Component/Validator/Mapping/Loader/AnnotationLoader.php | 4 ++-- .../Component/Validator/Mapping/Loader/YamlFileLoader.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Validator/Mapping/Loader/AnnotationLoader.php b/src/Symfony/Component/Validator/Mapping/Loader/AnnotationLoader.php index 6e71b959bd..4703209142 100644 --- a/src/Symfony/Component/Validator/Mapping/Loader/AnnotationLoader.php +++ b/src/Symfony/Component/Validator/Mapping/Loader/AnnotationLoader.php @@ -57,7 +57,7 @@ class AnnotationLoader implements LoaderInterface } foreach ($reflClass->getProperties() as $property) { - if ($property->getDeclaringClass()->name == $className) { + if ($property->getDeclaringClass()->name === $className) { foreach ($this->reader->getPropertyAnnotations($property) as $constraint) { if ($constraint instanceof Constraint) { $metadata->addPropertyConstraint($property->name, $constraint); @@ -69,7 +69,7 @@ class AnnotationLoader implements LoaderInterface } foreach ($reflClass->getMethods() as $method) { - if ($method->getDeclaringClass()->name == $className) { + if ($method->getDeclaringClass()->name === $className) { foreach ($this->reader->getMethodAnnotations($method) as $constraint) { if ($constraint instanceof Constraint) { if (preg_match('/^(get|is)(.+)$/i', $method->name, $matches)) { diff --git a/src/Symfony/Component/Validator/Mapping/Loader/YamlFileLoader.php b/src/Symfony/Component/Validator/Mapping/Loader/YamlFileLoader.php index e293a6eb38..6075b270ba 100644 --- a/src/Symfony/Component/Validator/Mapping/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/Validator/Mapping/Loader/YamlFileLoader.php @@ -85,7 +85,7 @@ class YamlFileLoader extends FileLoader $values = array(); foreach ($nodes as $name => $childNodes) { - if (is_numeric($name) && is_array($childNodes) && count($childNodes) == 1) { + if (is_numeric($name) && is_array($childNodes) && 1 === count($childNodes)) { $options = current($childNodes); if (is_array($options)) {