Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rector #3

Merged
merged 3 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ $referralRewriterTag = ReferralRewriterTag::rewrite('https://www.amazon.it/Hackl

## Supported Shops

List here
* Amazon
* Ebay
* Instant-Gaming
* ... more to come!

## Testing

Expand Down
8 changes: 5 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"pestphp/pest-plugin-laravel": "^2.0",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-phpunit": "^1.0"
"phpstan/phpstan-phpunit": "^1.0",
"rector/rector": "^0.18.3"
},
"autoload": {
"psr-4": {
Expand Down Expand Up @@ -59,7 +60,8 @@
"analyse": "vendor/bin/phpstan analyse",
"test": "vendor/bin/pest",
"test-coverage": "vendor/bin/pest --coverage",
"format": "vendor/bin/pint"
"format": "vendor/bin/pint",
"rector": "vendor/bin/rector process src"
},
"config": {
"sort-packages": true,
Expand All @@ -80,4 +82,4 @@
},
"minimum-stability": "dev",
"prefer-stable": true
}
}
24 changes: 24 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?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__.'/config',
__DIR__.'/src',
__DIR__.'/tests',
__DIR__.'/workbench',
]);

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

// define sets of rules
// $rectorConfig->sets([
// LevelSetList::UP_TO_PHP_81
// ]);
};
2 changes: 1 addition & 1 deletion src/ReferralRewriterTag.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class ReferralRewriterTag
{
protected ?string $link;
protected string $link = '';

protected ?string $tag;

Expand Down