Browse Source

Remove all `is_null` alias calls.

stloyd 14 năm trước cách đây
mục cha
commit
4e03db63d7

+ 1 - 2
src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php

@@ -40,7 +40,7 @@ class DateTimeToArrayTransformer extends BaseDateTimeTransformer
     {
         parent::__construct($inputTimezone, $outputTimezone);
 
-        if (is_null($fields)) {
+        if (null === $fields) {
             $fields = array('year', 'month', 'day', 'hour', 'minute', 'second');
         }
 
@@ -75,7 +75,6 @@ class DateTimeToArrayTransformer extends BaseDateTimeTransformer
             throw new UnexpectedTypeException($dateTime, '\DateTime');
         }
 
-
         if ($this->inputTimezone !== $this->outputTimezone) {
             try {
                 $dateTime->setTimezone(new \DateTimeZone($this->outputTimezone));

+ 2 - 2
src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php

@@ -43,11 +43,11 @@ class DateTimeToLocalizedStringTransformer extends BaseDateTimeTransformer
     {
         parent::__construct($inputTimezone, $outputTimezone);
 
-        if (is_null($dateFormat)) {
+        if (null === $dateFormat) {
             $dateFormat = \IntlDateFormatter::MEDIUM;
         }
 
-        if (is_null($timeFormat)) {
+        if (null === $timeFormat) {
             $timeFormat = \IntlDateFormatter::SHORT;
         }
 

+ 3 - 3
src/Symfony/Component/Form/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformer.php

@@ -26,17 +26,17 @@ class MoneyToLocalizedStringTransformer extends NumberToLocalizedStringTransform
 
     public function __construct($precision = null, $grouping = null, $roundingMode = null, $divisor = null)
     {
-        if (is_null($grouping)) {
+        if (null === $grouping) {
             $grouping = true;
         }
 
-        if (is_null($precision)) {
+        if (null === $precision) {
             $precision = 2;
         }
 
         parent::__construct($precision, $grouping, $roundingMode);
 
-        if (is_null($divisor)) {
+        if (null === $divisor) {
             $divisor = 1;
         }
 

+ 2 - 2
src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php

@@ -40,11 +40,11 @@ class NumberToLocalizedStringTransformer implements DataTransformerInterface
 
     public function __construct($precision = null, $grouping = null, $roundingMode = null)
     {
-        if (is_null($grouping)) {
+        if (null === $grouping) {
             $grouping = false;
         }
 
-        if (is_null($roundingMode)) {
+        if (null === $roundingMode) {
             $roundingMode = self::ROUND_HALFUP;
         }
 

+ 2 - 2
src/Symfony/Component/Form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php

@@ -45,11 +45,11 @@ class PercentToLocalizedStringTransformer implements DataTransformerInterface
      */
     public function __construct($precision = null, $type = null)
     {
-        if (is_null($precision)) {
+        if (null === $precision) {
             $precision = 0;
         }
 
-        if (is_null($type)) {
+        if (null === $type) {
             $type = self::FRACTIONAL;
         }
 

+ 1 - 1
src/Symfony/Component/Form/Extension/Core/DataTransformer/ScalarToBooleanChoicesTransformer.php

@@ -47,7 +47,7 @@ class ScalarToBooleanChoicesTransformer implements DataTransformerInterface
      */
     public function transform($value)
     {
-        if (!is_scalar($value) && !is_null($value)) {
+        if (!is_scalar($value) && null !== $value) {
             throw new UnexpectedTypeException($value, 'scalar');
         }
 

+ 2 - 2
tests/Symfony/Tests/Component/HttpFoundation/RequestTest.php

@@ -474,10 +474,10 @@ class RequestTest extends \PHPUnit_Framework_TestCase
         $this->assertEquals('', $request->getClientIp(true));
 
         $server = array('REMOTE_ADDR' => $remoteAddr);
-        if (!is_null($httpClientIp)) {
+        if (null !== $httpClientIp) {
             $server['HTTP_CLIENT_IP'] = $httpClientIp;
         }
-        if (!is_null($httpForwardedFor)) {
+        if (null !== $httpForwardedFor) {
             $server['HTTP_X_FORWARDED_FOR'] = $httpForwardedFor;
         }