apply rector rules on list interfaces

This commit is contained in:
Julien Fastré 2023-06-05 17:40:19 +02:00
parent 73bc95306e
commit f10c50231f
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
2 changed files with 137 additions and 0 deletions

View File

@ -15,6 +15,7 @@ use Chill\MainBundle\Export\AggregatorInterface;
use Chill\MainBundle\Export\DirectExportInterface; use Chill\MainBundle\Export\DirectExportInterface;
use Chill\MainBundle\Export\ExportInterface; use Chill\MainBundle\Export\ExportInterface;
use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Export\FilterInterface;
use Chill\MainBundle\Export\ListInterface;
use PhpParser\Node; use PhpParser\Node;
use Rector\Core\Rector\AbstractRector; use Rector\Core\Rector\AbstractRector;
use Rector\Symfony\NodeAnalyzer\ClassAnalyzer; use Rector\Symfony\NodeAnalyzer\ClassAnalyzer;
@ -51,6 +52,7 @@ class ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector extends Abstra
&& !$this->classAnalyzer->hasImplements($node, AggregatorInterface::class) && !$this->classAnalyzer->hasImplements($node, AggregatorInterface::class)
&& !$this->classAnalyzer->hasImplements($node, ExportInterface::class) && !$this->classAnalyzer->hasImplements($node, ExportInterface::class)
&& !$this->classAnalyzer->hasImplements($node, DirectExportInterface::class) && !$this->classAnalyzer->hasImplements($node, DirectExportInterface::class)
&& !$this->classAnalyzer->hasImplements($node, ListInterface::class)
) { ) {
return null; return null;
} }

View File

@ -0,0 +1,135 @@
<?php
namespace Utils\Rector\Tests\ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector\Fixture;
use Chill\MainBundle\Export\ListInterface;
use Symfony\Component\Form\FormBuilderInterface;
class MyClass implements ListInterface
{
public function getTitle()
{
// TODO: Implement getTitle() method.
}
public function buildForm(FormBuilderInterface $builder)
{
// TODO: Implement buildForm() method.
}
public function getAllowedFormattersTypes()
{
// TODO: Implement getAllowedFormattersTypes() method.
}
public function getDescription()
{
// TODO: Implement getDescription() method.
}
public function getLabels($key, array $values, $data)
{
// TODO: Implement getLabels() method.
}
public function getQueryKeys($data)
{
// TODO: Implement getQueryKeys() method.
}
public function getResult($query, $data)
{
// TODO: Implement getResult() method.
}
public function getType()
{
// TODO: Implement getType() method.
}
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
{
// TODO: Implement initiateQuery() method.
}
public function requiredRole(): string
{
// TODO: Implement requiredRole() method.
}
public function supportsModifiers()
{
// TODO: Implement supportsModifiers() method.
}
}
?>
-----
<?php
namespace Utils\Rector\Tests\ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector\Fixture;
use Chill\MainBundle\Export\ListInterface;
use Symfony\Component\Form\FormBuilderInterface;
class MyClass implements ListInterface
{
public function getTitle()
{
// TODO: Implement getTitle() method.
}
public function buildForm(FormBuilderInterface $builder)
{
// TODO: Implement buildForm() method.
}
public function getFormDefaultData(): array
{
return [];
}
public function getAllowedFormattersTypes()
{
// TODO: Implement getAllowedFormattersTypes() method.
}
public function getDescription()
{
// TODO: Implement getDescription() method.
}
public function getLabels($key, array $values, $data)
{
// TODO: Implement getLabels() method.
}
public function getQueryKeys($data)
{
// TODO: Implement getQueryKeys() method.
}
public function getResult($query, $data)
{
// TODO: Implement getResult() method.
}
public function getType()
{
// TODO: Implement getType() method.
}
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
{
// TODO: Implement initiateQuery() method.
}
public function requiredRole(): string
{
// TODO: Implement requiredRole() method.
}
public function supportsModifiers()
{
// TODO: Implement supportsModifiers() method.
}
}
?>