Skip to content

Commit

Permalink
Fix: Run 'make cs'
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed Sep 2, 2023
1 parent c4099c3 commit 7b3bb63
Show file tree
Hide file tree
Showing 15 changed files with 17 additions and 18 deletions.
2 changes: 2 additions & 0 deletions src/Faker/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,12 @@ protected static function getProviderClassname($provider, $locale = '')
if ($providerClass = self::findProviderClassname($provider, $locale)) {
return $providerClass;
}

// fallback to default locale
if ($providerClass = self::findProviderClassname($provider, static::DEFAULT_LOCALE)) {
return $providerClass;
}

// fallback to no locale
if ($providerClass = self::findProviderClassname($provider)) {
return $providerClass;
Expand Down
1 change: 1 addition & 0 deletions src/Faker/Provider/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,7 @@ public static function regexify($regex = '')
// remove backslashes (that are not followed by another backslash) because they are escape characters
$match = preg_replace('/\\\(?!\\\)/', '', $matches[1]);
$randomElement = Base::randomElement(str_split($match));

//[.] should not be a random character, but a literal .
return str_replace('.', '\.', $randomElement);
}, $regex);
Expand Down
1 change: 1 addition & 0 deletions src/Faker/Provider/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ public static function image(
);

$dir = null === $dir ? sys_get_temp_dir() : $dir; // GNU/Linux / OS X / Windows compatible

// Validate directory path
if (!is_dir($dir) || !is_writable($dir)) {
throw new \InvalidArgumentException(sprintf('Cannot write to directory "%s"', $dir));
Expand Down
1 change: 1 addition & 0 deletions src/Faker/Provider/cs_CZ/Person.php
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ public function birthNumber($gender = null, $minAge = 0, $maxAge = 100, $slashPr
if ($gender == static::GENDER_FEMALE) {
$month += 50;
}

// from year 2004 everyone has +20 to month when birth numbers in one day are exhausted
if ($year >= 2004 && $this->generator->boolean(10)) {
$month += 20;
Expand Down
5 changes: 2 additions & 3 deletions src/Faker/Provider/en_ZA/Person.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,8 @@ class Person extends \Faker\Provider\Person
/**
* @see https://en.wikipedia.org/wiki/National_identification_number#South_Africa
*
* @param \DateTime $birthdate
* @param bool $citizen
* @param string $gender
* @param bool $citizen
* @param string $gender
*
* @return string
*/
Expand Down
3 changes: 1 addition & 2 deletions src/Faker/Provider/fi_FI/Person.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ class Person extends \Faker\Provider\Person
*
* @see http://www.finlex.fi/fi/laki/ajantasa/2010/20100128
*
* @param \DateTime $birthdate
* @param string $gender Person::GENDER_MALE || Person::GENDER_FEMALE
* @param string $gender Person::GENDER_MALE || Person::GENDER_FEMALE
*
* @return string on format DDMMYYCZZZQ, where DDMMYY is the date of birth, C the century sign, ZZZ the individual number and Q the control character (checksum)
*/
Expand Down
2 changes: 2 additions & 0 deletions src/Faker/Provider/ja_JP/Text.php
Original file line number Diff line number Diff line change
Expand Up @@ -628,10 +628,12 @@ protected static function appendEnd($text)
$chars = static::split($text);
$last = end($chars);
}

// if the last char is a not-valid-end punctuation, remove it
if (in_array($last, static::$notEndPunct, false)) {
$text = preg_replace('/.$/u', '', $text);
}

// if the last char is not a valid punctuation, append a default one.
return in_array($last, static::$endPunct, false) ? $text : $text . '';
}
Expand Down
2 changes: 0 additions & 2 deletions src/Faker/Provider/kk_KZ/Company.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ public static function companyNameSuffix()
*
* @see http://egov.kz/wps/portal/Content?contentPath=%2Fegovcontent%2Fbus_business%2Ffor_businessmen%2Farticle%2Fbusiness_identification_number&lang=en
*
* @param \DateTime $registrationDate
*
* @return string 12 digits, like 150140000019
*/
public static function businessIdentificationNumber(\DateTime $registrationDate = null)
Expand Down
3 changes: 1 addition & 2 deletions src/Faker/Provider/kk_KZ/Person.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,7 @@ private static function getCenturyByYear($year)
* @see http://egov.kz/wps/portal/Content?contentPath=%2Fegovcontent%2Fcitizen_migration%2Fpassport_id_card%2Farticle%2Fiin_info&lang=en
* @see https://ru.wikipedia.org/wiki/%D0%98%D0%BD%D0%B4%D0%B8%D0%B2%D0%B8%D0%B4%D1%83%D0%B0%D0%BB%D1%8C%D0%BD%D1%8B%D0%B9_%D0%B8%D0%B4%D0%B5%D0%BD%D1%82%D0%B8%D1%84%D0%B8%D0%BA%D0%B0%D1%86%D0%B8%D0%BE%D0%BD%D0%BD%D1%8B%D0%B9_%D0%BD%D0%BE%D0%BC%D0%B5%D1%80
*
* @param \DateTime $birthDate
* @param int $gender
* @param int $gender
*
* @return string 12 digits, like 780322300455
*/
Expand Down
5 changes: 2 additions & 3 deletions src/Faker/Provider/lt_LT/Person.php
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,8 @@ public function passportNumber()
* @see https://en.wikipedia.org/wiki/National_identification_number#Lithuania
* @see https://lt.wikipedia.org/wiki/Asmens_kodas
*
* @param string $gender [male|female]
* @param \DateTime $birthdate
* @param string $randomNumber three integers
* @param string $gender [male|female]
* @param string $randomNumber three integers
*
* @return string on format XXXXXXXXXXX
*/
Expand Down
2 changes: 0 additions & 2 deletions src/Faker/Provider/lv_LV/Person.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,6 @@ public function passportNumber()
*
* @see https://en.wikipedia.org/wiki/National_identification_number#Latvia
*
* @param \DateTime $birthdate
*
* @return string on format XXXXXX-XXXXX
*/
public function personalIdentityNumber(\DateTime $birthdate = null)
Expand Down
1 change: 1 addition & 0 deletions src/Faker/Provider/ms_MY/Person.php
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,7 @@ public static function myKadNumber($gender = null, $hyphen = false)

// gender digit. Odd = MALE, Even = FEMALE
$g = self::numberBetween(0, 9);

//Credit: https://gist.github.com/mauris/3629548
if ($gender === static::GENDER_MALE) {
$g = $g | 1;
Expand Down
3 changes: 1 addition & 2 deletions src/Faker/Provider/nb_NO/Person.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,7 @@ class Person extends \Faker\Provider\Person
*
* @see https://no.wikipedia.org/wiki/Personnummer
*
* @param \DateTime $birthdate
* @param string $gender Person::GENDER_MALE || Person::GENDER_FEMALE
* @param string $gender Person::GENDER_MALE || Person::GENDER_FEMALE
*
* @return string on format DDMMYY#####
*/
Expand Down
1 change: 1 addition & 0 deletions src/Faker/Provider/ro_RO/Person.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ protected function getDateOfBirth($dateOfBirth)

$dateOfBirthFinal = implode('-', $dateOfBirthParts);
$date = \DateTime::createFromFormat('Y-m-d', $dateOfBirthFinal);

//a full (invalid) date might have been supplied, check if it converts
if ($date->format('Y-m-d') !== $dateOfBirthFinal) {
throw new \InvalidArgumentException("Invalid date of birth - '{$date->format('Y-m-d')}' generated based on '{$dateOfBirth}' received");
Expand Down
3 changes: 1 addition & 2 deletions src/Faker/Provider/sv_SE/Person.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,7 @@ class Person extends \Faker\Provider\Person
*
* @see http://en.wikipedia.org/wiki/Personal_identity_number_(Sweden)
*
* @param \DateTime $birthdate
* @param string $gender Person::GENDER_MALE || Person::GENDER_FEMALE
* @param string $gender Person::GENDER_MALE || Person::GENDER_FEMALE
*
* @return string on format XXXXXX-XXXX
*/
Expand Down

0 comments on commit 7b3bb63

Please sign in to comment.