Skip to content

Commit

Permalink
Enhancement: Enable self_static_accessor fixer (#728)
Browse files Browse the repository at this point in the history
* Enhancement: Enable self_static_accessor fixer

* Fix: Run 'make cs'
  • Loading branch information
localheinz committed Sep 5, 2023
1 parent 1ba2598 commit 31c6842
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 22 deletions.
1 change: 1 addition & 0 deletions .php-cs-fixer.dist.php
Expand Up @@ -187,6 +187,7 @@
'random_api_migration' => true,
'return_assignment' => true,
'return_type_declaration' => true,
'self_static_accessor' => true,
'semicolon_after_instruction' => true,
'short_scalar_cast' => true,
'single_line_comment_style' => true,
Expand Down
2 changes: 1 addition & 1 deletion src/Faker/Extension/Helper.php
Expand Up @@ -86,7 +86,7 @@ public static function bothify(string $string): string
return mt_rand(0, 1) === 1 ? '#' : '?';
});

return static::lexify(static::numerify($string));
return self::lexify(self::numerify($string));
}

private static function replaceWildcard(string $string, string $wildcard, callable $callback): string
Expand Down
38 changes: 19 additions & 19 deletions test/Faker/Provider/ProviderOverrideTest.php
Expand Up @@ -35,10 +35,10 @@ public function testAddress($locale = null): void
{
$faker = Faker\Factory::create($locale);

self::assertMatchesRegularExpression(static::TEST_STRING_REGEX, $faker->city);
self::assertMatchesRegularExpression(static::TEST_STRING_REGEX, $faker->postcode);
self::assertMatchesRegularExpression(static::TEST_STRING_REGEX, $faker->address);
self::assertMatchesRegularExpression(static::TEST_STRING_REGEX, $faker->country);
self::assertMatchesRegularExpression(self::TEST_STRING_REGEX, $faker->city);
self::assertMatchesRegularExpression(self::TEST_STRING_REGEX, $faker->postcode);
self::assertMatchesRegularExpression(self::TEST_STRING_REGEX, $faker->address);
self::assertMatchesRegularExpression(self::TEST_STRING_REGEX, $faker->country);
}

/**
Expand All @@ -50,7 +50,7 @@ public function testCompany($locale = null): void
{
$faker = Faker\Factory::create($locale);

self::assertMatchesRegularExpression(static::TEST_STRING_REGEX, $faker->company);
self::assertMatchesRegularExpression(self::TEST_STRING_REGEX, $faker->company);
}

/**
Expand All @@ -62,8 +62,8 @@ public function testDateTime($locale = null): void
{
$faker = Faker\Factory::create($locale);

self::assertMatchesRegularExpression(static::TEST_STRING_REGEX, $faker->century);
self::assertMatchesRegularExpression(static::TEST_STRING_REGEX, $faker->timezone);
self::assertMatchesRegularExpression(self::TEST_STRING_REGEX, $faker->century);
self::assertMatchesRegularExpression(self::TEST_STRING_REGEX, $faker->timezone);
}

/**
Expand All @@ -75,12 +75,12 @@ public function testInternet($locale = null): void
{
$faker = Faker\Factory::create($locale);

self::assertMatchesRegularExpression(static::TEST_STRING_REGEX, $faker->userName);
self::assertMatchesRegularExpression(self::TEST_STRING_REGEX, $faker->userName);

self::assertMatchesRegularExpression(static::TEST_EMAIL_REGEX, $faker->email);
self::assertMatchesRegularExpression(static::TEST_EMAIL_REGEX, $faker->safeEmail);
self::assertMatchesRegularExpression(static::TEST_EMAIL_REGEX, $faker->freeEmail);
self::assertMatchesRegularExpression(static::TEST_EMAIL_REGEX, $faker->companyEmail);
self::assertMatchesRegularExpression(self::TEST_EMAIL_REGEX, $faker->email);
self::assertMatchesRegularExpression(self::TEST_EMAIL_REGEX, $faker->safeEmail);
self::assertMatchesRegularExpression(self::TEST_EMAIL_REGEX, $faker->freeEmail);
self::assertMatchesRegularExpression(self::TEST_EMAIL_REGEX, $faker->companyEmail);
}

/**
Expand All @@ -92,10 +92,10 @@ public function testPerson($locale = null): void
{
$faker = Faker\Factory::create($locale);

self::assertMatchesRegularExpression(static::TEST_STRING_REGEX, $faker->name);
self::assertMatchesRegularExpression(static::TEST_STRING_REGEX, $faker->title);
self::assertMatchesRegularExpression(static::TEST_STRING_REGEX, $faker->firstName);
self::assertMatchesRegularExpression(static::TEST_STRING_REGEX, $faker->lastName);
self::assertMatchesRegularExpression(self::TEST_STRING_REGEX, $faker->name);
self::assertMatchesRegularExpression(self::TEST_STRING_REGEX, $faker->title);
self::assertMatchesRegularExpression(self::TEST_STRING_REGEX, $faker->firstName);
self::assertMatchesRegularExpression(self::TEST_STRING_REGEX, $faker->lastName);
}

/**
Expand All @@ -107,7 +107,7 @@ public function testPhoneNumber($locale = null): void
{
$faker = Faker\Factory::create($locale);

self::assertMatchesRegularExpression(static::TEST_STRING_REGEX, $faker->phoneNumber);
self::assertMatchesRegularExpression(self::TEST_STRING_REGEX, $faker->phoneNumber);
}

/**
Expand All @@ -119,7 +119,7 @@ public function testUserAgent($locale = null): void
{
$faker = Faker\Factory::create($locale);

self::assertMatchesRegularExpression(static::TEST_STRING_REGEX, $faker->userAgent);
self::assertMatchesRegularExpression(self::TEST_STRING_REGEX, $faker->userAgent);
}

/**
Expand All @@ -132,6 +132,6 @@ public function testUuid($locale = null): void
{
$faker = Faker\Factory::create($locale);

self::assertMatchesRegularExpression(static::TEST_STRING_REGEX, $faker->uuid);
self::assertMatchesRegularExpression(self::TEST_STRING_REGEX, $faker->uuid);
}
}
2 changes: 1 addition & 1 deletion test/Faker/Provider/id_ID/PersonTest.php
Expand Up @@ -77,7 +77,7 @@ public function testNikContainsBirthPlace(): void
{
$nik = $this->faker->nik();

self::assertContains(substr($nik, 0, 4), static::$birthPlaceCode);
self::assertContains(substr($nik, 0, 4), self::$birthPlaceCode);
}

protected function getProviders(): iterable
Expand Down
2 changes: 1 addition & 1 deletion test/Faker/Provider/ro_RO/PersonTest.php
Expand Up @@ -206,7 +206,7 @@ protected function isValidMaleCnp($value)

protected function isValidCnp($cnp)
{
if (preg_match(static::TEST_CNP_REGEX, $cnp) !== false) {
if (preg_match(self::TEST_CNP_REGEX, $cnp) !== false) {
$checkNumber = 279146358279;

$checksum = 0;
Expand Down

0 comments on commit 31c6842

Please sign in to comment.