Skip to content

Commit

Permalink
updated variables self:: to static::
Browse files Browse the repository at this point in the history
  • Loading branch information
johnykvsky committed Dec 19, 2024
1 parent 0266d68 commit c31469d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/Core/Calculator/EanCalculator.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function checksum(string $digits): int

public function isValid(string $ean): bool
{
if (!preg_match(self::PATTERN, $ean)) {
if (!preg_match(static::PATTERN, $ean)) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Core/Calculator/IsbnCalculator.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ static function (&$digit, $position) {

public function isValid(string $isbn): bool
{
if (!preg_match(self::PATTERN, $isbn)) {
if (!preg_match(static::PATTERN, $isbn)) {
return false;
}

Expand Down
12 changes: 6 additions & 6 deletions src/Core/Person.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ class Person implements PersonExtensionInterface, GeneratorAwareExtensionInterfa

public function name(?string $gender = null): string
{
if ($gender === self::GENDER_MALE) {
if ($gender === static::GENDER_MALE) {
$format = $this->randomizer->randomElement($this->maleNameFormats);
} elseif ($gender === self::GENDER_FEMALE) {
} elseif ($gender === static::GENDER_FEMALE) {
$format = $this->randomizer->randomElement($this->femaleNameFormats);
} else {
$format = $this->randomizer->randomElement(array_merge($this->maleNameFormats, $this->femaleNameFormats));
Expand All @@ -89,11 +89,11 @@ public function name(?string $gender = null): string

public function firstName(?string $gender = null): string
{
if ($gender === self::GENDER_MALE) {
if ($gender === static::GENDER_MALE) {
return $this->firstNameMale();
}

if ($gender === self::GENDER_FEMALE) {
if ($gender === static::GENDER_FEMALE) {
return $this->firstNameFemale();
}

Expand All @@ -117,11 +117,11 @@ public function lastName(): string

public function title(?string $gender = null): string
{
if ($gender === self::GENDER_MALE) {
if ($gender === static::GENDER_MALE) {
return $this->titleMale();
}

if ($gender === self::GENDER_FEMALE) {
if ($gender === static::GENDER_FEMALE) {
return $this->titleFemale();
}

Expand Down
10 changes: 5 additions & 5 deletions src/Core/Replacer/Replacer.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,17 @@ public function bothify(string $string): string

public function toLower(string $string): string
{
return extension_loaded('mbstring') ? mb_strtolower($string, self::ENCODING) : strtolower($string);
return extension_loaded('mbstring') ? mb_strtolower($string, static::ENCODING) : strtolower($string);
}

public function toUpper(string $string = ''): string
{
return extension_loaded('mbstring') ? mb_strtoupper($string, self::ENCODING) : strtoupper($string);
return extension_loaded('mbstring') ? mb_strtoupper($string, static::ENCODING) : strtoupper($string);
}

public function strlen(string $text): int
{
return extension_loaded('mbstring') ? mb_strlen($text, self::ENCODING) : strlen($text);
return extension_loaded('mbstring') ? mb_strlen($text, static::ENCODING) : strlen($text);
}

public function transliterate(string $string): string
Expand All @@ -95,10 +95,10 @@ public function shuffleString(string $string = ''): string
if (extension_loaded('mbstring')) {
// UTF8-safe str_split()
$array = [];
$strlen = mb_strlen($string, self::ENCODING);
$strlen = mb_strlen($string, static::ENCODING);

for ($i = 0; $i < $strlen; ++$i) {
$array[] = mb_substr($string, $i, 1, self::ENCODING);
$array[] = mb_substr($string, $i, 1, static::ENCODING);
}
} else {
$array = str_split($string);
Expand Down
2 changes: 1 addition & 1 deletion src/Definitions/Extension/NumberExtensionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function randomFloat(?int $nbMaxDecimals, float $min, ?float $max): float
*
* @example 79907610
*/
public function randomNumber(?int $nbDigits, bool $strict): int;
public function randomNumber(?int $nbDigits, bool $strict = false): int;

/**
* Return a boolean, true or false.
Expand Down

0 comments on commit c31469d

Please sign in to comment.