Skip to content
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
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@
"classmap": [
"stubs",
"rules-tests/CodingStyle/Rector/Namespace_/ImportFullyQualifiedNamesRector/Source",
"rules-tests/Renaming/Rector/Name/RenameClassRector/Source"
"rules-tests/Renaming/Rector/Name/RenameClassRector/Source",
"rules-tests/TypeDeclaration/Rector/ClassMethod/KnownMagicClassMethodTypeRector/Source"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be needed. The class respects PSR-4, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is weird that without it, it doesn't work on this case, probably some sort order issue or some case sensitive typo, but double check without add to classmap, use previous return null, then run "composer update", and error happen

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I got it, the class name is different with file name:

-abstract class ParentClassWithOtherMethod
+abstract class ParentClassOtherMethod

as file name is named ParentClassOtherMethod, I will create new PR for it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

],
"files": [
"tests/debug_functions.php",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\KnownMagicClassMethodTypeRector\Fixture;

use Rector\Tests\TypeDeclaration\Rector\ClassMethod\KnownMagicClassMethodTypeRector\Source\ParentClassWithOtherMethod;

final class WithOtherMethodFromParent extends ParentClassWithOtherMethod
{
public function __invoke()
{
}

public function __call($method, $args)
{
}
}

?>
-----
<?php

namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\KnownMagicClassMethodTypeRector\Fixture;

use Rector\Tests\TypeDeclaration\Rector\ClassMethod\KnownMagicClassMethodTypeRector\Source\ParentClassWithOtherMethod;

final class WithOtherMethodFromParent extends ParentClassWithOtherMethod
{
public function __invoke()
{
}

public function __call(string $method, array $args)
{
}
}

?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\KnownMagicClassMethodTypeRector\Source;

abstract class ParentClassWithOtherMethod
{
public function __invoke()
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function refactor(Node $node): ?Node
}

if ($this->parentClassMethodTypeOverrideGuard->hasParentClassMethod($classMethod)) {
return null;
continue;
}

if ($this->isNames($classMethod, [MethodName::CALL, MethodName::CALL_STATIC])) {
Expand Down