mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-28 21:16:13 +00:00
phpstan en rector fixes
This commit is contained in:
parent
2895638f3b
commit
9ce1788a14
@ -49,17 +49,13 @@ interface CustomFieldInterface
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return if the value can be considered as empty.
|
* 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);
|
public function isEmptyValue(mixed $value, CustomField $customField);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a repsentation of the value of the 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
|
* @param \Chill\CustomFieldsBundle\CustomField\CustomField $customField
|
||||||
*
|
|
||||||
* @return string an html representation of the value
|
* @return string an html representation of the value
|
||||||
*/
|
*/
|
||||||
public function render(mixed $value, CustomField $customField, $documentType = 'html');
|
public function render(mixed $value, CustomField $customField, $documentType = 'html');
|
||||||
|
@ -399,8 +399,6 @@ final class CustomFieldsChoiceTest extends KernelTestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider emptyDataProvider
|
* @dataProvider emptyDataProvider
|
||||||
*
|
|
||||||
* @param mixed $data deserialized data
|
|
||||||
*/
|
*/
|
||||||
public function testIsEmptyValueEmpty(mixed $data)
|
public function testIsEmptyValueEmpty(mixed $data)
|
||||||
{
|
{
|
||||||
|
@ -201,7 +201,6 @@ class EventTypeController extends AbstractController
|
|||||||
/**
|
/**
|
||||||
* Creates a form to delete a EventType entity by id.
|
* Creates a form to delete a EventType entity by id.
|
||||||
*
|
*
|
||||||
* @param mixed $id The entity id
|
|
||||||
*
|
*
|
||||||
* @return \Symfony\Component\Form\Form The form
|
* @return \Symfony\Component\Form\Form The form
|
||||||
*/
|
*/
|
||||||
|
@ -201,7 +201,6 @@ class RoleController extends AbstractController
|
|||||||
/**
|
/**
|
||||||
* Creates a form to delete a Role entity by id.
|
* Creates a form to delete a Role entity by id.
|
||||||
*
|
*
|
||||||
* @param mixed $id The entity id
|
|
||||||
*
|
*
|
||||||
* @return \Symfony\Component\Form\Form The form
|
* @return \Symfony\Component\Form\Form The form
|
||||||
*/
|
*/
|
||||||
|
@ -201,7 +201,6 @@ class StatusController extends AbstractController
|
|||||||
/**
|
/**
|
||||||
* Creates a form to delete a Status entity by id.
|
* Creates a form to delete a Status entity by id.
|
||||||
*
|
*
|
||||||
* @param mixed $id The entity id
|
|
||||||
*
|
*
|
||||||
* @return \Symfony\Component\Form\Form The form
|
* @return \Symfony\Component\Form\Form The form
|
||||||
*/
|
*/
|
||||||
|
@ -16,6 +16,7 @@ use GuzzleHttp\Exception\ClientException;
|
|||||||
use GuzzleHttp\Psr7\Request;
|
use GuzzleHttp\Psr7\Request;
|
||||||
use GuzzleHttp\Utils;
|
use GuzzleHttp\Utils;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Queries for ROME partenaires api.
|
* Queries for ROME partenaires api.
|
||||||
@ -81,11 +82,14 @@ class PartenaireRomeAppellation
|
|||||||
$this->client,
|
$this->client,
|
||||||
$this->logger
|
$this->logger
|
||||||
);
|
);
|
||||||
|
|
||||||
|
return Utils::jsonDecode((string) $response->getBody());
|
||||||
|
|
||||||
} catch (ClientException $e) {
|
} catch (ClientException $e) {
|
||||||
dump($e->getResponse()->getBody()->getContents());
|
dump($e->getResponse()->getBody()->getContents());
|
||||||
}
|
}
|
||||||
|
|
||||||
return Utils::jsonDecode((string) $response->getBody());
|
return new Response('No appellation found');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAppellation($code)
|
public function getAppellation($code)
|
||||||
|
@ -51,9 +51,6 @@ class ChillJobExtension extends Extension implements PrependExtensionInterface
|
|||||||
$loader->load('services/export.yml');
|
$loader->load('services/export.yml');
|
||||||
$loader->load('services/menu.yml');
|
$loader->load('services/menu.yml');
|
||||||
$loader->load('services/security.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
|
public function prepend(ContainerBuilder $container): void
|
||||||
|
@ -113,8 +113,8 @@ class AddCSPersonToPersonListHelper implements CustomizeListPersonHelperInterfac
|
|||||||
|
|
||||||
public function getLabels(string $key, array $values, array $data): ?callable
|
public function getLabels(string $key, array $values, array $data): ?callable
|
||||||
{
|
{
|
||||||
switch ($key) {
|
if (str_contains($key, '__'))
|
||||||
case str_contains($key, '__'):
|
{
|
||||||
return function (string|bool|null $value) use ($key): string {
|
return function (string|bool|null $value) use ($key): string {
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
[$domain, $v] = explode('__', $key);
|
[$domain, $v] = explode('__', $key);
|
||||||
@ -122,39 +122,33 @@ class AddCSPersonToPersonListHelper implements CustomizeListPersonHelperInterfac
|
|||||||
return 'export.list.cs_person.'.$domain.'.'.$v;
|
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 'x';
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
};
|
};
|
||||||
case 'nEETEligibilite':
|
}
|
||||||
return function (string|bool|null $value): string {
|
return match ($key) {
|
||||||
|
'nEETEligibilite' => function (string|bool|null $value): string {
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
return 'export.list.cs_person.neet_eligibility';
|
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 'x';
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
};
|
},
|
||||||
case 'situationProfessionnelle':
|
'situationProfessionnelle' => function ($value) {
|
||||||
return function ($value) {
|
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
return 'export.list.cs_person.situation_professionelle';
|
return 'export.list.cs_person.situation_professionelle';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $value;
|
return $value;
|
||||||
};
|
},
|
||||||
case 'cerinscriptiondate':
|
'cerinscriptiondate', 'ppaeinscriptiondate', 'neetcommissiondate', 'findernieremploidate', 'cafinscriptiondate', 'contratiejdate' => function ($value) use ($key) {
|
||||||
case 'ppaeinscriptiondate':
|
|
||||||
case 'neetcommissiondate':
|
|
||||||
case 'findernieremploidate':
|
|
||||||
case 'cafinscriptiondate':
|
|
||||||
case 'contratiejdate':
|
|
||||||
return function ($value) use ($key) {
|
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
return $this->translator->trans($key);
|
return $this->translator->trans($key);
|
||||||
}
|
}
|
||||||
@ -181,17 +175,14 @@ class AddCSPersonToPersonListHelper implements CustomizeListPersonHelperInterfac
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $date;
|
return $date;
|
||||||
};
|
},
|
||||||
|
default => function ($value) use ($key) {
|
||||||
default:
|
|
||||||
// for fields which are associated with person
|
|
||||||
return function ($value) use ($key) {
|
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
return $this->translator->trans($key);
|
return $this->translator->trans($key);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $value;
|
return $value;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -725,10 +725,8 @@ class CRUDController extends AbstractController
|
|||||||
* and view.
|
* and view.
|
||||||
*
|
*
|
||||||
* @param string $action
|
* @param string $action
|
||||||
* @param mixed $entity the entity for the current request, or an array of entities
|
|
||||||
*
|
*
|
||||||
* @return string the path to the template
|
* @return string the path to the template
|
||||||
*
|
|
||||||
* @throws \LogicException if no template are available
|
* @throws \LogicException if no template are available
|
||||||
*/
|
*/
|
||||||
protected function getTemplateFor($action, mixed $entity, Request $request)
|
protected function getTemplateFor($action, mixed $entity, Request $request)
|
||||||
|
@ -442,8 +442,6 @@ final class PermissionsGroupController extends AbstractController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a form to delete a link to roleScope.
|
* Creates a form to delete a link to roleScope.
|
||||||
*
|
|
||||||
* @param mixed $permissionsGroup The entity id
|
|
||||||
*/
|
*/
|
||||||
private function createDeleteRoleScopeForm(
|
private function createDeleteRoleScopeForm(
|
||||||
PermissionsGroup $permissionsGroup,
|
PermissionsGroup $permissionsGroup,
|
||||||
|
@ -73,7 +73,6 @@ interface AggregatorInterface extends ModifierInterface
|
|||||||
*
|
*
|
||||||
* @param string $key The column key, as added in the query
|
* @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[] $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(); }`
|
* @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(); }`
|
||||||
*/
|
*/
|
||||||
|
@ -30,8 +30,6 @@ interface ExportElementValidatedInterface
|
|||||||
/**
|
/**
|
||||||
* validate the form's data and, if required, build a contraint
|
* validate the form's data and, if required, build a contraint
|
||||||
* violation on the data.
|
* violation on the data.
|
||||||
*
|
|
||||||
* @param mixed $data the data, as returned by the user
|
|
||||||
*/
|
*/
|
||||||
public function validateForm(mixed $data, ExecutionContextInterface $context);
|
public function validateForm(mixed $data, ExecutionContextInterface $context);
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,6 @@ interface ExportInterface extends ExportElementInterface
|
|||||||
*
|
*
|
||||||
* @param string $key The column key, as added in the query
|
* @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[] $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(); }`
|
* @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(); }`
|
||||||
*/
|
*/
|
||||||
|
@ -552,9 +552,7 @@ class ExportManager
|
|||||||
*
|
*
|
||||||
* This function check the acl.
|
* This function check the acl.
|
||||||
*
|
*
|
||||||
* @param mixed $data the data under the initial 'filters' data
|
|
||||||
* @param \Chill\MainBundle\Entity\Center[] $centers the picked centers
|
* @param \Chill\MainBundle\Entity\Center[] $centers the picked centers
|
||||||
*
|
|
||||||
* @throw UnauthorizedHttpException if the user is not authorized
|
* @throw UnauthorizedHttpException if the user is not authorized
|
||||||
*/
|
*/
|
||||||
private function handleFilters(
|
private function handleFilters(
|
||||||
@ -615,9 +613,6 @@ class ExportManager
|
|||||||
return $usedTypes;
|
return $usedTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param mixed $data the data from the filter key of the ExportType
|
|
||||||
*/
|
|
||||||
private function retrieveUsedFilters(mixed $data): iterable
|
private function retrieveUsedFilters(mixed $data): iterable
|
||||||
{
|
{
|
||||||
if (null === $data) {
|
if (null === $data) {
|
||||||
@ -634,7 +629,6 @@ class ExportManager
|
|||||||
/**
|
/**
|
||||||
* Retrieve the filter used in this export.
|
* 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
|
* @return array an array with types
|
||||||
*/
|
*/
|
||||||
|
@ -257,10 +257,10 @@ class SearchProvider
|
|||||||
$this->mustBeExtracted[] = $matches[0][$key];
|
$this->mustBeExtracted[] = $matches[0][$key];
|
||||||
// strip parenthesis
|
// strip parenthesis
|
||||||
if (
|
if (
|
||||||
'"' === mb_substr((string) $match, 0, 1)
|
'"' === mb_substr($match, 0, 1)
|
||||||
&& '"' === mb_substr((string) $match, mb_strlen((string) $match) - 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;
|
$terms[$matches[1][$key]] = $match;
|
||||||
}
|
}
|
||||||
|
@ -198,7 +198,6 @@ class AuthorizationHelper implements AuthorizationHelperInterface
|
|||||||
* if the entity implements Chill\MainBundle\Entity\HasScopeInterface,
|
* if the entity implements Chill\MainBundle\Entity\HasScopeInterface,
|
||||||
* the scope is taken into account.
|
* the scope is taken into account.
|
||||||
*
|
*
|
||||||
* @param mixed $entity the entity may also implement HasScopeInterface
|
|
||||||
*
|
*
|
||||||
* @return bool true if the user has access
|
* @return bool true if the user has access
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user