mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-17 21:38:22 +01:00
Merge pull request #2997 from gnutix/static-call-fixes
Fix various static calls errors in PHPUnit Rectors.
This commit is contained in:
commit
e9ee423b34
@ -71,6 +71,9 @@ final class AssertFalseStrposToContainsRector extends AbstractPHPUnitRector
|
||||
}
|
||||
|
||||
$firstArgumentValue = $node->args[0]->value;
|
||||
if ($firstArgumentValue instanceof StaticCall) {
|
||||
return null;
|
||||
}
|
||||
if (! $this->isNames($firstArgumentValue, ['strpos', 'stripos'])) {
|
||||
return null;
|
||||
}
|
||||
|
@ -81,9 +81,10 @@ final class AssertPropertyExistsRector extends AbstractPHPUnitRector
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @var FuncCall $firstArgumentValue */
|
||||
$firstArgumentValue = $node->args[0]->value;
|
||||
|
||||
if ($firstArgumentValue instanceof StaticCall) {
|
||||
return null;
|
||||
}
|
||||
if (! $this->isName($firstArgumentValue, 'property_exists')) {
|
||||
return null;
|
||||
}
|
||||
|
@ -73,9 +73,10 @@ final class AssertTrueFalseToSpecificMethodRector extends AbstractPHPUnitRector
|
||||
}
|
||||
|
||||
$firstArgumentValue = $node->args[0]->value;
|
||||
if ($firstArgumentValue instanceof StaticCall ||
|
||||
! $this->isNames($firstArgumentValue, array_keys(self::OLD_TO_NEW_METHODS))
|
||||
) {
|
||||
if ($firstArgumentValue instanceof StaticCall) {
|
||||
return null;
|
||||
}
|
||||
if (! $this->isNames($firstArgumentValue, array_keys(self::OLD_TO_NEW_METHODS))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\PHPUnit\Tests\Rector\SpecificMethod\AssertFalseStrposToContainsRector\Fixture;
|
||||
|
||||
final class SkipStaticCall extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
public function test()
|
||||
{
|
||||
self::assertFalse(SomeClass::someMethod());
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\PHPUnit\Tests\Rector\SpecificMethod\AssertPropertyExistsRector\Fixture;
|
||||
|
||||
final class SkipStaticCall extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
public function test()
|
||||
{
|
||||
self::assertFalse(SomeClass::someMethod());
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
|
||||
namespace Rector\PHPUnit\Tests\Rector\SpecificMethod\AssertTrueFalseToSpecificMethodRector\Fixture;
|
||||
|
||||
final class Fixture3Test extends \PHPUnit\Framework\TestCase
|
||||
final class SkipStaticCall extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
public function test()
|
||||
{
|
Loading…
x
Reference in New Issue
Block a user