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\PersonBundle\Tests\Entity;
use ArrayIterator;
use Chill\MainBundle\Entity\Address;
use Chill\MainBundle\Entity\User;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
@@ -19,12 +18,10 @@ use Chill\PersonBundle\Entity\AccompanyingPeriod\Comment;
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
use Chill\PersonBundle\Entity\Person;
use Chill\ThirdPartyBundle\Entity\ThirdParty;
use DateTime;
use DateTimeInterface;
use function count;
/**
* @internal
*
* @coversNothing
*/
final class AccompanyingPeriodTest extends \PHPUnit\Framework\TestCase
@@ -44,12 +41,12 @@ final class AccompanyingPeriodTest extends \PHPUnit\Framework\TestCase
$this->assertCount(1, $period->getStepHistories());
$this->assertEquals(AccompanyingPeriod::STEP_CONFIRMED, $period->getStepHistories()->first()->getStep());
$period->setOpeningDate($aMonthAgo = new DateTime('1 month ago'));
$period->setOpeningDate($aMonthAgo = new \DateTime('1 month ago'));
$this->assertCount(1, $period->getStepHistories());
$this->assertEquals($aMonthAgo, $period->getStepHistories()->first()->getStartDate(), 'when changing the opening date, the start date of the first history should change');
$period->setOpeningDate($tenDaysAgo = new DateTime('10 days ago'));
$period->setOpeningDate($tenDaysAgo = new \DateTime('10 days ago'));
$this->assertCount(1, $period->getStepHistories());
$this->assertEquals($tenDaysAgo, $period->getStepHistories()->first()->getStartDate(), 'when changing the opening date, the start date of the first history should change');
@@ -57,13 +54,13 @@ final class AccompanyingPeriodTest extends \PHPUnit\Framework\TestCase
$period->setStep(AccompanyingPeriod::STEP_CLOSED);
$this->assertCount(2, $period->getStepHistories());
$period->setOpeningDate($tomorrow = new DateTime('tomorrow'));
$period->setOpeningDate($tomorrow = new \DateTime('tomorrow'));
$this->assertEquals($tenDaysAgo, $period->getStepHistories()->first()->getStartDate(), 'when changing the opening date to a later one and no history after, start date should change');
}
public function testClosingEqualOpening()
{
$datetime = new DateTime('now');
$datetime = new \DateTime('now');
$period = new AccompanyingPeriod($datetime);
$period->setClosingDate($datetime);
@@ -73,8 +70,8 @@ final class AccompanyingPeriodTest extends \PHPUnit\Framework\TestCase
public function testClosingIsAfterOpeningConsistency()
{
$datetime1 = new DateTime('now');
$datetime2 = new DateTime('tomorrow');
$datetime1 = new \DateTime('now');
$datetime2 = new \DateTime('tomorrow');
$period = new AccompanyingPeriod($datetime1);
$period->setClosingDate($datetime2);
@@ -86,8 +83,8 @@ final class AccompanyingPeriodTest extends \PHPUnit\Framework\TestCase
public function testClosingIsBeforeOpeningConsistency()
{
$datetime1 = new DateTime('tomorrow');
$datetime2 = new DateTime('now');
$datetime1 = new \DateTime('tomorrow');
$datetime2 = new \DateTime('now');
$period = new AccompanyingPeriod($datetime1);
$period->setClosingDate($datetime2);
@@ -156,7 +153,7 @@ final class AccompanyingPeriodTest extends \PHPUnit\Framework\TestCase
usort($locations, static fn (AccompanyingPeriod\AccompanyingPeriodLocationHistory $a, AccompanyingPeriod\AccompanyingPeriodLocationHistory $b) => $a->getStartDate() <=> $b->getStartDate());
$iterator = new ArrayIterator($locations);
$iterator = new \ArrayIterator($locations);
$iterator->rewind();
do {
@@ -174,7 +171,6 @@ final class AccompanyingPeriodTest extends \PHPUnit\Framework\TestCase
} while ($iterator->valid());
}
public function testHistoryLocationNotHavingBothAtStart()
{
$period = new AccompanyingPeriod();
@@ -197,15 +193,15 @@ final class AccompanyingPeriodTest extends \PHPUnit\Framework\TestCase
public function testIsClosed()
{
$period = new AccompanyingPeriod(new DateTime());
$period->setClosingDate(new DateTime('tomorrow'));
$period = new AccompanyingPeriod(new \DateTime());
$period->setClosingDate(new \DateTime('tomorrow'));
$this->assertFalse($period->isOpen());
}
public function testIsOpen()
{
$period = new AccompanyingPeriod(new DateTime());
$period = new AccompanyingPeriod(new \DateTime());
$this->assertTrue($period->isOpen());
}
@@ -215,7 +211,7 @@ final class AccompanyingPeriodTest extends \PHPUnit\Framework\TestCase
$person = new Person();
$person2 = new Person();
$person3 = new Person();
$period = new AccompanyingPeriod(new DateTime());
$period = new AccompanyingPeriod(new \DateTime());
$participation0 = $period->createParticipationFor($person);
$period->createParticipationFor($person2);
@@ -238,7 +234,7 @@ final class AccompanyingPeriodTest extends \PHPUnit\Framework\TestCase
if ($participationL instanceof AccompanyingPeriodParticipation) {
$this->assertSame($participationL, $participation);
$this->assertTrue($participationL->getEndDate() instanceof DateTimeInterface);
$this->assertTrue($participationL->getEndDate() instanceof \DateTimeInterface);
}
$participation = $period->getOpenParticipationContainsPerson($person);
@@ -260,7 +256,7 @@ final class AccompanyingPeriodTest extends \PHPUnit\Framework\TestCase
public function testPinnedComment()
{
$period = new AccompanyingPeriod(new DateTime());
$period = new AccompanyingPeriod(new \DateTime());
$comment = new Comment();
$replacingComment = new Comment();
@@ -271,14 +267,14 @@ final class AccompanyingPeriodTest extends \PHPUnit\Framework\TestCase
$this->assertSame($period->getPinnedComment(), $comment);
$this->assertNull($comment->getAccompanyingPeriod());
$this->assertEquals(0, count($period->getComments()));
$this->assertEquals(0, \count($period->getComments()));
$period->setPinnedComment($replacingComment);
$this->assertSame($period->getPinnedComment(), $replacingComment);
$this->assertNull($replacingComment->getAccompanyingPeriod());
$this->assertSame($period, $comment->getAccompanyingPeriod());
$this->assertEquals(1, count($period->getComments()));
$this->assertEquals(1, \count($period->getComments()));
$this->assertContains($comment, $period->getComments());
$period->setPinnedComment(null);
@@ -286,14 +282,14 @@ final class AccompanyingPeriodTest extends \PHPUnit\Framework\TestCase
$this->assertNull($period->getPinnedComment());
$this->assertSame($period, $comment->getAccompanyingPeriod());
$this->assertSame($period, $replacingComment->getAccompanyingPeriod());
$this->assertEquals(2, count($period->getComments()));
$this->assertEquals(2, \count($period->getComments()));
$this->assertContains($comment, $period->getComments());
$this->assertContains($replacingComment, $period->getComments());
}
public function testRequestor()
{
$period = new AccompanyingPeriod(new DateTime());
$period = new AccompanyingPeriod(new \DateTime());
$person = new Person();
$thirdParty = new ThirdParty();