phpstan en rector fixes

This commit is contained in:
Julie Lenaerts 2024-05-22 16:42:47 +02:00
parent 2895638f3b
commit 9ce1788a14
16 changed files with 75 additions and 107 deletions

View File

@ -49,17 +49,13 @@ interface CustomFieldInterface
/**
* Return if the value can be considered as empty.
*
* @param mixed $value the value passed throug the deserialize function
*/
public function isEmptyValue(mixed $value, CustomField $customField);
/**
* Return a repsentation of the value of the CustomField.
*
* @param mixed $value the raw value, **not deserialized** (= as stored in the db)
* @param \Chill\CustomFieldsBundle\CustomField\CustomField $customField
*
* @return string an html representation of the value
*/
public function render(mixed $value, CustomField $customField, $documentType = 'html');

View File

@ -399,8 +399,6 @@ final class CustomFieldsChoiceTest extends KernelTestCase
/**
* @dataProvider emptyDataProvider
*
* @param mixed $data deserialized data
*/
public function testIsEmptyValueEmpty(mixed $data)
{

View File

@ -201,7 +201,6 @@ class EventTypeController extends AbstractController
/**
* Creates a form to delete a EventType entity by id.
*
* @param mixed $id The entity id
*
* @return \Symfony\Component\Form\Form The form
*/

View File

@ -201,7 +201,6 @@ class RoleController extends AbstractController
/**
* Creates a form to delete a Role entity by id.
*
* @param mixed $id The entity id
*
* @return \Symfony\Component\Form\Form The form
*/

View File

@ -201,7 +201,6 @@ class StatusController extends AbstractController
/**
* Creates a form to delete a Status entity by id.
*
* @param mixed $id The entity id
*
* @return \Symfony\Component\Form\Form The form
*/

View File

@ -16,6 +16,7 @@ use GuzzleHttp\Exception\ClientException;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Utils;
use Psr\Log\LoggerInterface;
use Symfony\Component\HttpFoundation\Response;
/**
* Queries for ROME partenaires api.
@ -81,11 +82,14 @@ class PartenaireRomeAppellation
$this->client,
$this->logger
);
return Utils::jsonDecode((string) $response->getBody());
} catch (ClientException $e) {
dump($e->getResponse()->getBody()->getContents());
}
return Utils::jsonDecode((string) $response->getBody());
return new Response('No appellation found');
}
public function getAppellation($code)

View File

@ -51,9 +51,6 @@ class ChillJobExtension extends Extension implements PrependExtensionInterface
$loader->load('services/export.yml');
$loader->load('services/menu.yml');
$loader->load('services/security.yml');
// exports: list_CSperson override list_person
$container->setAlias('chill.person.export.list_person', \Chill\JobBundle\Export\ListCSPerson::class);
}
public function prepend(ContainerBuilder $container): void

View File

@ -113,8 +113,8 @@ class AddCSPersonToPersonListHelper implements CustomizeListPersonHelperInterfac
public function getLabels(string $key, array $values, array $data): ?callable
{
switch ($key) {
case str_contains($key, '__'):
if (str_contains($key, '__'))
{
return function (string|bool|null $value) use ($key): string {
if ('_header' === $value) {
[$domain, $v] = explode('__', $key);
@ -122,39 +122,33 @@ class AddCSPersonToPersonListHelper implements CustomizeListPersonHelperInterfac
return 'export.list.cs_person.'.$domain.'.'.$v;
}
if ('1' === $value || true === $value || 1 === $value || 't' === $value) {
if ('1' === $value || true === $value || 't' === $value) {
return 'x';
}
return '';
};
case 'nEETEligibilite':
return function (string|bool|null $value): string {
}
return match ($key) {
'nEETEligibilite' => function (string|bool|null $value): string {
if ('_header' === $value) {
return 'export.list.cs_person.neet_eligibility';
}
if ('1' === $value || true === $value || 1 === $value || 't' === $value) {
if ('1' === $value || true === $value || 't' === $value) {
return 'x';
}
return '';
};
case 'situationProfessionnelle':
return function ($value) {
},
'situationProfessionnelle' => function ($value) {
if ('_header' === $value) {
return 'export.list.cs_person.situation_professionelle';
}
return $value;
};
case 'cerinscriptiondate':
case 'ppaeinscriptiondate':
case 'neetcommissiondate':
case 'findernieremploidate':
case 'cafinscriptiondate':
case 'contratiejdate':
return function ($value) use ($key) {
},
'cerinscriptiondate', 'ppaeinscriptiondate', 'neetcommissiondate', 'findernieremploidate', 'cafinscriptiondate', 'contratiejdate' => function ($value) use ($key) {
if ('_header' === $value) {
return $this->translator->trans($key);
}
@ -181,17 +175,14 @@ class AddCSPersonToPersonListHelper implements CustomizeListPersonHelperInterfac
}
return $date;
};
default:
// for fields which are associated with person
return function ($value) use ($key) {
},
default => function ($value) use ($key) {
if ('_header' === $value) {
return $this->translator->trans($key);
}
return $value;
},
};
}
}
}

View File

@ -725,10 +725,8 @@ class CRUDController extends AbstractController
* and view.
*
* @param string $action
* @param mixed $entity the entity for the current request, or an array of entities
*
* @return string the path to the template
*
* @throws \LogicException if no template are available
*/
protected function getTemplateFor($action, mixed $entity, Request $request)

View File

@ -442,8 +442,6 @@ final class PermissionsGroupController extends AbstractController
/**
* Creates a form to delete a link to roleScope.
*
* @param mixed $permissionsGroup The entity id
*/
private function createDeleteRoleScopeForm(
PermissionsGroup $permissionsGroup,

View File

@ -73,7 +73,6 @@ interface AggregatorInterface extends ModifierInterface
*
* @param string $key The column key, as added in the query
* @param mixed[] $values The values from the result. if there are duplicates, those might be given twice. Example: array('FR', 'BE', 'CZ', 'FR', 'BE', 'FR')
* @param mixed $data The data from the export's form (as defined in `buildForm`
*
* @return \Closure where the first argument is the value, and the function should return the label to show in the formatted file. Example : `function($countryCode) use ($countries) { return $countries[$countryCode]->getName(); }`
*/

View File

@ -30,8 +30,6 @@ interface ExportElementValidatedInterface
/**
* validate the form's data and, if required, build a contraint
* violation on the data.
*
* @param mixed $data the data, as returned by the user
*/
public function validateForm(mixed $data, ExecutionContextInterface $context);
}

View File

@ -96,7 +96,6 @@ interface ExportInterface extends ExportElementInterface
*
* @param string $key The column key, as added in the query
* @param mixed[] $values The values from the result. if there are duplicates, those might be given twice. Example: array('FR', 'BE', 'CZ', 'FR', 'BE', 'FR')
* @param mixed $data The data from the export's form (as defined in `buildForm`)
*
* @return (callable(string|int|float|'_header'|null $value): string|int|\DateTimeInterface) where the first argument is the value, and the function should return the label to show in the formatted file. Example : `function($countryCode) use ($countries) { return $countries[$countryCode]->getName(); }`
*/

View File

@ -552,9 +552,7 @@ class ExportManager
*
* This function check the acl.
*
* @param mixed $data the data under the initial 'filters' data
* @param \Chill\MainBundle\Entity\Center[] $centers the picked centers
*
* @throw UnauthorizedHttpException if the user is not authorized
*/
private function handleFilters(
@ -615,9 +613,6 @@ class ExportManager
return $usedTypes;
}
/**
* @param mixed $data the data from the filter key of the ExportType
*/
private function retrieveUsedFilters(mixed $data): iterable
{
if (null === $data) {
@ -634,7 +629,6 @@ class ExportManager
/**
* Retrieve the filter used in this export.
*
* @param mixed $data the data from the `filters` key of the ExportType
*
* @return array an array with types
*/

View File

@ -257,10 +257,10 @@ class SearchProvider
$this->mustBeExtracted[] = $matches[0][$key];
// strip parenthesis
if (
'"' === mb_substr((string) $match, 0, 1)
&& '"' === mb_substr((string) $match, mb_strlen((string) $match) - 1)
'"' === mb_substr($match, 0, 1)
&& '"' === mb_substr($match, mb_strlen($match) - 1)
) {
$match = trim(mb_substr((string) $match, 1, mb_strlen((string) $match) - 2));
$match = trim(mb_substr($match, 1, mb_strlen($match) - 2));
}
$terms[$matches[1][$key]] = $match;
}

View File

@ -198,7 +198,6 @@ class AuthorizationHelper implements AuthorizationHelperInterface
* if the entity implements Chill\MainBundle\Entity\HasScopeInterface,
* the scope is taken into account.
*
* @param mixed $entity the entity may also implement HasScopeInterface
*
* @return bool true if the user has access
*/