mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
fix syntax php7
This commit is contained in:
parent
0a17011cc3
commit
ea4e3c715e
@ -33,6 +33,7 @@ use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Validator\ConstraintViolationListInterface;
|
||||
|
||||
/**
|
||||
* Class AccompanyingPeriodController
|
||||
@ -56,12 +57,8 @@ class AccompanyingPeriodController extends AbstractController
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Response
|
||||
*/
|
||||
public function listAction(int $person_id)
|
||||
public function listAction(int $person_id): Response
|
||||
{
|
||||
|
||||
$person = $this->_getPerson($person_id);
|
||||
|
||||
$event = new PrivacyEvent($person, [
|
||||
@ -76,12 +73,8 @@ class AccompanyingPeriodController extends AbstractController
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Symfony\Component\HttpFoundation\RedirectResponse|Response
|
||||
*/
|
||||
public function createAction(int $person_id, Request $request)
|
||||
public function createAction(int $person_id, Request $request): Response
|
||||
{
|
||||
|
||||
$person = $this->_getPerson($person_id);
|
||||
|
||||
$this->denyAccessUnlessGranted(PersonVoter::UPDATE, $person,
|
||||
@ -138,9 +131,10 @@ class AccompanyingPeriodController extends AbstractController
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Symfony\Component\HttpFoundation\RedirectResponse|Response|\Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
* @throws Exception
|
||||
*/
|
||||
public function updateAction(int $person_id, int $period_id, Request $request){
|
||||
public function updateAction(int $person_id, int $period_id, Request $request): Response
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
/** @var AccompanyingPeriod $accompanyingPeriod */
|
||||
@ -203,10 +197,9 @@ class AccompanyingPeriodController extends AbstractController
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Symfony\Component\HttpFoundation\RedirectResponse|Response
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function closeAction(int $person_id, Request $request)
|
||||
public function closeAction(int $person_id, Request $request): Response
|
||||
{
|
||||
|
||||
$person = $this->_getPerson($person_id);
|
||||
@ -287,10 +280,8 @@ class AccompanyingPeriodController extends AbstractController
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Symfony\Component\Validator\ConstraintViolationListInterface
|
||||
*/
|
||||
private function _validatePerson(Person $person) {
|
||||
private function _validatePerson(Person $person): ConstraintViolationListInterface
|
||||
{
|
||||
$errors = $this->get('validator')->validate($person, null,
|
||||
['Default']);
|
||||
$errors_accompanying_period = $this->get('validator')->validate($person, null,
|
||||
@ -303,10 +294,8 @@ class AccompanyingPeriodController extends AbstractController
|
||||
return $errors;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Symfony\Component\HttpFoundation\RedirectResponse|Response
|
||||
*/
|
||||
public function openAction($person_id, Request $request) {
|
||||
public function openAction(int $person_id, Request $request): Response
|
||||
{
|
||||
$person = $this->_getPerson($person_id);
|
||||
|
||||
$this->denyAccessUnlessGranted(PersonVoter::UPDATE, $person,
|
||||
@ -382,10 +371,7 @@ class AccompanyingPeriodController extends AbstractController
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return object|\Symfony\Component\HttpFoundation\RedirectResponse|Response
|
||||
*/
|
||||
public function reOpenAction(int $person_id, int $period_id, Request $request)
|
||||
public function reOpenAction(int $person_id, int $period_id, Request $request): Response
|
||||
{
|
||||
/** @var Person $person */
|
||||
$person = $this->_getPerson($person_id);
|
||||
@ -432,7 +418,7 @@ class AccompanyingPeriodController extends AbstractController
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException if the person is not found
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
*/
|
||||
private function _getPerson(int $id) : Person
|
||||
{
|
||||
|
@ -169,15 +169,15 @@ class AccompanyingPeriod
|
||||
*/
|
||||
public function isOpen(): bool
|
||||
{
|
||||
if ($this->getOpeningDate() > new \DateTime('now')) {
|
||||
if ($this->getOpeningDate() > new \DateTimeImmutable('now')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->getClosingDate() === null) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -287,19 +287,19 @@ class AccompanyingPeriod
|
||||
return false;
|
||||
}
|
||||
|
||||
dump('parcours fermé: '. $this->getId());
|
||||
|
||||
foreach ($this->getPersons() as $p) {
|
||||
if ($p === $person) {
|
||||
$periods = $p->getAccompanyingPeriodsOrdered();
|
||||
return end($periods) === $this; // retourne TRUE si cette période est la dernière
|
||||
return end($periods) === $this;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public function reOpen()
|
||||
public function reOpen(): void
|
||||
{
|
||||
$this->setClosingDate(null);
|
||||
$this->setClosingMotive(null);
|
||||
|
Loading…
x
Reference in New Issue
Block a user