Skip to content

Commit

Permalink
Update ConstructorPromotionTest.php
Browse files Browse the repository at this point in the history
the optional parameter $email is declared before a required parameter $birth_date, which is not allowed in PHP 8. In PHP, optional parameters must always come after the required parameters.
  • Loading branch information
Hamad-Rashid authored Dec 31, 2024
1 parent 269d3b7 commit 7f26f91
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/integration/PHP8/ConstructorPromotionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ public function testPropertiesAreCreated() : void

$constructor = $this->expectedContructorMethod();
$constructor->addArgument(new Argument('name', new String_()));
$constructor->addArgument(new Argument('email', new String_(), '\'test@example.com\''));
$constructor->addArgument(new Argument('birth_date', new Object_(new Fqsen('\\' . \DateTimeImmutable::class))));
$constructor->addArgument(new Argument('email', new String_(), '\'test@example.com\''));

self::assertEquals($constructor, $class->getMethods()['\PHP8\ConstructorPromotion::__construct()']);
self::assertEquals(
[
'\PHP8\ConstructorPromotion::$name' => $this->expectedNameProperty(),
'\PHP8\ConstructorPromotion::$email' => $this->expectedEmailProperty(),
'\PHP8\ConstructorPromotion::$birth_date' => $this->expectedBirthDateProperty()
'\PHP8\ConstructorPromotion::$birth_date' => $this->expectedBirthDateProperty(),
'\PHP8\ConstructorPromotion::$email' => $this->expectedEmailProperty()
],
$class->getProperties()
);
Expand Down

0 comments on commit 7f26f91

Please sign in to comment.