diff --git a/src/Symfony/Bundle/DoctrineBundle/Command/ConvertDoctrine1SchemaDoctrineCommand.php b/src/Symfony/Bundle/DoctrineBundle/Command/ConvertDoctrine1SchemaDoctrineCommand.php index 73c90478fae5..01aab2479c0d 100644 --- a/src/Symfony/Bundle/DoctrineBundle/Command/ConvertDoctrine1SchemaDoctrineCommand.php +++ b/src/Symfony/Bundle/DoctrineBundle/Command/ConvertDoctrine1SchemaDoctrineCommand.php @@ -72,21 +72,21 @@ protected function execute(InputInterface $input, OutputInterface $output) } $type = $input->getArgument('mapping-type') ? $input->getArgument('mapping-type') : 'xml'; - if ($type === 'annotation') { + if ('annotation' === $type) { $destPath .= '/Entity'; } else { $destPath .= '/Resources/config/doctrine/metadata/orm'; } // adjust so file naming works - if ($type === 'yaml') { + if ('yaml' === $type) { $type = 'yml'; } $cme = new ClassMetadataExporter(); $exporter = $cme->getExporter($type); - if ($type === 'annotation') { + if ('annotation' === $type) { $entityGenerator = $this->getEntityGenerator(); $exporter->setEntityGenerator($entityGenerator); } @@ -99,7 +99,7 @@ protected function execute(InputInterface $input, OutputInterface $output) foreach ($metadata as $class) { $className = $class->name; $class->name = $namespace.'\\'.$bundleClass.'\\Entity\\'.$className; - if ($type === 'annotation') { + if ('annotation' === $type) { $path = $destPath.'/'.$className.'.php'; } else { $path = $destPath.'/'.str_replace('\\', '.', $class->name).'.dcm.'.$type; diff --git a/src/Symfony/Bundle/DoctrineBundle/Command/CreateDatabaseDoctrineCommand.php b/src/Symfony/Bundle/DoctrineBundle/Command/CreateDatabaseDoctrineCommand.php index 74a9c441c199..f67c20687b68 100644 --- a/src/Symfony/Bundle/DoctrineBundle/Command/CreateDatabaseDoctrineCommand.php +++ b/src/Symfony/Bundle/DoctrineBundle/Command/CreateDatabaseDoctrineCommand.php @@ -58,7 +58,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->createDatabaseForConnection($connection, $output); $found = true; } - if ($found === false) { + if (false === $found) { if ($input->getOption('connection')) { throw new \InvalidArgumentException(sprintf('Could not find a connection named %s', $input->getOption('connection'))); } else { diff --git a/src/Symfony/Bundle/DoctrineBundle/Command/DropDatabaseDoctrineCommand.php b/src/Symfony/Bundle/DoctrineBundle/Command/DropDatabaseDoctrineCommand.php index 3be5160d3381..e2f316fee535 100644 --- a/src/Symfony/Bundle/DoctrineBundle/Command/DropDatabaseDoctrineCommand.php +++ b/src/Symfony/Bundle/DoctrineBundle/Command/DropDatabaseDoctrineCommand.php @@ -58,7 +58,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->dropDatabaseForConnection($connection, $output); $found = true; } - if ($found === false) { + if (false === $found) { if ($input->getOption('connection')) { throw new \InvalidArgumentException(sprintf('Could not find a connection named %s', $input->getOption('connection'))); } else { diff --git a/src/Symfony/Bundle/DoctrineBundle/Command/GenerateEntityDoctrineCommand.php b/src/Symfony/Bundle/DoctrineBundle/Command/GenerateEntityDoctrineCommand.php index ab1c341fd275..e90037dfbc9d 100644 --- a/src/Symfony/Bundle/DoctrineBundle/Command/GenerateEntityDoctrineCommand.php +++ b/src/Symfony/Bundle/DoctrineBundle/Command/GenerateEntityDoctrineCommand.php @@ -107,7 +107,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $cme = new ClassMetadataExporter(); $exporter = $cme->getExporter($mappingType); - if ($mappingType === 'annotation') { + if ('annotation' === $mappingType) { $path = $dirs[$namespace].'/'.$bundle.'/Entity/'.str_replace($entityNamespace.'\\', null, $fullEntityClassName).'.php'; $exporter->setEntityGenerator($this->getEntityGenerator()); diff --git a/src/Symfony/Bundle/DoctrineBundle/Command/ImportMappingDoctrineCommand.php b/src/Symfony/Bundle/DoctrineBundle/Command/ImportMappingDoctrineCommand.php index a54846e3a9a7..4c4c9ac084b9 100644 --- a/src/Symfony/Bundle/DoctrineBundle/Command/ImportMappingDoctrineCommand.php +++ b/src/Symfony/Bundle/DoctrineBundle/Command/ImportMappingDoctrineCommand.php @@ -70,19 +70,19 @@ protected function execute(InputInterface $input, OutputInterface $output) } $type = $input->getArgument('mapping-type') ? $input->getArgument('mapping-type') : 'xml'; - if ($type === 'annotation') { + if ('annotation' === $type) { $destPath .= '/Entity'; } else { $destPath .= '/Resources/config/doctrine/metadata/orm'; } - if ($type === 'yaml') { + if ('yaml' === $type) { $type = 'yml'; } $cme = new ClassMetadataExporter(); $exporter = $cme->getExporter($type); - if ($type === 'annotation') { + if ('annotation' === $type) { $entityGenerator = $this->getEntityGenerator(); $exporter->setEntityGenerator($entityGenerator); } @@ -100,7 +100,7 @@ protected function execute(InputInterface $input, OutputInterface $output) foreach ($metadata as $class) { $className = $class->name; $class->name = $namespace.'\\'.$bundleClass.'\\Entity\\'.$className; - if ($type === 'annotation') { + if ('annotation' === $type) { $path = $destPath.'/'.$className.'.php'; } else { $path = $destPath.'/'.str_replace('\\', '.', $class->name).'.dcm.'.$type; diff --git a/src/Symfony/Bundle/DoctrineBundle/DependencyInjection/DoctrineExtension.php b/src/Symfony/Bundle/DoctrineBundle/DependencyInjection/DoctrineExtension.php index a04001fb64b8..2e5b83047ff4 100644 --- a/src/Symfony/Bundle/DoctrineBundle/DependencyInjection/DoctrineExtension.php +++ b/src/Symfony/Bundle/DoctrineBundle/DependencyInjection/DoctrineExtension.php @@ -359,13 +359,13 @@ protected function loadOrmEntityManagerBundlesMappingInformation(array $entityMa $type = $this->detectMetadataDriver($bundleDirs[$namespace].'/'.$class, $container); if (is_dir($dir = $bundleDirs[$namespace].'/'.$class.'/Entity')) { - if ($type === null) { + if (null === $type) { $type = 'annotation'; } $aliasMap[$class] = $namespace.'\\'.$class.'\\Entity'; } - if ($type !== null) { + if (null !== $type) { $mappingDriverDef->addMethodCall('addDriver', array( new Reference(sprintf('doctrine.orm.metadata_driver.%s', $type)), $namespace.'\\'.$class.'\\Entity' @@ -444,7 +444,7 @@ protected function loadOrmEntityManagerResultCacheDriver(array $entityManager, C protected function getEntityManagerCacheDefinition(array $entityManager, $cacheDriver, ContainerBuilder $container) { $type = is_array($cacheDriver) && isset($cacheDriver['type']) ? $cacheDriver['type'] : $cacheDriver; - if ($type === 'memcache') { + if ('memcache' === $type) { $memcacheClass = isset($cacheDriver['class']) ? $cacheDriver['class'] : '%'.sprintf('doctrine.orm.cache.%s_class', $type).'%'; $cacheDef = new Definition($memcacheClass); $memcacheHost = is_array($cacheDriver) && isset($cacheDriver['host']) ? $cacheDriver['host'] : '%doctrine.orm.cache.memcache_host%'; diff --git a/src/Symfony/Bundle/DoctrineBundle/Form/ValueTransformer/CollectionToChoiceTransformer.php b/src/Symfony/Bundle/DoctrineBundle/Form/ValueTransformer/CollectionToChoiceTransformer.php index 6d5215f87435..e4c2b375c4a3 100644 --- a/src/Symfony/Bundle/DoctrineBundle/Form/ValueTransformer/CollectionToChoiceTransformer.php +++ b/src/Symfony/Bundle/DoctrineBundle/Form/ValueTransformer/CollectionToChoiceTransformer.php @@ -47,7 +47,7 @@ public function reverseTransform($ids, $collection) foreach ($collection AS $object) { $key = array_search($reflField->getValue($object), $ids); - if ($key === false) { + if (false === $key) { $collection->removeElement($object); } else { unset($ids[$key]); diff --git a/src/Symfony/Bundle/DoctrineBundle/Form/ValueTransformer/CollectionToStringTransformer.php b/src/Symfony/Bundle/DoctrineBundle/Form/ValueTransformer/CollectionToStringTransformer.php index ed972555054b..4de961979c33 100644 --- a/src/Symfony/Bundle/DoctrineBundle/Form/ValueTransformer/CollectionToStringTransformer.php +++ b/src/Symfony/Bundle/DoctrineBundle/Form/ValueTransformer/CollectionToStringTransformer.php @@ -79,7 +79,7 @@ public function reverseTransform($value, $collection) foreach ($collection as $object) { $uniqueIdent = $reflField->getValue($object); $key = array_search($uniqueIdent, $values); - if ($key === false) { + if (false === $key) { $collection->removeElement($object); } else { // found in the collection, no need to do anything with it so remove it diff --git a/src/Symfony/Bundle/DoctrineMongoDBBundle/DependencyInjection/DoctrineMongoDBExtension.php b/src/Symfony/Bundle/DoctrineMongoDBBundle/DependencyInjection/DoctrineMongoDBExtension.php old mode 100755 new mode 100644 index 3afb12308f12..a2d541c52121 --- a/src/Symfony/Bundle/DoctrineMongoDBBundle/DependencyInjection/DoctrineMongoDBExtension.php +++ b/src/Symfony/Bundle/DoctrineMongoDBBundle/DependencyInjection/DoctrineMongoDBExtension.php @@ -237,13 +237,13 @@ protected function loadDocumentManagerBundlesMappingInformation(array $documentM $type = $this->detectMetadataDriver($bundleDirs[$namespace].'/'.$class, $container); if (is_dir($dir = $bundleDirs[$namespace].'/'.$class.'/Document')) { - if ($type === null) { + if (null === $type) { $type = 'annotation'; } $aliasMap[$class] = $namespace.'\\'.$class.'\\Document'; } - if ($type !== null) { + if (null !== $type) { $mappingDriverDef->addMethodCall('addDriver', array( new Reference(sprintf('doctrine.odm.mongodb.metadata.%s', $type)), $namespace.'\\'.$class.'\\Document' @@ -268,7 +268,7 @@ protected function loadDocumentManagerMetadataCacheDriver(array $documentManager $dmMetadataCacheDriver = isset($documentManager['metadata-cache-driver']) ? $documentManager['metadata-cache-driver'] : (isset($documentManager['metadata_cache_driver']) ? $documentManager['metadata_cache_driver'] : $metadataCacheDriver); $type = is_array($dmMetadataCacheDriver) && isset($dmMetadataCacheDriver['type']) ? $dmMetadataCacheDriver['type'] : $dmMetadataCacheDriver; - if ($type === 'memcache') { + if ('memcache' === $type) { $memcacheClass = isset($dmMetadataCacheDriver['class']) ? $dmMetadataCacheDriver['class'] : sprintf('%%doctrine.odm.mongodb.cache.%s_class%%', $type); $cacheDef = new Definition($memcacheClass); $memcacheHost = isset($dmMetadataCacheDriver['host']) ? $dmMetadataCacheDriver['host'] : '%doctrine.odm.mongodb.cache.memcache_host%'; diff --git a/src/Symfony/Component/CssSelector/Parser.php b/src/Symfony/Component/CssSelector/Parser.php index 6eee9c836eac..fcec03794c84 100644 --- a/src/Symfony/Component/CssSelector/Parser.php +++ b/src/Symfony/Component/CssSelector/Parser.php @@ -107,7 +107,7 @@ protected function parseSelector($stream) while (1) { $peek = $stream->peek(); - if ($peek == ',' || $peek === null) { + if ($peek == ',' || null === $peek) { return $result; } elseif (in_array($peek, array('+', '>', '~'))) { // A combinator diff --git a/src/Symfony/Component/CssSelector/Tokenizer.php b/src/Symfony/Component/CssSelector/Tokenizer.php index 2fac7115d3dd..5808c95b8b43 100644 --- a/src/Symfony/Component/CssSelector/Tokenizer.php +++ b/src/Symfony/Component/CssSelector/Tokenizer.php @@ -75,7 +75,7 @@ public function tokenize($s) continue; } - if ($c === '"' || $c === "'") { + if ('"' === $c || "'" === $c) { // Quoted string $old_pos = $pos; list($sym, $pos) = $this->tokenizeEscapedString($s, $pos); diff --git a/src/Symfony/Component/Finder/Glob.php b/src/Symfony/Component/Finder/Glob.php index 78020c0aef13..22929410a953 100644 --- a/src/Symfony/Component/Finder/Glob.php +++ b/src/Symfony/Component/Finder/Glob.php @@ -52,36 +52,36 @@ static public function toRegex($glob, $strictLeadingDot = true, $strictWildcardS for ($i = 0; $i < $sizeGlob; $i++) { $car = $glob[$i]; if ($firstByte) { - if ($strictLeadingDot && $car !== '.') { + if ($strictLeadingDot && '.' !== $car) { $regex .= '(?=[^\.])'; } $firstByte = false; } - if ($car === '/') { + if ('/' === $car) { $firstByte = true; } - if ($car === '.' || $car === '(' || $car === ')' || $car === '|' || $car === '+' || $car === '^' || $car === '$') { + if ('.' === $car || '(' === $car || ')' === $car || '|' === $car || '+' === $car || '^' === $car || '$' === $car) { $regex .= "\\$car"; - } elseif ($car === '*') { + } elseif ('*' === $car) { $regex .= $escaping ? '\\*' : ($strictWildcardSlash ? '[^/]*' : '.*'); - } elseif ($car === '?') { + } elseif ('?' === $car) { $regex .= $escaping ? '\\?' : ($strictWildcardSlash ? '[^/]' : '.'); - } elseif ($car === '{') { + } elseif ('{' === $car) { $regex .= $escaping ? '\\{' : '('; if (!$escaping) { ++$inCurlies; } - } elseif ($car === '}' && $inCurlies) { + } elseif ('}' === $car && $inCurlies) { $regex .= $escaping ? '}' : ')'; if (!$escaping) { --$inCurlies; } - } elseif ($car === ',' && $inCurlies) { + } elseif (',' === $car && $inCurlies) { $regex .= $escaping ? ',' : '|'; - } elseif ($car === '\\') { + } elseif ('\\' === $car) { if ($escaping) { $regex .= '\\\\'; $escaping = false; diff --git a/src/Symfony/Component/Form/ChoiceField.php b/src/Symfony/Component/Form/ChoiceField.php index b829235674eb..2f021e371c95 100644 --- a/src/Symfony/Component/Form/ChoiceField.php +++ b/src/Symfony/Component/Form/ChoiceField.php @@ -156,7 +156,7 @@ protected function newChoiceField($choice, $label) public function bind($value) { if (!$this->isMultipleChoice() && $this->isExpanded()) { - $value = $value === null ? array() : array($value => true); + $value = null === $value ? array() : array($value => true); } parent::bind($value); diff --git a/src/Symfony/Component/Form/CollectionField.php b/src/Symfony/Component/Form/CollectionField.php index 8f95c8a89978..3621694139c0 100644 --- a/src/Symfony/Component/Form/CollectionField.php +++ b/src/Symfony/Component/Form/CollectionField.php @@ -113,7 +113,7 @@ protected function newField($key, $propertyPath) { $field = clone $this->prototype; $field->setKey($key); - $field->setPropertyPath($propertyPath === null ? null : '['.$propertyPath.']'); + $field->setPropertyPath(null === $propertyPath ? null : '['.$propertyPath.']'); return $field; } } \ No newline at end of file diff --git a/src/Symfony/Component/Form/DateField.php b/src/Symfony/Component/Form/DateField.php index 56212c9d3938..b13648375447 100644 --- a/src/Symfony/Component/Form/DateField.php +++ b/src/Symfony/Component/Form/DateField.php @@ -243,7 +243,7 @@ public function isYearWithinRange() { $date = $this->getNormalizedData(); - return $date === null || in_array($date->format('Y'), $this->getOption('years')); + return null === $date || in_array($date->format('Y'), $this->getOption('years')); } /** @@ -258,7 +258,7 @@ public function isMonthWithinRange() { $date = $this->getNormalizedData(); - return $date === null || in_array($date->format('m'), $this->getOption('months')); + return null === $date || in_array($date->format('m'), $this->getOption('months')); } /** @@ -273,6 +273,6 @@ public function isDayWithinRange() { $date = $this->getNormalizedData(); - return $date === null || in_array($date->format('d'), $this->getOption('days')); + return null === $date || in_array($date->format('d'), $this->getOption('days')); } } \ No newline at end of file diff --git a/src/Symfony/Component/Form/Field.php b/src/Symfony/Component/Form/Field.php index 2cec283c262b..f535ebd32d45 100644 --- a/src/Symfony/Component/Form/Field.php +++ b/src/Symfony/Component/Form/Field.php @@ -127,7 +127,7 @@ protected function getTransformedData() */ public function setPropertyPath($propertyPath) { - $this->propertyPath = $propertyPath === null || $propertyPath === '' ? null : new PropertyPath($propertyPath); + $this->propertyPath = null === $propertyPath || '' === $propertyPath ? null : new PropertyPath($propertyPath); } /** @@ -458,7 +458,7 @@ protected function denormalize($value) protected function transform($value) { if (null === $this->valueTransformer) { - return $value === null ? '' : $value; + return null === $value ? '' : $value; } return $this->valueTransformer->transform($value); } @@ -472,7 +472,7 @@ protected function transform($value) protected function reverseTransform($value) { if (null === $this->valueTransformer) { - return $value === '' ? null : $value; + return '' === $value ? null : $value; } return $this->valueTransformer->reverseTransform($value, $this->data); } diff --git a/src/Symfony/Component/Form/FieldGroup.php b/src/Symfony/Component/Form/FieldGroup.php index 1e5343b728b0..cf63f88b5e84 100644 --- a/src/Symfony/Component/Form/FieldGroup.php +++ b/src/Symfony/Component/Form/FieldGroup.php @@ -267,7 +267,7 @@ public function getDisplayedData() */ public function bind($taintedData) { - if ($taintedData === null) { + if (null === $taintedData) { $taintedData = array(); } @@ -393,7 +393,7 @@ public function isValid() */ public function addError(FieldError $error, PropertyPathIterator $pathIterator = null, $type = null) { - if ($pathIterator !== null) { + if (null !== $pathIterator) { if ($type === self::FIELD_ERROR && $pathIterator->hasNext()) { $pathIterator->next(); diff --git a/src/Symfony/Component/Form/Form.php b/src/Symfony/Component/Form/Form.php index 5781d4096d5d..f8f209087a8a 100644 --- a/src/Symfony/Component/Form/Form.php +++ b/src/Symfony/Component/Form/Form.php @@ -49,7 +49,7 @@ public function __construct($name, $data = null, ValidatorInterface $validator = $this->validator = $validator; // Prefill the form with the given data - if ($data !== null) { + if (null !== $data) { $this->setData($data); } @@ -61,7 +61,7 @@ public function __construct($name, $data = null, ValidatorInterface $validator = // If data is passed to this constructor, objects from parent forms // should be ignored - if ($data !== null) { + if (null !== $data) { $this->setPropertyPath(null); } } @@ -73,7 +73,7 @@ public function __construct($name, $data = null, ValidatorInterface $validator = */ public function setValidationGroups($validationGroups) { - $this->validationGroups = $validationGroups === null ? $validationGroups : (array) $validationGroups; + $this->validationGroups = null === $validationGroups ? $validationGroups : (array) $validationGroups; } /** @@ -100,7 +100,7 @@ public function getValidationGroups() */ final public function bind($taintedValues, array $taintedFiles = null) { - if ($taintedFiles === null) { + if (null === $taintedFiles) { if ($this->isMultipart() && $this->getParent() === null) { throw new \InvalidArgumentException('You must provide a files array for multipart forms'); } @@ -182,11 +182,11 @@ public function isCsrfProtected() public function enableCsrfProtection($csrfFieldName = null, $csrfSecret = null) { if (!$this->isCsrfProtected()) { - if ($csrfFieldName === null) { + if (null === $csrfFieldName) { $csrfFieldName = FormConfiguration::getDefaultCsrfFieldName(); } - if ($csrfSecret === null) { + if (null === $csrfSecret) { if (FormConfiguration::getDefaultCsrfSecret() !== null) { $csrfSecret = FormConfiguration::getDefaultCsrfSecret(); } else { diff --git a/src/Symfony/Component/Form/PropertyPath.php b/src/Symfony/Component/Form/PropertyPath.php index e47d389c0418..3eeecfa0a9c4 100644 --- a/src/Symfony/Component/Form/PropertyPath.php +++ b/src/Symfony/Component/Form/PropertyPath.php @@ -54,7 +54,7 @@ class PropertyPath implements \IteratorAggregate */ public function __construct($propertyPath) { - if ($propertyPath === '' || $propertyPath === null) { + if ('' === $propertyPath || null === $propertyPath) { throw new InvalidPropertyPathException('The property path must not be empty'); } diff --git a/src/Symfony/Component/Form/TimeField.php b/src/Symfony/Component/Form/TimeField.php index 52b484d55843..c91d30bd82e7 100644 --- a/src/Symfony/Component/Form/TimeField.php +++ b/src/Symfony/Component/Form/TimeField.php @@ -160,7 +160,7 @@ public function isHourWithinRange() { $date = $this->getNormalizedData(); - return $date === null || in_array($date->format('H'), $this->getOption('hours')); + return null === $date || in_array($date->format('H'), $this->getOption('hours')); } /** @@ -175,7 +175,7 @@ public function isMinuteWithinRange() { $date = $this->getNormalizedData(); - return $date === null || in_array($date->format('i'), $this->getOption('minutes')); + return null === $date || in_array($date->format('i'), $this->getOption('minutes')); } /** @@ -190,6 +190,6 @@ public function isSecondWithinRange() { $date = $this->getNormalizedData(); - return $date === null || in_array($date->format('s'), $this->getOption('seconds')); + return null === $date || in_array($date->format('s'), $this->getOption('seconds')); } } diff --git a/src/Symfony/Component/Form/ValueTransformer/BooleanToStringTransformer.php b/src/Symfony/Component/Form/ValueTransformer/BooleanToStringTransformer.php index 10dfeb87ea95..34408bed5122 100644 --- a/src/Symfony/Component/Form/ValueTransformer/BooleanToStringTransformer.php +++ b/src/Symfony/Component/Form/ValueTransformer/BooleanToStringTransformer.php @@ -27,7 +27,7 @@ class BooleanToStringTransformer extends BaseValueTransformer */ public function transform($value) { - if ($value === null) { + if (null === $value) { return ''; } @@ -50,7 +50,7 @@ public function reverseTransform($value, $originalValue) throw new \InvalidArgumentException(sprintf('Expected argument of type string but got %s.', gettype($value))); } - return $value !== ''; + return '' !== $value; } } \ No newline at end of file diff --git a/src/Symfony/Component/Form/ValueTransformer/DateTimeToArrayTransformer.php b/src/Symfony/Component/Form/ValueTransformer/DateTimeToArrayTransformer.php index 482ded73d3c1..01293f4616b3 100644 --- a/src/Symfony/Component/Form/ValueTransformer/DateTimeToArrayTransformer.php +++ b/src/Symfony/Component/Form/ValueTransformer/DateTimeToArrayTransformer.php @@ -49,7 +49,7 @@ protected function configure() */ public function transform($dateTime) { - if ($dateTime === null) { + if (null === $dateTime) { return array( 'year' => '', 'month' => '', @@ -98,7 +98,7 @@ public function transform($dateTime) */ public function reverseTransform($value, $originalValue) { - if ($value === null) { + if (null === $value) { return null; } diff --git a/src/Symfony/Component/Form/ValueTransformer/DateTimeToLocalizedStringTransformer.php b/src/Symfony/Component/Form/ValueTransformer/DateTimeToLocalizedStringTransformer.php index a6ac24dae6e1..1e44d6b57779 100644 --- a/src/Symfony/Component/Form/ValueTransformer/DateTimeToLocalizedStringTransformer.php +++ b/src/Symfony/Component/Form/ValueTransformer/DateTimeToLocalizedStringTransformer.php @@ -57,7 +57,7 @@ protected function configure() */ public function transform($dateTime) { - if ($dateTime === null) { + if (null === $dateTime) { return ''; } @@ -95,7 +95,7 @@ public function reverseTransform($value, $originalValue) throw new \InvalidArgumentException(sprintf('Expected argument of type string, %s given', gettype($value))); } - if ($value === '') { + if ('' === $value) { return null; } diff --git a/src/Symfony/Component/Form/ValueTransformer/DateTimeToStringTransformer.php b/src/Symfony/Component/Form/ValueTransformer/DateTimeToStringTransformer.php index 7cdf61c69f9b..6fe6bdab81f7 100644 --- a/src/Symfony/Component/Form/ValueTransformer/DateTimeToStringTransformer.php +++ b/src/Symfony/Component/Form/ValueTransformer/DateTimeToStringTransformer.php @@ -42,7 +42,7 @@ protected function configure() */ public function transform($value) { - if ($value === null) { + if (null === $value) { return ''; } @@ -63,7 +63,7 @@ public function transform($value) */ public function reverseTransform($value, $originalValue) { - if ($value === '') { + if ('' === $value) { return null; } diff --git a/src/Symfony/Component/Form/ValueTransformer/DateTimeToTimestampTransformer.php b/src/Symfony/Component/Form/ValueTransformer/DateTimeToTimestampTransformer.php index 53f828b2768a..4a3ab4793211 100644 --- a/src/Symfony/Component/Form/ValueTransformer/DateTimeToTimestampTransformer.php +++ b/src/Symfony/Component/Form/ValueTransformer/DateTimeToTimestampTransformer.php @@ -40,7 +40,7 @@ protected function configure() */ public function transform($value) { - if ($value === null) { + if (null === $value) { return null; } @@ -61,7 +61,7 @@ public function transform($value) */ public function reverseTransform($value, $originalValue) { - if ($value === null) { + if (null === $value) { return null; } diff --git a/src/Symfony/Component/Form/ValueTransformer/MoneyToLocalizedStringTransformer.php b/src/Symfony/Component/Form/ValueTransformer/MoneyToLocalizedStringTransformer.php index f614132d63fc..be3b8c0f78a4 100644 --- a/src/Symfony/Component/Form/ValueTransformer/MoneyToLocalizedStringTransformer.php +++ b/src/Symfony/Component/Form/ValueTransformer/MoneyToLocalizedStringTransformer.php @@ -41,7 +41,7 @@ protected function configure() */ public function transform($value) { - if ($value !== null) { + if (null !== $value) { if (!is_numeric($value)) { throw new \InvalidArgumentException(sprintf('Numeric argument expected, %s given', gettype($value))); } @@ -62,7 +62,7 @@ public function reverseTransform($value, $originalValue) { $value = parent::reverseTransform($value, $originalValue); - if ($value !== null) { + if (null !== $value) { $value *= $this->getOption('divisor'); } diff --git a/src/Symfony/Component/Form/ValueTransformer/NumberToLocalizedStringTransformer.php b/src/Symfony/Component/Form/ValueTransformer/NumberToLocalizedStringTransformer.php index cd631e5a436e..9b78819248fe 100644 --- a/src/Symfony/Component/Form/ValueTransformer/NumberToLocalizedStringTransformer.php +++ b/src/Symfony/Component/Form/ValueTransformer/NumberToLocalizedStringTransformer.php @@ -50,7 +50,7 @@ protected function configure() */ public function transform($value) { - if ($value === null) { + if (null === $value) { return ''; } @@ -79,7 +79,7 @@ public function reverseTransform($value, $originalValue) throw new \InvalidArgumentException(sprintf('Expected argument of type string, %s given', gettype($value))); } - if ($value === '') { + if ('' === $value) { return null; } diff --git a/src/Symfony/Component/Form/ValueTransformer/PercentToLocalizedStringTransformer.php b/src/Symfony/Component/Form/ValueTransformer/PercentToLocalizedStringTransformer.php index 877e0e37d84a..79512c5b52fe 100644 --- a/src/Symfony/Component/Form/ValueTransformer/PercentToLocalizedStringTransformer.php +++ b/src/Symfony/Component/Form/ValueTransformer/PercentToLocalizedStringTransformer.php @@ -52,7 +52,7 @@ protected function configure() */ public function transform($value) { - if ($value === null) { + if (null === $value) { return ''; } @@ -87,7 +87,7 @@ public function reverseTransform($value, $originalValue) throw new \InvalidArgumentException(sprintf('Expected argument of type string, %s given', gettype($value))); } - if ($value === '') { + if ('' === $value) { return null; } diff --git a/src/Symfony/Component/Locale/Locale.php b/src/Symfony/Component/Locale/Locale.php index c41a13b1cd7d..ecf3883aca01 100644 --- a/src/Symfony/Component/Locale/Locale.php +++ b/src/Symfony/Component/Locale/Locale.php @@ -37,7 +37,7 @@ public static function getDisplayCountries($locale) if (!isset(self::$countries[$locale])) { $bundle = new \ResourceBundle($locale, __DIR__.'/Resources/data/region'); - if ($bundle === null) { + if (null === $bundle) { throw new \RuntimeException('The country resource bundle could not be loaded'); } @@ -48,7 +48,7 @@ public static function getDisplayCountries($locale) // Global countries (f.i. "America") have numeric codes // Countries have alphabetic codes // "ZZ" is the code for unknown country - if (ctype_alpha($code) && $code !== 'ZZ') { + if (ctype_alpha($code) && 'ZZ' !== $code) { $countries[$code] = $name; } } @@ -84,7 +84,7 @@ public static function getDisplayLanguages($locale) if (!isset(self::$languages[$locale])) { $bundle = new \ResourceBundle($locale, __DIR__.'/Resources/data/lang'); - if ($bundle === null) { + if (null === $bundle) { throw new \RuntimeException('The language resource bundle could not be loaded'); } @@ -93,7 +93,7 @@ public static function getDisplayLanguages($locale) foreach ($bundle->get('Languages') as $code => $name) { // "mul" is the code for multiple languages - if ($code !== 'mul') { + if ('mul' !== $code) { $languages[$code] = $name; } } diff --git a/src/Symfony/Component/Process/Process.php b/src/Symfony/Component/Process/Process.php index 40b86b89b5d5..b64b03fdbc6e 100644 --- a/src/Symfony/Component/Process/Process.php +++ b/src/Symfony/Component/Process/Process.php @@ -115,7 +115,7 @@ public function run($callback = null) $n = @stream_select($r, $w, $e, $this->timeout); - if ($n === false) { + if (false === $n) { break; } elseif ($n === 0) { proc_terminate($process); diff --git a/src/Symfony/Component/Translation/Loader/ArrayLoader.php b/src/Symfony/Component/Translation/Loader/ArrayLoader.php index 37ecd252091b..272d3c9cfa86 100644 --- a/src/Symfony/Component/Translation/Loader/ArrayLoader.php +++ b/src/Symfony/Component/Translation/Loader/ArrayLoader.php @@ -48,17 +48,17 @@ public function load($resource, $locale, $domain = 'messages') */ protected function flatten(array &$messages, array $subnode = null, $path = null) { - if ($subnode === null) { + if (null === $subnode) { $subnode =& $messages; } foreach ($subnode as $key => $value) { if (is_array($value)) { $nodePath = $path ? $path.'.'.$key : $key; $this->flatten($messages, $value, $nodePath); - if ($path === null) { + if (null === $path) { unset($messages[$key]); } - } elseif ($path !== null) { + } elseif (null !== $path) { $messages[$path.'.'.$key] = $value; } } diff --git a/src/Symfony/Component/Validator/Constraint.php b/src/Symfony/Component/Validator/Constraint.php index c7efec8d21b0..ebb145d24f46 100644 --- a/src/Symfony/Component/Validator/Constraint.php +++ b/src/Symfony/Component/Validator/Constraint.php @@ -77,7 +77,7 @@ public function __construct($options = null) $invalidOptions[] = $option; } } - } else if ($options !== null && ! (is_array($options) && count($options) === 0)) { + } else if (null !== $options && ! (is_array($options) && count($options) === 0)) { $option = $this->defaultOption(); if (null === $option) { diff --git a/src/Symfony/Component/Validator/Constraints/AllValidator.php b/src/Symfony/Component/Validator/Constraints/AllValidator.php index 89ebd67c94ee..f29ef5a472c2 100644 --- a/src/Symfony/Component/Validator/Constraints/AllValidator.php +++ b/src/Symfony/Component/Validator/Constraints/AllValidator.php @@ -19,7 +19,7 @@ class AllValidator extends ConstraintValidator { public function isValid($value, Constraint $constraint) { - if ($value === null) { + if (null === $value) { return true; } diff --git a/src/Symfony/Component/Validator/Constraints/AssertFalseValidator.php b/src/Symfony/Component/Validator/Constraints/AssertFalseValidator.php index b5cd9f01f0fe..5a94fba7b6f2 100644 --- a/src/Symfony/Component/Validator/Constraints/AssertFalseValidator.php +++ b/src/Symfony/Component/Validator/Constraints/AssertFalseValidator.php @@ -18,7 +18,7 @@ class AssertFalseValidator extends ConstraintValidator { public function isValid($value, Constraint $constraint) { - if ($value === null) { + if (null === $value) { return true; } diff --git a/src/Symfony/Component/Validator/Constraints/AssertTrueValidator.php b/src/Symfony/Component/Validator/Constraints/AssertTrueValidator.php index 8bdca310e880..71ac282c162a 100644 --- a/src/Symfony/Component/Validator/Constraints/AssertTrueValidator.php +++ b/src/Symfony/Component/Validator/Constraints/AssertTrueValidator.php @@ -18,7 +18,7 @@ class AssertTrueValidator extends ConstraintValidator { public function isValid($value, Constraint $constraint) { - if ($value === null) { + if (null === $value) { return true; } diff --git a/src/Symfony/Component/Validator/Constraints/AssertTypeValidator.php b/src/Symfony/Component/Validator/Constraints/AssertTypeValidator.php index c91ff1797411..c2ca4a8167be 100644 --- a/src/Symfony/Component/Validator/Constraints/AssertTypeValidator.php +++ b/src/Symfony/Component/Validator/Constraints/AssertTypeValidator.php @@ -18,7 +18,7 @@ class AssertTypeValidator extends ConstraintValidator { public function isValid($value, Constraint $constraint) { - if ($value === null) { + if (null === $value) { return true; } diff --git a/src/Symfony/Component/Validator/Constraints/BlankValidator.php b/src/Symfony/Component/Validator/Constraints/BlankValidator.php index c578fa2958d8..3c45110e7eb7 100644 --- a/src/Symfony/Component/Validator/Constraints/BlankValidator.php +++ b/src/Symfony/Component/Validator/Constraints/BlankValidator.php @@ -18,7 +18,7 @@ class BlankValidator extends ConstraintValidator { public function isValid($value, Constraint $constraint) { - if ($value !== '' && $value !== null) { + if ('' !== $value && null !== $value) { $this->setMessage($constraint->message, array('{{ value }}' => $value)); return false; diff --git a/src/Symfony/Component/Validator/Constraints/ChoiceValidator.php b/src/Symfony/Component/Validator/Constraints/ChoiceValidator.php index 1d8e0458e37d..d2e62771bbee 100644 --- a/src/Symfony/Component/Validator/Constraints/ChoiceValidator.php +++ b/src/Symfony/Component/Validator/Constraints/ChoiceValidator.php @@ -31,7 +31,7 @@ public function isValid($value, Constraint $constraint) throw new ConstraintDefinitionException('Either "choices" or "callback" must be specified on constraint Choice'); } - if ($value === null) { + if (null === $value) { return true; } diff --git a/src/Symfony/Component/Validator/Constraints/CollectionValidator.php b/src/Symfony/Component/Validator/Constraints/CollectionValidator.php index 9f00f7232617..192f95927fe7 100644 --- a/src/Symfony/Component/Validator/Constraints/CollectionValidator.php +++ b/src/Symfony/Component/Validator/Constraints/CollectionValidator.php @@ -20,7 +20,7 @@ class CollectionValidator extends ConstraintValidator { public function isValid($value, Constraint $constraint) { - if ($value === null) { + if (null === $value) { return true; } diff --git a/src/Symfony/Component/Validator/Constraints/CountryValidator.php b/src/Symfony/Component/Validator/Constraints/CountryValidator.php index ae61bf0b34e0..a6be24216e8d 100644 --- a/src/Symfony/Component/Validator/Constraints/CountryValidator.php +++ b/src/Symfony/Component/Validator/Constraints/CountryValidator.php @@ -25,7 +25,7 @@ class CountryValidator extends ConstraintValidator { public function isValid($value, Constraint $constraint) { - if ($value === null || $value === '') { + if (null === $value || '' === $value) { return true; } diff --git a/src/Symfony/Component/Validator/Constraints/DateTimeValidator.php b/src/Symfony/Component/Validator/Constraints/DateTimeValidator.php index 7144d2cff894..87530e70c431 100644 --- a/src/Symfony/Component/Validator/Constraints/DateTimeValidator.php +++ b/src/Symfony/Component/Validator/Constraints/DateTimeValidator.php @@ -21,7 +21,7 @@ class DateTimeValidator extends ConstraintValidator public function isValid($value, Constraint $constraint) { - if ($value === null || $value === '') { + if (null === $value || '' === $value) { return true; } diff --git a/src/Symfony/Component/Validator/Constraints/DateValidator.php b/src/Symfony/Component/Validator/Constraints/DateValidator.php index f9b4d889448b..f1af81f304b3 100644 --- a/src/Symfony/Component/Validator/Constraints/DateValidator.php +++ b/src/Symfony/Component/Validator/Constraints/DateValidator.php @@ -21,7 +21,7 @@ class DateValidator extends ConstraintValidator public function isValid($value, Constraint $constraint) { - if ($value === null || $value === '') { + if (null === $value || '' === $value) { return true; } diff --git a/src/Symfony/Component/Validator/Constraints/EmailValidator.php b/src/Symfony/Component/Validator/Constraints/EmailValidator.php index 85c98beacc18..b25aa2299adf 100644 --- a/src/Symfony/Component/Validator/Constraints/EmailValidator.php +++ b/src/Symfony/Component/Validator/Constraints/EmailValidator.php @@ -21,7 +21,7 @@ class EmailValidator extends ConstraintValidator public function isValid($value, Constraint $constraint) { - if ($value === null || $value === '') { + if (null === $value || '' === $value) { return true; } diff --git a/src/Symfony/Component/Validator/Constraints/FileValidator.php b/src/Symfony/Component/Validator/Constraints/FileValidator.php index e369984be474..b76fe5dd7454 100644 --- a/src/Symfony/Component/Validator/Constraints/FileValidator.php +++ b/src/Symfony/Component/Validator/Constraints/FileValidator.php @@ -21,7 +21,7 @@ class FileValidator extends ConstraintValidator { public function isValid($value, Constraint $constraint) { - if ($value === null || $value === '') { + if (null === $value || '' === $value) { return true; } diff --git a/src/Symfony/Component/Validator/Constraints/LanguageValidator.php b/src/Symfony/Component/Validator/Constraints/LanguageValidator.php index bc649c7cb169..7cc35b461f4c 100644 --- a/src/Symfony/Component/Validator/Constraints/LanguageValidator.php +++ b/src/Symfony/Component/Validator/Constraints/LanguageValidator.php @@ -25,7 +25,7 @@ class LanguageValidator extends ConstraintValidator { public function isValid($value, Constraint $constraint) { - if ($value === null || $value === '') { + if (null === $value || '' === $value) { return true; } diff --git a/src/Symfony/Component/Validator/Constraints/MaxLengthValidator.php b/src/Symfony/Component/Validator/Constraints/MaxLengthValidator.php index e428676db4f9..89852f8f89c8 100644 --- a/src/Symfony/Component/Validator/Constraints/MaxLengthValidator.php +++ b/src/Symfony/Component/Validator/Constraints/MaxLengthValidator.php @@ -19,7 +19,7 @@ class MaxLengthValidator extends ConstraintValidator { public function isValid($value, Constraint $constraint) { - if ($value === null || $value === '') { + if (null === $value || '' === $value) { return true; } diff --git a/src/Symfony/Component/Validator/Constraints/MaxValidator.php b/src/Symfony/Component/Validator/Constraints/MaxValidator.php index 0c739bf21418..40f13bc0d1fc 100644 --- a/src/Symfony/Component/Validator/Constraints/MaxValidator.php +++ b/src/Symfony/Component/Validator/Constraints/MaxValidator.php @@ -19,7 +19,7 @@ class MaxValidator extends ConstraintValidator { public function isValid($value, Constraint $constraint) { - if ($value === null) { + if (null === $value) { return true; } diff --git a/src/Symfony/Component/Validator/Constraints/MinLengthValidator.php b/src/Symfony/Component/Validator/Constraints/MinLengthValidator.php index c0eeeeeabacf..0c32087301d1 100644 --- a/src/Symfony/Component/Validator/Constraints/MinLengthValidator.php +++ b/src/Symfony/Component/Validator/Constraints/MinLengthValidator.php @@ -19,7 +19,7 @@ class MinLengthValidator extends ConstraintValidator { public function isValid($value, Constraint $constraint) { - if ($value === null || $value === '') { + if (null === $value || '' === $value) { return true; } diff --git a/src/Symfony/Component/Validator/Constraints/MinValidator.php b/src/Symfony/Component/Validator/Constraints/MinValidator.php index fbae35be7e24..f41340f99e7d 100644 --- a/src/Symfony/Component/Validator/Constraints/MinValidator.php +++ b/src/Symfony/Component/Validator/Constraints/MinValidator.php @@ -19,7 +19,7 @@ class MinValidator extends ConstraintValidator { public function isValid($value, Constraint $constraint) { - if ($value === null) { + if (null === $value) { return true; } diff --git a/src/Symfony/Component/Validator/Constraints/NotBlankValidator.php b/src/Symfony/Component/Validator/Constraints/NotBlankValidator.php index f7abe30f4208..41f0fd5f763c 100644 --- a/src/Symfony/Component/Validator/Constraints/NotBlankValidator.php +++ b/src/Symfony/Component/Validator/Constraints/NotBlankValidator.php @@ -18,7 +18,7 @@ class NotBlankValidator extends ConstraintValidator { public function isValid($value, Constraint $constraint) { - if ($value === '' || $value === null) { + if (null === $value || '' === $value) { $this->setMessage($constraint->message); return false; diff --git a/src/Symfony/Component/Validator/Constraints/RegexValidator.php b/src/Symfony/Component/Validator/Constraints/RegexValidator.php index 3e58dfd09d8d..6455f911f7a7 100644 --- a/src/Symfony/Component/Validator/Constraints/RegexValidator.php +++ b/src/Symfony/Component/Validator/Constraints/RegexValidator.php @@ -19,7 +19,7 @@ class RegexValidator extends ConstraintValidator { public function isValid($value, Constraint $constraint) { - if ($value === null || $value === '') { + if (null === $value || '' === $value) { return true; } diff --git a/src/Symfony/Component/Validator/Constraints/TimeValidator.php b/src/Symfony/Component/Validator/Constraints/TimeValidator.php index c0724c197e0f..5d20e2d6a0e4 100644 --- a/src/Symfony/Component/Validator/Constraints/TimeValidator.php +++ b/src/Symfony/Component/Validator/Constraints/TimeValidator.php @@ -21,7 +21,7 @@ class TimeValidator extends ConstraintValidator public function isValid($value, Constraint $constraint) { - if ($value === null || $value === '') { + if (null === $value || '' === $value) { return true; } diff --git a/src/Symfony/Component/Validator/Constraints/UrlValidator.php b/src/Symfony/Component/Validator/Constraints/UrlValidator.php old mode 100755 new mode 100644 index 11fa67ab8f6e..d0ffc558a5fb --- a/src/Symfony/Component/Validator/Constraints/UrlValidator.php +++ b/src/Symfony/Component/Validator/Constraints/UrlValidator.php @@ -30,7 +30,7 @@ class UrlValidator extends ConstraintValidator public function isValid($value, Constraint $constraint) { - if ($value === null || $value === '') { + if (null === $value || '' === $value) { return true; } diff --git a/src/Symfony/Component/Validator/Constraints/Valid.php b/src/Symfony/Component/Validator/Constraints/Valid.php index 2d9f36bc07da..0ea746f69271 100644 --- a/src/Symfony/Component/Validator/Constraints/Valid.php +++ b/src/Symfony/Component/Validator/Constraints/Valid.php @@ -24,7 +24,7 @@ class Valid extends \Symfony\Component\Validator\Constraint */ public function __construct($options = null) { - if ($options !== null && count($options) > 0) { + if (null !== $options && count($options) > 0) { throw new ConstraintDefinitionException('The constraint Valid does not accept any options'); } } diff --git a/src/Symfony/Component/Validator/GraphWalker.php b/src/Symfony/Component/Validator/GraphWalker.php index f1fcaf7532fd..4eedef680360 100644 --- a/src/Symfony/Component/Validator/GraphWalker.php +++ b/src/Symfony/Component/Validator/GraphWalker.php @@ -62,7 +62,7 @@ protected function walkClassForGroup(ClassMetadata $metadata, $object, $group, $ $this->walkConstraint($constraint, $object, $group, $propertyPath); } - if ($object !== null) { + if (null !== $object) { foreach ($metadata->getConstrainedProperties() as $property) { $localPropertyPath = empty($propertyPath) ? $property : $propertyPath.'.'.$property;