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

@@ -102,11 +102,7 @@ class LoadPostalCodesCommand extends Command
try {
$this->addPostalCode($row, $output);
++$num;
} catch (ExistingPostalCodeException $ex) {
$output->writeln('<warning> on line ' . $line . ' : ' . $ex->getMessage() . '</warning>');
} catch (CountryCodeNotFoundException $ex) {
$output->writeln('<warning> on line ' . $line . ' : ' . $ex->getMessage() . '</warning>');
} catch (PostalCodeNotValidException $ex) {
} catch (ExistingPostalCodeException|CountryCodeNotFoundException|PostalCodeNotValidException $ex) {
$output->writeln('<warning> on line ' . $line . ' : ' . $ex->getMessage() . '</warning>');
}
++$line;

View File

@@ -164,7 +164,7 @@ class ExportController extends AbstractController
{
$this->denyAccessUnlessGranted(SavedExportVoter::GENERATE, $savedExport);
$key = md5(uniqid((string) mt_rand(), false));
$key = md5(uniqid((string) random_int(0, mt_getrandmax()), false));
$this->redis->setEx($key, 3600, serialize($savedExport->getOptions()));
@@ -481,7 +481,7 @@ class ExportController extends AbstractController
'alias' => $alias,
];
unset($parameters['_token']);
$key = md5(uniqid((string) mt_rand(), false));
$key = md5(uniqid((string) random_int(0, mt_getrandmax()), false));
$this->redis->setEx($key, 3600, serialize($parameters));

View File

@@ -69,7 +69,7 @@ class LoadAddressReferences extends AbstractFixture implements ContainerAwareInt
$ar->setRefId($this->faker->numerify('ref-id-######'));
$ar->setStreet($this->faker->streetName);
$ar->setStreetNumber((string) mt_rand(0, 199));
$ar->setStreetNumber((string) random_int(0, 199));
$ar->setPoint($this->getRandomPoint());
$ar->setPostcode($this->getReference(
LoadPostalCodes::$refs[array_rand(LoadPostalCodes::$refs)]
@@ -89,8 +89,8 @@ class LoadAddressReferences extends AbstractFixture implements ContainerAwareInt
{
$lonBrussels = 4.35243;
$latBrussels = 50.84676;
$lon = $lonBrussels + 0.01 * mt_rand(-5, 5);
$lat = $latBrussels + 0.01 * mt_rand(-5, 5);
$lon = $lonBrussels + 0.01 * random_int(-5, 5);
$lat = $latBrussels + 0.01 * random_int(-5, 5);
return Point::fromLonLat($lon, $lat);
}

View File

@@ -38,11 +38,7 @@ class MenuCompilerPass implements CompilerPassInterface
}
usort($services, static function ($a, $b) {
if ($a['priority'] === $b['priority']) {
return 0;
}
return ($a['priority'] < $b['priority']) ? -1 : 1;
return $a['priority'] <=> $b['priority'];
});
foreach ($services as $service) {

View File

@@ -34,7 +34,7 @@ class ShortMessageCompilerPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
$config = $container->resolveEnvPlaceholders($container->getParameter('chill_main.short_messages', null), true);
$config = $container->resolveEnvPlaceholders($container->getParameter('chill_main.short_messages'), true);
// weird fix for special characters
$config['dsn'] = str_replace(['%%'], ['%'], $config['dsn']);
$dsn = parse_url($config['dsn']);
@@ -43,7 +43,7 @@ class ShortMessageCompilerPass implements CompilerPassInterface
if ('null' === $dsn['scheme'] || false === $config['enabled']) {
$defaultTransporter = new Reference(NullShortMessageSender::class);
} elseif ('ovh' === $dsn['scheme']) {
if (!class_exists('\Ovh\Api')) {
if (!class_exists('\\' . \Ovh\Api::class)) {
throw new RuntimeException('Class \\Ovh\\Api not found');
}
@@ -66,17 +66,17 @@ class ShortMessageCompilerPass implements CompilerPassInterface
$ovh = new Definition();
$ovh
->setClass('\Ovh\Api')
->setClass('\\' . \Ovh\Api::class)
->setArgument(0, $dsn['user'])
->setArgument(1, $dsn['pass'])
->setArgument(2, $dsn['host'])
->setArgument(3, $dsn['queries']['consumer_key']);
$container->setDefinition('Ovh\Api', $ovh);
$container->setDefinition(\Ovh\Api::class, $ovh);
$ovhSender = new Definition();
$ovhSender
->setClass(OvhShortMessageSender::class)
->setArgument(0, new Reference('Ovh\Api'))
->setArgument(0, new Reference(\Ovh\Api::class))
->setArgument(1, $dsn['queries']['service_name'])
->setArgument(2, $dsn['queries']['sender'])
->setArgument(3, new Reference(LoggerInterface::class))

View File

@@ -37,7 +37,7 @@ class Configuration implements ConfigurationInterface
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('chill_main');
$rootNode = $treeBuilder->getRootNode('chill_main');
$rootNode = $treeBuilder->getRootNode();
$rootNode
->children()

View File

@@ -193,8 +193,7 @@ abstract class AbstractWidgetsCompilerPass implements CompilerPassInterface
/** @var WidgetFactoryInterface $factory */
$factory = $this->widgetServices[$alias];
// get the config (under the key which equals to widget_alias
$config = isset($param[$factory->getWidgetAlias()]) ?
$param[$factory->getWidgetAlias()] : [];
$config = $param[$factory->getWidgetAlias()] ?? [];
// register the service into the container
$serviceId = $this->registerServiceIntoContainer(
$container,

View File

@@ -139,7 +139,7 @@ trait AddWidgetConfigurationTrait
protected function addWidgetsConfiguration(string $place, ContainerBuilder $containerBuilder)
{
$treeBuilder = new TreeBuilder($place);
$root = $treeBuilder->getRootNode($place)
$root = $treeBuilder->getRootNode()
->canBeUnset()
->info('register widgets on place "' . $place . '"');
@@ -170,7 +170,7 @@ trait AddWidgetConfigurationTrait
// adding the possible config on each widget under the widget_alias
foreach ($this->filterWidgetByPlace($place) as $factory) {
$builder = new TreeBuilder($factory->getWidgetAlias());
$widgetOptionsRoot = $builder->getRootNode($factory->getWidgetAlias());
$widgetOptionsRoot = $builder->getRootNode();
$widgetOptionsRoot->canBeUnset()
->info(sprintf(
'the configuration for the widget "%s" (only required if this widget is set in widget_alias)',

View File

@@ -527,28 +527,20 @@ class Address
/**
* Set streetAddress1 (legacy function).
*
* @param string $streetAddress1
*
* @return Address
*/
public function setStreetAddress1($streetAddress1)
public function setStreetAddress1(?string $streetAddress1): self
{
$this->street = null === $streetAddress1 ? '' : $streetAddress1;
$this->street = (string) $streetAddress1;
return $this;
}
/**
* Set streetAddress2 (legacy function).
*
* @param string $streetAddress2
*
* @return Address
*/
public function setStreetAddress2($streetAddress2)
public function setStreetAddress2(?string $streetAddress2): self
{
$this->streetNumber = null === $streetAddress2 ? '' : $streetAddress2;
$this->streetNumber = (string) $streetAddress2;
return $this;
}

View File

@@ -45,7 +45,7 @@ class PrivateCommentEmbeddable
public function merge(PrivateCommentEmbeddable $newComment): self
{
$currentComments = null === $this->getComments() ? [] : $this->getComments();
$currentComments = $this->getComments() ?? [];
$mergedComments = $newComment->getComments() + $currentComments;

View File

@@ -435,7 +435,7 @@ class SpreadSheetFormatter implements FormatterInterface
* Get the displayable result.
*
* @param string $key
* @param string $value
* @param mixed $value
*
* @return string
*/
@@ -445,7 +445,7 @@ class SpreadSheetFormatter implements FormatterInterface
$this->initializeCache($key);
}
$value = null === $value ? '' : $value;
$value = $value ?? '';
return call_user_func($this->cacheDisplayableResult[$key], $value);
}

View File

@@ -30,7 +30,7 @@ class CenterType extends AbstractType
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => 'Chill\MainBundle\Entity\Center',
'data_class' => \Chill\MainBundle\Entity\Center::class,
]);
}

View File

@@ -75,7 +75,7 @@ final class LocationFormType extends AbstractType
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => 'Chill\MainBundle\Entity\Location',
'data_class' => \Chill\MainBundle\Entity\Location::class,
]);
}

View File

@@ -60,7 +60,7 @@ class PermissionsGroupType extends AbstractType
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => 'Chill\MainBundle\Entity\PermissionsGroup',
'data_class' => \Chill\MainBundle\Entity\PermissionsGroup::class,
]);
}

View File

@@ -36,7 +36,7 @@ class ScopeType extends AbstractType
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => 'Chill\MainBundle\Entity\Scope',
'data_class' => \Chill\MainBundle\Entity\Scope::class,
]);
}

View File

@@ -83,8 +83,8 @@ trait AppendScopeChoiceTypeTrait
{
$resolver
->setRequired(['center', 'role'])
->setAllowedTypes('center', 'Chill\MainBundle\Entity\Center')
->setAllowedTypes('role', 'Symfony\Component\Security\Core\Role\Role');
->setAllowedTypes('center', \Chill\MainBundle\Entity\Center::class)
->setAllowedTypes('role', 'string');
}
/**

View File

@@ -23,12 +23,12 @@ class ComposedGroupCenterType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('permissionsgroup', EntityType::class, [
'class' => 'Chill\MainBundle\Entity\PermissionsGroup',
'class' => \Chill\MainBundle\Entity\PermissionsGroup::class,
'choice_label' => static function (PermissionsGroup $group) {
return $group->getName();
},
])->add('center', EntityType::class, [
'class' => 'Chill\MainBundle\Entity\Center',
'class' => \Chill\MainBundle\Entity\Center::class,
'choice_label' => static function (Center $center) {
return $center->getName();
},
@@ -37,7 +37,7 @@ class ComposedGroupCenterType extends AbstractType
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefault('data_class', 'Chill\MainBundle\Entity\GroupCenter');
$resolver->setDefault('data_class', \Chill\MainBundle\Entity\GroupCenter::class);
}
public function getBlockPrefix()

View File

@@ -98,6 +98,6 @@ class ComposedRoleScopeType extends AbstractType
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefault('data_class', 'Chill\MainBundle\Entity\RoleScope');
$resolver->setDefault('data_class', \Chill\MainBundle\Entity\RoleScope::class);
}
}

View File

@@ -77,7 +77,7 @@ class Select2CountryType extends AbstractType
asort($choices, SORT_STRING | SORT_FLAG_CASE);
$resolver->setDefaults([
'class' => 'Chill\MainBundle\Entity\Country',
'class' => \Chill\MainBundle\Entity\Country::class,
'choices' => array_combine(array_values($choices), array_keys($choices)),
'preferred_choices' => array_combine(array_values($preferredChoices), array_keys($preferredChoices)),
]);

View File

@@ -73,7 +73,7 @@ class Select2LanguageType extends AbstractType
asort($choices, SORT_STRING | SORT_FLAG_CASE);
$resolver->setDefaults([
'class' => 'Chill\MainBundle\Entity\Language',
'class' => \Chill\MainBundle\Entity\Language::class,
'choices' => array_combine(array_values($choices), array_keys($choices)),
'preferred_choices' => array_combine(array_values($preferredChoices), array_keys($preferredChoices)),
]);

View File

@@ -167,7 +167,7 @@ class UserType extends AbstractType
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => 'Chill\MainBundle\Entity\User',
'data_class' => \Chill\MainBundle\Entity\User::class,
]);
$resolver

View File

@@ -196,7 +196,7 @@ class WorkflowStepType extends AbstractType
public function configureOptions(OptionsResolver $resolver)
{
$resolver
->setDefined('class', EntityWorkflowStep::class)
->setDefined('class')
->setRequired('transition')
->setAllowedTypes('transition', 'bool')
->setRequired('entity_workflow')

View File

@@ -78,9 +78,8 @@ class PaginatorFactory
$totalItems,
$this->getCurrentItemsPerPage(),
$this->getCurrentPageNumber(),
null === $route ? $this->getCurrentRoute() : $route,
null === $routeParameters ? $this->getCurrentRouteParameters() :
$routeParameters,
$route ?? $this->getCurrentRoute(),
$routeParameters ?? $this->getCurrentRouteParameters(),
$this->router,
self::DEFAULT_CURRENT_PAGE_KEY,
self::DEFAULT_ITEM_PER_NUMBER_KEY

View File

@@ -91,11 +91,7 @@ class SearchProvider
{
//sort the array
uasort($this->searchServices, static function (SearchInterface $a, SearchInterface $b) {
if ($a->getOrder() === $b->getOrder()) {
return 0;
}
return ($a->getOrder() < $b->getOrder()) ? -1 : 1;
return $a->getOrder() <=> $b->getOrder();
});
return $this->searchServices;
@@ -124,11 +120,7 @@ class SearchProvider
{
//sort the array
uasort($this->hasAdvancedFormSearchServices, static function (SearchInterface $a, SearchInterface $b) {
if ($a->getOrder() === $b->getOrder()) {
return 0;
}
return ($a->getOrder() < $b->getOrder()) ? -1 : 1;
return $a->getOrder() <=> $b->getOrder();
});
return $this->hasAdvancedFormSearchServices;

View File

@@ -41,7 +41,7 @@ class RefreshAddressToGeographicalUnitMaterializedViewCronJob implements CronJob
return $cronJobExecution->getLastStart() < $now->sub(new DateInterval('P1D'))
// introduce a random component to ensure a roll when multiple instances are hosted on same machines
&& mt_rand(0, 10) === 0;
&& random_int(0, 10) === 0;
}
public function getKey(): string

View File

@@ -66,11 +66,11 @@ class PostalCodeBEFromBestAddress
gzclose($uncompressedStream);
unlink($tmpname);
$this->logger->info(__CLASS__ . ' list of postal code downloaded');
$this->logger->info(self::class . ' list of postal code downloaded');
$this->baseImporter->finalize();
$this->logger->info(__CLASS__ . ' postal code fetched', ['offset' => $offset ?? 0]);
$this->logger->info(self::class . ' postal code fetched', ['offset' => $offset ?? 0]);
}
private function getFileDownloadUrl(string $lang): string

View File

@@ -73,7 +73,7 @@ class PostalCodeFRFromOpenData
$this->baseImporter->finalize();
fclose($tmpfile);
$this->logger->info(__CLASS__ . ' postal code fetched', ['offset' => $offset ?? 0]);
$this->logger->info(self::class . ' postal code fetched', ['offset' => $offset ?? 0]);
}
private function handleRecord(array $record): void

View File

@@ -243,7 +243,7 @@ abstract class AbstractAggregatorTest extends KernelTestCase
$result = $results[0];
$this->assertTrue(
$result instanceof Traversable || is_array($result),
is_iterable($result),
'test that each row in the result is traversable or an array'
);

View File

@@ -230,7 +230,7 @@ abstract class AbstractExportTest extends WebTestCase
$result = $results[0];
$this->assertTrue(
$result instanceof Traversable || is_array($result),
is_iterable($result),
'test that each row in the result is traversable or an array'
);

View File

@@ -38,7 +38,7 @@ trait PrepareCenterTrait
}
$center = $this->centerProphet->prophesize();
$center->willExtend('\Chill\MainBundle\Entity\Center');
$center->willExtend('\\' . \Chill\MainBundle\Entity\Center::class);
$center->getId()->willReturn($id);
$center->getName()->willReturn($name);

View File

@@ -38,7 +38,7 @@ trait PrepareCircleTrait
}
$scope = $this->circleProphet->prophesize();
$scope->willExtend('\Chill\MainBundle\Entity\Scope');
$scope->willExtend('\\' . \Chill\MainBundle\Entity\Scope::class);
$scope->getId()->willReturn($id);
$scope->getName()->willReturn($name);

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'));