Skip to content

Commit be765af

Browse files
authored
Enhancement: Enable is_null fixer (#193)
* Enhancement: Enable is_null fixer * Fix: Run 'make cs'
1 parent d9b7aae commit be765af

File tree

8 files changed

+10
-9
lines changed

8 files changed

+10
-9
lines changed

.php_cs.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ return $config
6767
],
6868
'implode_call' => true,
6969
'increment_style' => true,
70+
'is_null' => true,
7071
'lambda_not_used_import' => true,
7172
'lowercase_cast' => true,
7273
'lowercase_static_reference' => true,

src/Faker/ORM/CakePHP/EntityPopulator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public function execute($class, $insertedEntities, $options = [])
133133
$entity = $table->newEntity();
134134

135135
foreach ($this->columnFormatters as $column => $format) {
136-
if (!is_null($format)) {
136+
if (null !== $format) {
137137
$entity->{$column} = is_callable($format) ? $format($insertedEntities, $table) : $format;
138138
}
139139
}

src/Faker/Provider/Image.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public static function image(
8888
$word = null,
8989
$gray = false
9090
) {
91-
$dir = is_null($dir) ? sys_get_temp_dir() : $dir; // GNU/Linux / OS X / Windows compatible
91+
$dir = null === $dir ? sys_get_temp_dir() : $dir; // GNU/Linux / OS X / Windows compatible
9292
// Validate directory path
9393
if (!is_dir($dir) || !is_writable($dir)) {
9494
throw new \InvalidArgumentException(sprintf('Cannot write to directory "%s"', $dir));

src/Faker/Provider/Payment.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public static function creditCardType()
161161
*/
162162
public static function creditCardNumber($type = null, $formatted = false, $separator = '-')
163163
{
164-
if (is_null($type)) {
164+
if (null === $type) {
165165
$type = static::creditCardType();
166166
}
167167
$mask = static::randomElement(static::$cardParams[$type]);
@@ -206,7 +206,7 @@ public function creditCardExpirationDate($valid = true)
206206
*/
207207
public function creditCardExpirationDateString($valid = true, $expirationDateFormat = null)
208208
{
209-
return $this->creditCardExpirationDate($valid)->format(is_null($expirationDateFormat) ? static::$expirationDateFormat : $expirationDateFormat);
209+
return $this->creditCardExpirationDate($valid)->format(null === $expirationDateFormat ? static::$expirationDateFormat : $expirationDateFormat);
210210
}
211211

212212
/**
@@ -239,7 +239,7 @@ public function creditCardDetails($valid = true)
239239
*/
240240
public static function iban($countryCode = null, $prefix = '', $length = null)
241241
{
242-
$countryCode = is_null($countryCode) ? self::randomKey(self::$ibanFormats) : strtoupper($countryCode);
242+
$countryCode = null === $countryCode ? self::randomKey(self::$ibanFormats) : strtoupper($countryCode);
243243

244244
$format = !isset(static::$ibanFormats[$countryCode]) ? null : static::$ibanFormats[$countryCode];
245245

src/Faker/Provider/ms_MY/Address.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ public static function postcode($state = null)
658658
]
659659
];
660660

661-
$postcode = is_null($state) ? static::randomElement($format) : $format[$state];
661+
$postcode = null === $state ? static::randomElement($format) : $format[$state];
662662

663663
return (string) static::randomElement($postcode);
664664
}

src/Faker/Provider/ro_RO/Person.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public function cnp($gender = null, $dateOfBirth = null, $county = null, $isResi
127127

128128
$date = $this->getDateOfBirth($dateOfBirth);
129129

130-
if (is_null($county)) {
130+
if (null === $county) {
131131
$countyCode = static::randomElement(array_values(static::$cnpCountyCodes));
132132
} elseif (!array_key_exists($county, static::$cnpCountyCodes)) {
133133
throw new \InvalidArgumentException("Invalid county code '{$county}' received");

src/Faker/ValidGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class ValidGenerator
1919
*/
2020
public function __construct(Generator $generator, $validator = null, $maxRetries = 10000)
2121
{
22-
if (is_null($validator)) {
22+
if (null === $validator) {
2323
$validator = function () {
2424
return true;
2525
};

test/Faker/Provider/pt_PT/PersonTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ private static function isValidTin($tin)
2424
{
2525
$regex = '(([1,2,3,5,6,8]{1}[0-9]{8})|((45)|(70)|(71)|(72)|(77)|(79)|(90|(98|(99))))[0-9]{7})';
2626

27-
if (is_null($tin) || !is_numeric($tin) || !strlen($tin) == 9 || preg_match("/$regex/", $tin) !== 1) {
27+
if (null === $tin || !is_numeric($tin) || !strlen($tin) == 9 || preg_match("/$regex/", $tin) !== 1) {
2828
return false;
2929
}
3030
$n = str_split($tin);

0 commit comments

Comments
 (0)