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:
commit
fec2f031d8
@ -57,7 +57,7 @@ class AnnotationLoader implements LoaderInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach ($reflClass->getProperties() as $property) {
|
foreach ($reflClass->getProperties() as $property) {
|
||||||
if ($property->getDeclaringClass()->name == $className) {
|
if ($property->getDeclaringClass()->name === $className) {
|
||||||
foreach ($this->reader->getPropertyAnnotations($property) as $constraint) {
|
foreach ($this->reader->getPropertyAnnotations($property) as $constraint) {
|
||||||
if ($constraint instanceof Constraint) {
|
if ($constraint instanceof Constraint) {
|
||||||
$metadata->addPropertyConstraint($property->name, $constraint);
|
$metadata->addPropertyConstraint($property->name, $constraint);
|
||||||
@ -69,7 +69,7 @@ class AnnotationLoader implements LoaderInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach ($reflClass->getMethods() as $method) {
|
foreach ($reflClass->getMethods() as $method) {
|
||||||
if ($method->getDeclaringClass()->name == $className) {
|
if ($method->getDeclaringClass()->name === $className) {
|
||||||
foreach ($this->reader->getMethodAnnotations($method) as $constraint) {
|
foreach ($this->reader->getMethodAnnotations($method) as $constraint) {
|
||||||
if ($constraint instanceof Constraint) {
|
if ($constraint instanceof Constraint) {
|
||||||
if (preg_match('/^(get|is)(.+)$/i', $method->name, $matches)) {
|
if (preg_match('/^(get|is)(.+)$/i', $method->name, $matches)) {
|
||||||
|
@ -85,7 +85,7 @@ class YamlFileLoader extends FileLoader
|
|||||||
$values = array();
|
$values = array();
|
||||||
|
|
||||||
foreach ($nodes as $name => $childNodes) {
|
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);
|
$options = current($childNodes);
|
||||||
|
|
||||||
if (is_array($options)) {
|
if (is_array($options)) {
|
||||||
|
Reference in New Issue
Block a user