-
-
Notifications
You must be signed in to change notification settings - Fork 166
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
Welcome to RectorPHP #307
base: master
Are you sure you want to change the base?
Welcome to RectorPHP #307
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Rector\Config\RectorConfig; | ||
|
||
return RectorConfig::configure() | ||
->withPaths([ | ||
__DIR__ . '/config', | ||
__DIR__ . '/routes', | ||
__DIR__ . '/src', | ||
__DIR__ . '/tests', | ||
]) | ||
// uncomment to reach your current PHP version | ||
//->withPhpSets(php80: true) | ||
->withPreparedSets( | ||
deadCode: true, | ||
codeQuality: true | ||
) | ||
->withTypeCoverageLevel(0); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -411,7 +411,7 @@ public function make(): ShortURL | |
|
||
$shortURL = new ShortURL($data); | ||
|
||
if ($this->beforeCreateCallback) { | ||
if ($this->beforeCreateCallback instanceof \Closure) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm trying to make up my mind about whether I like this change. The But if there's a good reason for it, I'm more than happy to be persuaded that this will be a beneficial change 😄 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a more strict check. If you want to be more granular in the configuration, to control rules and not generic ruleset, you can use |
||
value($this->beforeCreateCallback, $shortURL); | ||
} | ||
|
||
|
@@ -485,7 +485,7 @@ private function setOptions(): void | |
$this->urlKey = $this->keyGenerator->generateKeyUsing($this->generateKeyUsing); | ||
} | ||
|
||
if (! $this->activateAt) { | ||
if (!$this->activateAt instanceof \Carbon\Carbon) { | ||
$this->activateAt = Carbon::now(); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am I right in assuming that we'd set the current PHP version as 8.1 here since that's the minimum version required for the package? 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I tried it, but it raised some other issues we need to address. So, to keep this specific PR small, I started with two simple rulesets. One of the great things of Rector is that you can introduce it in a project with just a few rules and then add more rules later, with a kind of "progressive" approach