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

PHPStan 1.0 and Rector 0.12 #185

Merged
merged 4 commits into from
Nov 19, 2021
Merged

Conversation

mglaman
Copy link
Collaborator

@mglaman mglaman commented Nov 17, 2021

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

Comment on lines +42 to +52
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)
);
}
Copy link
Collaborator Author

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
Copy link
Collaborator Author

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 {
Copy link
Collaborator Author

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.

Comment on lines +9 to +16
class GetMockRectorTest extends AbstractRectorTestCase {

/**
* @dataProvider provideData()
*/
public function test(SmartFileInfo $fileInfo): void
{
$this->doTestFileInfo($fileInfo);
Copy link
Collaborator Author

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.

@agentrickard agentrickard mentioned this pull request Nov 18, 2021
Copy link

@FlorentTorregrosa FlorentTorregrosa left a 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!

@agentrickard agentrickard merged commit 8a7ea55 into palantirnet:main Nov 19, 2021
navneet0693 added a commit to goalgorilla/drupal_social that referenced this pull request Nov 19, 2021
@mglaman mglaman deleted the 3248684 branch November 19, 2021 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants