cs: Enable more risky rules.

This commit is contained in:
Pol Dellaiera
2021-11-30 11:28:52 +01:00
parent 3631fd99fd
commit c8195e6df5
65 changed files with 155 additions and 139 deletions

View File

@@ -150,7 +150,7 @@ class ChillUserSendRenewPasswordCodeCommand extends Command
protected function getUser($row)
{
/* @var $userRepository \Chill\MainBundle\Repository\UserRepository */
/** @var \Chill\MainBundle\Repository\UserRepository $userRepository */
$userRepository = $this->em->getRepository(User::class);
try {

View File

@@ -52,8 +52,9 @@ class LoadAndUpdateLanguagesCommand extends Command
parent::__construct();
}
/*
* (non-PHPdoc)
/**
* (non-PHPdoc).
*
* @see \Symfony\Component\Console\Command\Command::configure()
*/
protected function configure()
@@ -78,8 +79,9 @@ class LoadAndUpdateLanguagesCommand extends Command
);
}
/*
* (non-PHPdoc)
/**
* (non-PHPdoc).
*
* @see \Symfony\Component\Console\Command\Command::execute()
*/
protected function execute(InputInterface $input, OutputInterface $output)

View File

@@ -62,8 +62,9 @@ class LoadCountriesCommand extends Command
return $countryEntities;
}
/*
* (non-PHPdoc)
/**
* (non-PHPdoc).
*
* @see \Symfony\Component\Console\Command\Command::configure()
*/
protected function configure()
@@ -73,8 +74,9 @@ class LoadCountriesCommand extends Command
'but will update names according to available languages');
}
/*
* (non-PHPdoc)
/**
* (non-PHPdoc).
*
* @see \Symfony\Component\Console\Command\Command::execute()
*/
protected function execute(InputInterface $input, OutputInterface $output)

View File

@@ -80,7 +80,7 @@ class ExportController extends AbstractController
public function downloadResultAction(Request $request, $alias)
{
/* @var $exportManager \Chill\MainBundle\Export\ExportManager */
/** @var \Chill\MainBundle\Export\ExportManager $exportManager */
$exportManager = $this->exportManager;
$key = $request->query->get('key', null);
@@ -118,7 +118,7 @@ class ExportController extends AbstractController
*/
public function generateAction(Request $request, $alias)
{
/* @var $exportManager \Chill\MainBundle\Export\ExportManager */
/** @var \Chill\MainBundle\Export\ExportManager $exportManager */
$exportManager = $this->exportManager;
$key = $request->query->get('key', null);
@@ -212,7 +212,7 @@ class ExportController extends AbstractController
*/
protected function createCreateFormExport($alias, $step, $data = [])
{
/* @var $exportManager \Chill\MainBundle\Export\ExportManager */
/** @var \Chill\MainBundle\Export\ExportManager $exportManager */
$exportManager = $this->exportManager;
$isGenerate = strpos($step, 'generate_') === 0;
@@ -466,7 +466,7 @@ class ExportController extends AbstractController
*/
protected function selectCentersStep(Request $request, $export, $alias)
{
/* @var $exportManager \Chill\MainBundle\Export\ExportManager */
/** @var \Chill\MainBundle\Export\ExportManager $exportManager */
$exportManager = $this->exportManager;
$form = $this->createCreateFormExport($alias, 'centers');

View File

@@ -175,7 +175,7 @@ class PasswordController extends AbstractController
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
/* @var $qb \Doctrine\ORM\QueryBuilder */
/** @var \Doctrine\ORM\QueryBuilder $qb */
$qb = $this->getDoctrine()->getManager()
->createQueryBuilder();
$qb->select('u')

View File

@@ -143,7 +143,7 @@ class PermissionsGroupController extends AbstractController
$roleScopesSorted = [];
foreach ($permissionsGroup->getRoleScopes()->toArray() as $roleScope) {
/* @var $roleScope RoleScope */
/** @var RoleScope $roleScope */
$title = $roleProvider->getRoleTitle($roleScope->getRole());
$roleScopesSorted[$title][] = $roleScope;
}
@@ -290,7 +290,7 @@ class PermissionsGroupController extends AbstractController
$roleScopesSorted = [];
foreach ($permissionsGroup->getRoleScopes()->toArray() as $roleScope) {
/* @var $roleScope RoleScope */
/** @var RoleScope $roleScope */
$title = $roleProvider->getRoleTitle($roleScope->getRole());
$roleScopesSorted[$title][] = $roleScope;
}
@@ -378,7 +378,7 @@ class PermissionsGroupController extends AbstractController
$roleScopesSorted = [];
foreach ($roleScopes as $roleScope) {
/* @var $roleScope RoleScope */
/** @var RoleScope $roleScope */
$title = $roleProvider->getRoleTitle($roleScope->getRole());
$roleScopesSorted[$title][] = $roleScope;
}
@@ -434,7 +434,7 @@ class PermissionsGroupController extends AbstractController
$roleScopesSorted = [];
foreach ($permissionsGroup->getRoleScopes()->toArray() as $roleScope) {
/* @var $roleScope RoleScope */
/** @var RoleScope $roleScope */
$title = $roleProvider->getRoleTitle($roleScope->getRole());
$roleScopesSorted[$title][] = $roleScope;
}

View File

@@ -56,9 +56,9 @@ class SearchController extends AbstractController
public function advancedSearchAction($name, Request $request)
{
try {
/* @var $variable Chill\MainBundle\Search\SearchProvider */
/** @var Chill\MainBundle\Search\SearchProvider $variable */
$searchProvider = $this->searchProvider;
/* @var $variable Chill\MainBundle\Search\HasAdvancedSearchFormInterface */
/** @var Chill\MainBundle\Search\HasAdvancedSearchFormInterface $variable */
$search = $this->searchProvider
->getHasAdvancedFormByName($name);
} catch (\Chill\MainBundle\Search\UnknowSearchNameException $e) {
@@ -100,7 +100,7 @@ class SearchController extends AbstractController
public function advancedSearchListAction(Request $request)
{
/* @var $variable Chill\MainBundle\Search\SearchProvider */
/** @var Chill\MainBundle\Search\SearchProvider $variable */
$searchProvider = $this->searchProvider;
$advancedSearchProviders = $searchProvider
->getHasAdvancedFormSearchServices();

View File

@@ -16,8 +16,9 @@ use Symfony\Component\DependencyInjection\Reference;
class SearchableServicesCompilerPass implements CompilerPassInterface
{
/*
* (non-PHPdoc)
/**
* (non-PHPdoc).
*
* @see \Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface::process()
*/
public function process(ContainerBuilder $container)

View File

@@ -135,7 +135,7 @@ abstract class AbstractWidgetsCompilerPass implements CompilerPassInterface
$managerDefinition = $container->getDefinition(self::WIDGET_MANAGER);
// collect the widget factories
/* @var $extensionClass HasWidgetFactoriesExtensionInterface */
/** @var HasWidgetFactoriesExtensionInterface $extensionClass */
$extensionClass = $container->getExtension($extension);
// throw an error if extension does not implement HasWidgetFactoriesExtensionInterface
if (!$extensionClass instanceof HasWidgetFactoriesExtensionInterface) {
@@ -182,7 +182,7 @@ abstract class AbstractWidgetsCompilerPass implements CompilerPassInterface
// register the widget with config to the service, using the method
// `addWidget`
if ($this->widgetServices[$alias] instanceof WidgetFactoryInterface) {
/* @var $factory WidgetFactoryInterface */
/** @var WidgetFactoryInterface $factory */
$factory = $this->widgetServices[$alias];
// get the config (under the key which equals to widget_alias
$config = isset($param[$factory->getWidgetAlias()]) ?
@@ -263,7 +263,7 @@ abstract class AbstractWidgetsCompilerPass implements CompilerPassInterface
// add the services defined by factories
foreach ($this->widgetFactories as $factory) {
/* @var $factory WidgetFactoryInterface */
/** @var WidgetFactoryInterface $factory */
$alias = $factory->getWidgetAlias();
// check the alias is not empty

View File

@@ -285,7 +285,7 @@ class ExportManager
);
}
/* @var $formatter FormatterInterface */
/** @var FormatterInterface $formatter */
$formatter = $this->getFormatter($this->getFormatterAlias($data));
$filtersData = [];
$aggregatorsData = [];

View File

@@ -216,9 +216,9 @@ class CSVFormatter implements FormatterInterface
$columnKeysNb = count($this->getColumnHeaders());
$resultsKeysNb = count($this->export->getQueryKeys($this->exportData));
$results = $this->getOrderedResults();
/* @var $columnHeaders string[] the column headers associations */
/** @var string[] $columnHeaders the column headers associations */
$columnHeaders = [];
/* @var $data string[] the data of the csv file */
/** @var string[] $data the data of the csv file */
$contentData = [];
$content = [];
@@ -253,7 +253,7 @@ class CSVFormatter implements FormatterInterface
}
// add the column headers
/* @var $columns string[] the column for this row */
/** @var string[] $columns the column for this row */
$columns = array_slice($row, $rowKeysNb, $columnKeysNb);
$columnPosition = $this->findColumnPosition($columnHeaders, $columns);

View File

@@ -73,7 +73,7 @@ class SearchProvider
throw new UnknowSearchNameException($name);
}
/*
/**
* return search services in an array, ordered by
* the order key (defined in service definition)
* the conflicts in keys (twice the same order) are resolved
@@ -83,7 +83,6 @@ class SearchProvider
*
* @return SearchInterface[], with an int as array key
*/
public function getByOrder()
{
//sort the array

View File

@@ -20,21 +20,23 @@ use Twig\TwigFilter;
*/
class CSVCellTwig extends AbstractExtension
{
/*
* Replace into a string the char " by ""
/**
* Replace into a string the char " by "".
*
* @param String $content The input string.
* @return String The safe string.
* @param string $content The input string.
*
* @return string The safe string.
*/
public function csvCellFilter($content)
{
return str_replace('"', '""', $content);
}
/*
/**
* Returns a list of filters to add to the existing list.
*
* (non-PHPdoc)
*
* @see Twig_Extension::getFilters()
*/
public function getFilters()
@@ -48,7 +50,7 @@ class CSVCellTwig extends AbstractExtension
];
}
/*
/**
* Returns the name of the extension.
*
* @return The name of the extension.

View File

@@ -30,10 +30,11 @@ class TranslatableStringTwig extends AbstractExtension
$this->helper = $translatableStringHelper;
}
/*
/**
* Returns a list of filters to add to the existing list.
*
* (non-PHPdoc)
*
* @see Twig_Extension::getFilters()
*/
public function getFilters()
@@ -45,7 +46,7 @@ class TranslatableStringTwig extends AbstractExtension
), ];
}
/*
/**
* Returns the name of the extension.
*
* @return The name of the extension.

View File

@@ -114,7 +114,7 @@ class WidgetRenderingTwig extends AbstractExtension
$content = '';
foreach ($this->getWidgetsArraysOrdered($block) as $a) {
/* @var $widget Widget\WidgetInterface */
/** @var Widget\WidgetInterface $widget */
$widget = $a[0];
$config = $a[1];

View File

@@ -325,7 +325,7 @@ abstract class AbstractExportTest extends WebTestCase
*/
public function testListExportPage()
{
/* @var $client \Symfony\Component\BrowserKit\Client */
/** @var \Symfony\Component\BrowserKit\Client $client */
$client = $this->getClient();
$export = $this->getExport();
$prophet = new \Prophecy\Prophet();

View File

@@ -157,7 +157,7 @@ class UserControllerTest extends WebTestCase
protected function isPasswordValid($username, $password)
{
/* @var $passwordEncoder \Symfony\Component\Security\Core\Encoder\UserPasswordEncoder */
/** @var \Symfony\Component\Security\Core\Encoder\UserPasswordEncoder $passwordEncoder */
$passwordEncoder = self::$container
->get(UserPasswordEncoderInterface::class);

View File

@@ -32,7 +32,7 @@ class UserCircleConsistencyValidator extends ConstraintValidator
*/
public function validate($value, Constraint $constraint)
{
/* @var $user \Chill\MainBundle\Entity\User */
/** @var \Chill\MainBundle\Entity\User $user */
$user = call_user_func([$value, $constraint->getUserFunction]);
if (null === $user) {