DX: apply rector rulesset up to PHP72

This commit is contained in:
2023-03-29 22:32:52 +02:00
parent 64b8ae3df1
commit b9a7530f7a
110 changed files with 194 additions and 229 deletions

View File

@@ -198,10 +198,10 @@ final class ExportManagerTest extends KernelTestCase
//create a formatter
$formatterFoo = $this->prophet->prophesize();
$formatterFoo->willImplement('Chill\MainBundle\Export\FormatterInterface');
$formatterFoo->willImplement(\Chill\MainBundle\Export\FormatterInterface::class);
$formatterFoo->getType()->willReturn('foo');
$formatterBar = $this->prophet->prophesize();
$formatterBar->willImplement('Chill\MainBundle\Export\FormatterInterface');
$formatterBar->willImplement(\Chill\MainBundle\Export\FormatterInterface::class);
$formatterBar->getType()->willReturn('bar');
$exportManager->addFormatter($formatterFoo->reveal(), 'foo');
$exportManager->addFormatter($formatterBar->reveal(), 'bar');
@@ -380,12 +380,12 @@ final class ExportManagerTest extends KernelTestCase
//create a filter and add it to ExportManager
$agg = $this->prophet->prophesize();
$agg->willImplement('Chill\MainBundle\Export\AggregatorInterface');
$agg->willImplement(\Chill\MainBundle\Export\AggregatorInterface::class);
$exportManager->addAggregator($agg->reveal(), 'dummy');
$obtained = $exportManager->getAggregator('dummy');
$this->assertInstanceof('Chill\MainBundle\Export\AggregatorInterface', $obtained);
$this->assertInstanceof(\Chill\MainBundle\Export\AggregatorInterface::class, $obtained);
}
public function testGetAggregatorNonExistant()
@@ -403,11 +403,11 @@ final class ExportManagerTest extends KernelTestCase
//create three filters and add them to ExportManager
$aggFoo = $this->prophet->prophesize();
$aggFoo->willImplement('Chill\MainBundle\Export\AggregatorInterface');
$aggFoo->willImplement(\Chill\MainBundle\Export\AggregatorInterface::class);
$aggBar = $this->prophet->prophesize();
$aggBar->willImplement('Chill\MainBundle\Export\AggregatorInterface');
$aggBar->willImplement(\Chill\MainBundle\Export\AggregatorInterface::class);
$aggFooBar = $this->prophet->prophesize();
$aggFooBar->willImplement('Chill\MainBundle\Export\AggregatorInterface');
$aggFooBar->willImplement(\Chill\MainBundle\Export\AggregatorInterface::class);
$exportManager->addAggregator($aggFoo->reveal(), 'foo');
$exportManager->addAggregator($aggBar->reveal(), 'bar');
$exportManager->addAggregator($aggFooBar->reveal(), 'foobar');
@@ -477,12 +477,12 @@ final class ExportManagerTest extends KernelTestCase
//create a filter and add it to ExportManager
$filter = $this->prophet->prophesize();
$filter->willImplement('Chill\MainBundle\Export\FilterInterface');
$filter->willImplement(\Chill\MainBundle\Export\FilterInterface::class);
$exportManager->addFilter($filter->reveal(), 'dummy');
$obtained = $exportManager->getFilter('dummy');
$this->assertInstanceof('Chill\MainBundle\Export\FilterInterface', $obtained);
$this->assertInstanceof(\Chill\MainBundle\Export\FilterInterface::class, $obtained);
}
public function testGetFilterNonExistant()
@@ -500,11 +500,11 @@ final class ExportManagerTest extends KernelTestCase
//create three filters and add them to ExportManager
$filterFoo = $this->prophet->prophesize();
$filterFoo->willImplement('Chill\MainBundle\Export\FilterInterface');
$filterFoo->willImplement(\Chill\MainBundle\Export\FilterInterface::class);
$filterBar = $this->prophet->prophesize();
$filterBar->willImplement('Chill\MainBundle\Export\FilterInterface');
$filterBar->willImplement(\Chill\MainBundle\Export\FilterInterface::class);
$filterFooBar = $this->prophet->prophesize();
$filterFooBar->willImplement('Chill\MainBundle\Export\FilterInterface');
$filterFooBar->willImplement(\Chill\MainBundle\Export\FilterInterface::class);
$exportManager->addFilter($filterFoo->reveal(), 'foo');
$exportManager->addFilter($filterBar->reveal(), 'bar');
$exportManager->addFilter($filterFooBar->reveal(), 'foobar');
@@ -522,12 +522,12 @@ final class ExportManagerTest extends KernelTestCase
//create a formatter
$formatter = $this->prophet->prophesize();
$formatter->willImplement('Chill\MainBundle\Export\FormatterInterface');
$formatter->willImplement(\Chill\MainBundle\Export\FormatterInterface::class);
$exportManager->addFormatter($formatter->reveal(), 'dummy');
$obtained = $exportManager->getFormatter('dummy');
$this->assertInstanceOf('Chill\MainBundle\Export\FormatterInterface', $obtained);
$this->assertInstanceOf(\Chill\MainBundle\Export\FormatterInterface::class, $obtained);
}
public function testIsGrantedForElementWithExportAndUserIsGranted()
@@ -536,7 +536,7 @@ final class ExportManagerTest extends KernelTestCase
$user = $this->prepareUser([]);
$authorizationChecker = $this->prophet->prophesize();
$authorizationChecker->willImplement('Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface');
$authorizationChecker->willImplement(\Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface::class);
$authorizationChecker->isGranted('CHILL_STAT_DUMMY', $center)
->willReturn(true);
@@ -564,7 +564,7 @@ final class ExportManagerTest extends KernelTestCase
$user = $this->prepareUser([]);
$authorizationChecker = $this->prophet->prophesize();
$authorizationChecker->willImplement('Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface');
$authorizationChecker->willImplement(\Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface::class);
$authorizationChecker->isGranted('CHILL_STAT_DUMMY', $center)
->willReturn(true);
$authorizationChecker->isGranted('CHILL_STAT_DUMMY', $centerB)

View File

@@ -101,7 +101,7 @@ final class PickCenterTypeTest extends TypeTestCase
$prophet = new \Prophecy\Prophet();
$prophecyCenter = $prophet->prophesize();
$prophecyCenter->willExtend('\Chill\MainBundle\Entity\Center');
$prophecyCenter->willExtend('\\' . \Chill\MainBundle\Entity\Center::class);
$prophecyCenter->getId()->willReturn($id);
$prophecyCenter->getName()->willReturn($name);
@@ -122,18 +122,18 @@ final class PickCenterTypeTest extends TypeTestCase
//create a center transformer
$centerTransformerProphecy = $prophet->prophesize();
$centerTransformerProphecy
->willExtend('Chill\MainBundle\Form\Type\DataTransformer\CenterTransformer');
->willExtend(\Chill\MainBundle\Form\Type\DataTransformer\CenterTransformer::class);
$transformer = $centerTransformerProphecy->reveal();
$tokenProphecy = $prophet->prophesize();
$tokenProphecy
->willImplement('\Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
->willImplement('\\' . \Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class);
$tokenProphecy->getUser()->willReturn($user);
$token = $tokenProphecy->reveal();
$tokenStorageProphecy = $prophet->prophesize();
$tokenStorageProphecy
->willExtend('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage');
->willExtend(\Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage::class);
$tokenStorageProphecy->getToken()->willReturn($token);
$tokenStorage = $tokenStorageProphecy->reveal();

View File

@@ -26,7 +26,7 @@ final class AbstractSearchTest extends \PHPUnit\Framework\TestCase
protected function setUp(): void
{
$this->stub = $this->getMockForAbstractClass('Chill\MainBundle\Search\AbstractSearch');
$this->stub = $this->getMockForAbstractClass(\Chill\MainBundle\Search\AbstractSearch::class);
}
public function testParseDateRegular()

View File

@@ -245,7 +245,7 @@ final class SearchProviderTest extends TestCase
private function createDefaultSearchService($result, $order)
{
$mock = $this
->getMockForAbstractClass('Chill\MainBundle\Search\AbstractSearch');
->getMockForAbstractClass(\Chill\MainBundle\Search\AbstractSearch::class);
//set the mock as default
$mock->expects($this->any())
@@ -267,7 +267,7 @@ final class SearchProviderTest extends TestCase
private function createNonDefaultDomainSearchService($result, $order, $domain)
{
$mock = $this
->getMockForAbstractClass('Chill\MainBundle\Search\AbstractSearch');
->getMockForAbstractClass(\Chill\MainBundle\Search\AbstractSearch::class);
//set the mock as default
$mock->expects($this->any())

View File

@@ -279,8 +279,8 @@ final class AuthorizationHelperTest extends KernelTestCase
]);
$helper = $this->getAuthorizationHelper();
$entity = $this->getProphet()->prophesize();
$entity->willImplement('\Chill\MainBundle\Entity\HasCenterInterface');
$entity->willImplement('\Chill\MainBundle\Entity\HasScopeInterface');
$entity->willImplement('\\' . \Chill\MainBundle\Entity\HasCenterInterface::class);
$entity->willImplement('\\' . \Chill\MainBundle\Entity\HasScopeInterface::class);
$entity->getCenter()->willReturn($center);
$entity->getScope()->willReturn($scope);
@@ -386,7 +386,7 @@ final class AuthorizationHelperTest extends KernelTestCase
]);
$helper = $this->getAuthorizationHelper();
$entity = $this->getProphet()->prophesize();
$entity->willImplement('\Chill\MainBundle\Entity\HasCenterInterface');
$entity->willImplement('\\' . \Chill\MainBundle\Entity\HasCenterInterface::class);
$entity->getCenter()->willReturn($center);
$this->assertTrue($helper->userHasAccess(
@@ -410,7 +410,7 @@ final class AuthorizationHelperTest extends KernelTestCase
$helper = $this->getAuthorizationHelper();
$entity = $this->getProphet()->prophesize();
$entity->willImplement('\Chill\MainBundle\Entity\HasCenterInterface');
$entity->willImplement('\\' . \Chill\MainBundle\Entity\HasCenterInterface::class);
$entity->getCenter()->willReturn($center);
$this->assertTrue($helper->userHasAccess(
@@ -434,8 +434,8 @@ final class AuthorizationHelperTest extends KernelTestCase
]);
$helper = $this->getAuthorizationHelper();
$entity = $this->getProphet()->prophesize();
$entity->willImplement('\Chill\MainBundle\Entity\HasCenterInterface');
$entity->willImplement('\Chill\MainBundle\Entity\HasScopeInterface');
$entity->willImplement('\\' . \Chill\MainBundle\Entity\HasCenterInterface::class);
$entity->willImplement('\\' . \Chill\MainBundle\Entity\HasScopeInterface::class);
$entity->getCenter()->willReturn($centerB);
$entity->getScope()->willReturn($scope);
@@ -455,7 +455,7 @@ final class AuthorizationHelperTest extends KernelTestCase
]);
$helper = $this->getAuthorizationHelper();
$entity = $this->getProphet()->prophesize();
$entity->willImplement('\Chill\MainBundle\Entity\HasCenterInterface');
$entity->willImplement('\\' . \Chill\MainBundle\Entity\HasCenterInterface::class);
$entity->getCenter()->willReturn($center);
$this->assertFalse($helper->userHasAccess($user, $entity->reveal(), 'CHILL_ROLE'));
@@ -474,8 +474,8 @@ final class AuthorizationHelperTest extends KernelTestCase
]);
$helper = $this->getAuthorizationHelper();
$entity = $this->getProphet()->prophesize();
$entity->willImplement('\Chill\MainBundle\Entity\HasCenterInterface');
$entity->willImplement('\Chill\MainBundle\Entity\HasScopeInterface');
$entity->willImplement('\\' . \Chill\MainBundle\Entity\HasCenterInterface::class);
$entity->willImplement('\\' . \Chill\MainBundle\Entity\HasScopeInterface::class);
$entity->getCenter()->willReturn($center);
$entity->getScope()->willReturn($scope);
@@ -506,7 +506,7 @@ final class AuthorizationHelperTest extends KernelTestCase
]);
$helper = $this->getAuthorizationHelper();
$entity = $this->getProphet()->prophesize();
$entity->willImplement('\Chill\MainBundle\Entity\HasCenterInterface');
$entity->willImplement('\\' . \Chill\MainBundle\Entity\HasCenterInterface::class);
$entity->getCenter()->willReturn($centerA);
$this->assertFalse($helper->userHasAccess($user, $entity->reveal(), 'CHILL_ROLE'));