minor #14188 [Validator] Use strict comparisons in loaders (dunglas)

This PR was merged into the 2.3 branch.

Discussion
----------

[Validator] Use strict comparisons in loaders

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| License       | MIT
| Doc PR       | n/a

Commits
-------

efc1c03 [Validator] Use strict comparisons in loaders
This commit is contained in:
Fabien Potencier 2015-04-04 15:21:13 +02:00
commit fec2f031d8
2 changed files with 3 additions and 3 deletions

View File

@ -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)) {

View File

@ -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)) {