Skip to content

Commit

Permalink
Merge pull request #38 from yiisoft/add-rector
Browse files Browse the repository at this point in the history
Add rector [batch]
  • Loading branch information
xepozz committed Oct 28, 2022
2 parents 4173a2c + dcc006d commit 38bedf9
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 33 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/rector.yml
@@ -0,0 +1,21 @@
on:
pull_request:
paths-ignore:
- 'docs/**'
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.gitattributes'
- 'infection.json.dist'
- 'psalm.xml'

name: rector

jobs:
rector:
uses: yiisoft/actions/.github/workflows/rector.yml@master
with:
os: >-
['ubuntu-latest']
php: >-
['8.0']
1 change: 1 addition & 0 deletions composer.json
Expand Up @@ -31,6 +31,7 @@
},
"require-dev": {
"phpunit/phpunit": "^9.5",
"rector/rector": "^0.14.3",
"roave/infection-static-analysis-plugin": "^1.16",
"spatie/phpunit-watcher": "^1.23",
"vimeo/psalm": "^4.18"
Expand Down
22 changes: 22 additions & 0 deletions rector.php
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\LevelSetList;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([
__DIR__ . '/src',
__DIR__ . '/tests',
]);

// register a single rule
$rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class);

// define sets of rules
$rectorConfig->sets([
LevelSetList::UP_TO_PHP_80,
]);
};
34 changes: 1 addition & 33 deletions src/Locale.php
Expand Up @@ -11,7 +11,7 @@
*
* @link https://tools.ietf.org/html/bcp47
*/
final class Locale
final class Locale implements \Stringable
{
/**
* @var string|null Two-letter ISO-639-2 language code.
Expand Down Expand Up @@ -198,8 +198,6 @@ public function script(): ?string
* @param string|null $script Four-letter ISO 15924 script code.
*
* @link http://www.unicode.org/iso15924/iso15924-codes.html
*
* @return self
*/
public function withScript(?string $script): self
{
Expand All @@ -218,8 +216,6 @@ public function variant(): ?string

/**
* @param string|null $variant Variant of language conventions to use.
*
* @return self
*/
public function withVariant(?string $variant): self
{
Expand All @@ -242,8 +238,6 @@ public function language(): ?string
* @param string|null $language Two-letter ISO-639-2 language code.
*
* @link http://www.loc.gov/standards/iso639-2/
*
* @return self
*/
public function withLanguage(?string $language): self
{
Expand All @@ -262,8 +256,6 @@ public function calendar(): ?string

/**
* @param string|null $calendar ICU calendar.
*
* @return self
*/
public function withCalendar(?string $calendar): self
{
Expand All @@ -288,8 +280,6 @@ public function colcasefirst(): ?string
*
* @link https://unicode-org.github.io/icu/userguide/collation/customization/#casefirst
* @link https://www.unicode.org/reports/tr35/tr35-61/tr35-collation.html#Collation_Settings
*
* @return self
*/
public function withColcasefirst(?string $colcasefirst): self
{
Expand All @@ -308,8 +298,6 @@ public function collation(): ?string

/**
* @param string|null $collation ICU collation.
*
* @return self
*/
public function withCollation(?string $collation): self
{
Expand All @@ -334,8 +322,6 @@ public function colnumeric(): ?string
*
* @link https://unicode-org.github.io/icu/userguide/collation/customization/#numericordering
* @link https://www.unicode.org/reports/tr35/tr35-61/tr35-collation.html#Collation_Settings
*
* @return self
*/
public function withColnumeric(?string $colnumeric): self
{
Expand All @@ -354,8 +340,6 @@ public function numbers(): ?string

/**
* @param string|null $numbers ICU numbers.
*
* @return self
*/
public function withNumbers(?string $numbers): self
{
Expand All @@ -378,8 +362,6 @@ public function hours(): ?string
* @param string|null $hours Unicode hour cycle identifier.
*
* @link https://www.unicode.org/reports/tr35/#UnicodeHourCycleIdentifier
*
* @return self
*/
public function withHours(?string $hours): self
{
Expand All @@ -402,8 +384,6 @@ public function region(): ?string
* @param string|null $region Two-letter ISO 3166-1 country code.
*
* @link https://www.iso.org/iso-3166-country-codes.html
*
* @return self
*/
public function withRegion(?string $region): self
{
Expand All @@ -422,8 +402,6 @@ public function currency(): ?string

/**
* @param string|null $currency ICU currency.
*
* @return self
*/
public function withCurrency(?string $currency): self
{
Expand All @@ -443,8 +421,6 @@ public function extendedLanguage(): ?string

/**
* @param string|null $extendedLanguage Extended language subtags.
*
* @return self
*/
public function withExtendedLanguage(?string $extendedLanguage): self
{
Expand All @@ -454,19 +430,11 @@ public function withExtendedLanguage(?string $extendedLanguage): self
return $new;
}

/**
* @return string|null
*/
public function private(): ?string
{
return $this->private;
}

/**
* @param string|null $private
*
* @return self
*/
public function withPrivate(?string $private): self
{
$new = clone $this;
Expand Down

0 comments on commit 38bedf9

Please sign in to comment.