-
Notifications
You must be signed in to change notification settings - Fork 74
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
PHPStan 1.0 and Rector 0.12 #185
Conversation
Add unit tests for the failed fixtures to catch errors faster next time.
final protected function checkClassTypeHasTrait(?Class_ $class, string $trait): bool | ||
{ | ||
if ($class === null) { | ||
return false; | ||
} | ||
$className = $this->nodeNameResolver->getName($class); | ||
return in_array( | ||
$trait, | ||
$this->getTraitsByClass($className) | ||
); | ||
} |
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.
Previously the code was just checking if the class name was an empty string. Now Rector leverages a type object lookup. This helps keep code clean when checking if a class node has a trait.
@@ -0,0 +1,17 @@ | |||
<?php |
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.
Adds a stub so we can unit test the GetMockBase rector set.
@@ -6,7 +6,7 @@ | |||
use Rector\Testing\PHPUnit\AbstractRectorTestCase; | |||
use Symplify\SmartFileSystem\SmartFileInfo; | |||
|
|||
class AssertHeaderRectorTest extends AbstractRectorTestCase { | |||
class AssertPatternRectorTest extends AbstractRectorTestCase { |
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.
Fix for autoloading and Composer warning.
class GetMockRectorTest extends AbstractRectorTestCase { | ||
|
||
/** | ||
* @dataProvider provideData() | ||
*/ | ||
public function test(SmartFileInfo $fileInfo): void | ||
{ | ||
$this->doTestFileInfo($fileInfo); |
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.
This was one of the Rector rules crashing due to upstream changes. So I added a Unit test as well so we can more easily catch them without running the full functional test.
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.
If with those changes, "require" section can be updated then it is ok for me. Thanks a lot!
…added stable tag in favor of new release. 1. The PR palantirnet/drupal-rector#185 was merged. 2. See: https://github.com/palantirnet/drupal-rector/releases/tag/0.12.0
Description
Extends #184 with fixes to base classes.
I would recommend tagging 0.12.0 for this commit, following the release version pattern of Rector
Drupal.org issue
https://www.drupal.org/project/rector/issues/3248684