apply more cs rules for php-cs

This commit is contained in:
2023-10-17 13:27:03 +02:00
parent 0b0cbed9db
commit bc2041cbdd
1485 changed files with 8169 additions and 9620 deletions

View File

@@ -11,7 +11,6 @@ declare(strict_types=1);
namespace Chill\EventBundle\Entity;
use ArrayAccess;
use Chill\MainBundle\Entity\Center;
use Chill\MainBundle\Entity\HasCenterInterface;
use Chill\MainBundle\Entity\HasScopeInterface;
@@ -19,20 +18,19 @@ use Chill\MainBundle\Entity\Scope;
use Chill\PersonBundle\Entity\Person;
use DateTime;
use Doctrine\ORM\Mapping as ORM;
use RuntimeException;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
use function in_array;
/**
* Class Participation.
*
* @ORM\Entity(
* repositoryClass="Chill\EventBundle\Repository\ParticipationRepository")
*
* @ORM\Table(name="chill_event_participation")
*
* @ORM\HasLifecycleCallbacks
*/
class Participation implements ArrayAccess, HasCenterInterface, HasScopeInterface
class Participation implements \ArrayAccess, HasCenterInterface, HasScopeInterface
{
/**
* @ORM\ManyToOne(
@@ -42,10 +40,10 @@ class Participation implements ArrayAccess, HasCenterInterface, HasScopeInterfac
private ?\Chill\EventBundle\Entity\Event $event = null;
/**
* @var int
*
* @ORM\Id
*
* @ORM\Column(name="id", type="integer")
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
private ?int $id = null;
@@ -75,9 +73,8 @@ class Participation implements ArrayAccess, HasCenterInterface, HasScopeInterfac
*/
public function getCenter()
{
if ($this->getEvent() === null) {
throw new RuntimeException('The event is not linked with this instance. '
. 'You should initialize the event with a valid center before.');
if (null === $this->getEvent()) {
throw new \RuntimeException('The event is not linked with this instance. You should initialize the event with a valid center before.');
}
return $this->getEvent()->getCenter();
@@ -85,10 +82,8 @@ class Participation implements ArrayAccess, HasCenterInterface, HasScopeInterfac
/**
* Get event.
*
* @return Event
*/
public function getEvent()
public function getEvent(): null|Event
{
return $this->event;
}
@@ -106,7 +101,7 @@ class Participation implements ArrayAccess, HasCenterInterface, HasScopeInterfac
/**
* Get lastUpdate.
*
* @return DateTime
* @return \DateTime
*/
public function getLastUpdate()
{
@@ -125,10 +120,8 @@ class Participation implements ArrayAccess, HasCenterInterface, HasScopeInterfac
/**
* Get role.
*
* @return Role
*/
public function getRole()
public function getRole(): null|Role
{
return $this->role;
}
@@ -138,9 +131,8 @@ class Participation implements ArrayAccess, HasCenterInterface, HasScopeInterfac
*/
public function getScope()
{
if ($this->getEvent() === null) {
throw new RuntimeException('The event is not linked with this instance. '
. 'You should initialize the event with a valid center before.');
if (null === $this->getEvent()) {
throw new \RuntimeException('The event is not linked with this instance. You should initialize the event with a valid center before.');
}
return $this->getEvent()->getCircle();
@@ -148,10 +140,8 @@ class Participation implements ArrayAccess, HasCenterInterface, HasScopeInterfac
/**
* Get status.
*
* @return Status
*/
public function getStatus()
public function getStatus(): null|Status
{
return $this->status;
}
@@ -164,7 +154,7 @@ class Participation implements ArrayAccess, HasCenterInterface, HasScopeInterfac
*/
public function isConsistent(ExecutionContextInterface $context)
{
if ($this->getEvent() === null || $this->getRole() === null || $this->getStatus() === null) {
if (null === $this->getEvent() || null === $this->getRole() || null === $this->getStatus()) {
return;
}
@@ -189,7 +179,7 @@ class Participation implements ArrayAccess, HasCenterInterface, HasScopeInterfac
public function offsetExists(mixed $offset): bool
{
return in_array($offset, [
return \in_array($offset, [
'person', 'role', 'status', 'event',
], true);
}
@@ -204,7 +194,7 @@ class Participation implements ArrayAccess, HasCenterInterface, HasScopeInterfac
'role' => $this->getRole(),
'status' => $this->getStatus(),
'event' => $this->getEvent(),
default => throw new \LogicException("this offset does not exists : " . $offset),
default => throw new \LogicException('this offset does not exists : '.$offset),
};
}
@@ -241,11 +231,9 @@ class Participation implements ArrayAccess, HasCenterInterface, HasScopeInterfac
/**
* Set event.
*
* @param Event $event
*
* @return Participation
*/
public function setEvent(?Event $event = null)
public function setEvent(Event $event = null)
{
if ($this->event !== $event) {
$this->update();
@@ -259,11 +247,9 @@ class Participation implements ArrayAccess, HasCenterInterface, HasScopeInterfac
/**
* Set person.
*
* @param Person $person
*
* @return Participation
*/
public function setPerson(?Person $person = null)
public function setPerson(Person $person = null)
{
if ($person !== $this->person) {
$this->update();
@@ -277,11 +263,9 @@ class Participation implements ArrayAccess, HasCenterInterface, HasScopeInterfac
/**
* Set role.
*
* @param Role $role
*
* @return Participation
*/
public function setRole(?Role $role = null)
public function setRole(Role $role = null)
{
if ($role !== $this->role) {
$this->update();
@@ -294,11 +278,9 @@ class Participation implements ArrayAccess, HasCenterInterface, HasScopeInterfac
/**
* Set status.
*
* @param Status $status
*
* @return Participation
*/
public function setStatus(?Status $status = null)
public function setStatus(Status $status = null)
{
if ($this->status !== $status) {
$this->update();
@@ -316,7 +298,7 @@ class Participation implements ArrayAccess, HasCenterInterface, HasScopeInterfac
*/
protected function update()
{
$this->lastUpdate = new DateTime('now');
$this->lastUpdate = new \DateTime('now');
return $this;
}