Skip to content
Permalink
Browse files

Merge pull request #45 from ergebnis/fix/type

Fix: Add inline DocBlocks to assist with type resolution
  • Loading branch information
localheinz committed Mar 15, 2020
2 parents 3d098fa + 74e28b8 commit d432211c6f1782825621be3d00378a18883fd0c9
@@ -150,6 +150,21 @@ parameters:
count: 1
path: test/Fixture/FixtureFactory/Entity/Badge.php

-
message: "#^Method Ergebnis\\\\FactoryBot\\\\Test\\\\Fixture\\\\FixtureFactory\\\\Entity\\\\Badge\\:\\:getLabel\\(\\) has a nullable return type declaration\\.$#"
count: 1
path: test/Fixture/FixtureFactory/Entity/Badge.php

-
message: "#^Method Ergebnis\\\\FactoryBot\\\\Test\\\\Fixture\\\\FixtureFactory\\\\Entity\\\\Badge\\:\\:getOwner\\(\\) has a nullable return type declaration\\.$#"
count: 1
path: test/Fixture/FixtureFactory/Entity/Badge.php

-
message: "#^Method Ergebnis\\\\FactoryBot\\\\Test\\\\Fixture\\\\FixtureFactory\\\\Entity\\\\Commander\\:\\:name\\(\\) has a nullable return type declaration\\.$#"
count: 1
path: test/Fixture/FixtureFactory/Entity/Commander.php

-
message: "#^Method Ergebnis\\\\FactoryBot\\\\Test\\\\Fixture\\\\FixtureFactory\\\\Entity\\\\Name\\:\\:first\\(\\) has a nullable return type declaration\\.$#"
count: 1
@@ -215,11 +230,6 @@ parameters:
count: 1
path: test/Fixture/FixtureFactory/Entity/Spaceship.php

-
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\) with 'Ergebnis\\\\\\\\FactoryBot…' and Ergebnis\\\\FactoryBot\\\\Test\\\\Fixture\\\\FixtureFactory\\\\Entity\\\\Name will always evaluate to true\\.$#"
count: 1
path: test/Integration/FixtureFactoryTest.php

-
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\) with 'OutOfRangeException' and Ergebnis\\\\FactoryBot\\\\Exception\\\\EntityDefinitionUnavailable will always evaluate to true\\.$#"
count: 1
@@ -147,9 +147,9 @@
</MissingConstructor>
</file>
<file src="test/Fixture/FixtureFactory/Entity/Badge.php">
<PropertyNotSetInConstructor occurrences="1">
<MissingConstructor occurrences="1">
<code>$id</code>
</PropertyNotSetInConstructor>
</MissingConstructor>
</file>
<file src="test/Fixture/FixtureFactory/Entity/Commander.php">
<PropertyNotSetInConstructor occurrences="1">
@@ -183,15 +183,9 @@
</PropertyNotSetInConstructor>
</file>
<file src="test/Integration/FixtureFactoryTest.php">
<MixedAssignment occurrences="2">
<code>$ss</code>
<code>$ss</code>
</MixedAssignment>
<MixedMethodCall occurrences="3">
<code>getId</code>
<code>getId</code>
<code>getId</code>
</MixedMethodCall>
<InternalMethod occurrences="1">
<code>addToAssertionCount</code>
</InternalMethod>
</file>
<file src="test/Unit/FixtureFactoryTest.php">
<DocblockTypeContradiction occurrences="1">
@@ -204,80 +198,6 @@
<code>$fixtureFactory-&gt;getList(Fixture\FixtureFactory\Entity\Spaceship::class)</code>
<code>$fixtureFactory-&gt;getList(Fixture\FixtureFactory\Entity\Spaceship::class, [], 5)</code>
</MixedArgument>
<MixedAssignment occurrences="23">
<code>$ss</code>
<code>$ss</code>
<code>$ss</code>
<code>$ss</code>
<code>$ss</code>
<code>$p1</code>
<code>$p2</code>
<code>$ship</code>
<code>$person</code>
<code>$ship</code>
<code>$person</code>
<code>$ss</code>
<code>$ss</code>
<code>$ship</code>
<code>$p1</code>
<code>$p2</code>
<code>$ss</code>
<code>$ss</code>
<code>$ss1</code>
<code>$ss2</code>
<code>$badge</code>
<code>$badge1</code>
<code>$badge2</code>
</MixedAssignment>
<MixedMethodCall occurrences="47">
<code>getName</code>
<code>getName</code>
<code>getName</code>
<code>getName</code>
<code>getName</code>
<code>constructorWasCalled</code>
<code>getCrew</code>
<code>getCrew</code>
<code>getCrew</code>
<code>getCrew</code>
<code>contains</code>
<code>getCrew</code>
<code>contains</code>
<code>getName</code>
<code>getSpaceShip</code>
<code>getCrew</code>
<code>getOwner</code>
<code>getSpaceShip</code>
<code>getName</code>
<code>getName</code>
<code>getCrew</code>
<code>getCrew</code>
<code>getName</code>
<code>constructorWasCalled</code>
<code>getName</code>
<code>getSpaceShip</code>
<code>getSpaceShip</code>
<code>getOwner</code>
<code>getSpaceShip</code>
<code>getOwner</code>
<code>getOwner</code>
<code>getOwner</code>
<code>getSpaceShip</code>
<code>getOwner</code>
<code>getSpaceShip</code>
<code>getName</code>
<code>getName</code>
<code>getName</code>
<code>getName</code>
<code>getName</code>
<code>getName</code>
<code>getName</code>
<code>getName</code>
<code>getName</code>
<code>getName</code>
<code>getName</code>
<code>getName</code>
</MixedMethodCall>
<MixedOperand occurrences="2">
<code>$fieldValues['name']</code>
<code>$fieldValues['name']</code>
@@ -49,23 +49,17 @@ class Badge
*/
protected $owner;

public function __construct(string $label, Person $owner)
{
$this->label = $label;
$this->owner = $owner;
}

public function getId(): ?int
{
return $this->id;
}

public function getLabel(): string
public function getLabel(): ?string
{
return $this->label;
}

public function getOwner(): Person
public function getOwner(): ?Person
{
return $this->owner;
}
@@ -53,7 +53,7 @@ public function id(): int
return $this->id;
}

public function name(): Name
public function name(): ?Name
{
return $this->name;
}
@@ -37,6 +37,7 @@ public function testAutomaticPersistCanBeTurnedOn(): void

$fixtureFactory->persistOnGet();

/** @var Fixture\FixtureFactory\Entity\Spaceship $ss */
$ss = $fixtureFactory->get(Fixture\FixtureFactory\Entity\Spaceship::class);

$entityManager->flush();
@@ -55,6 +56,7 @@ public function testDoesNotPersistByDefault(): void
'name' => 'Zeta',
]);

/** @var Fixture\FixtureFactory\Entity\Spaceship $ss */
$ss = $fixtureFactory->get(Fixture\FixtureFactory\Entity\Spaceship::class);

$entityManager->flush();
@@ -113,11 +115,13 @@ public function testDoesNotPersistEmbeddableWhenAutomaticPersistingIsTurnedOn():

$fixtureFactory->persistOnGet();

/** @var Fixture\FixtureFactory\Entity\Commander $commander */
$commander = $fixtureFactory->get(Fixture\FixtureFactory\Entity\Commander::class);

self::assertInstanceOf(Fixture\FixtureFactory\Entity\Commander::class, $commander);
self::assertInstanceOf(Fixture\FixtureFactory\Entity\Name::class, $commander->name());

$entityManager->flush();

$this->addToAssertionCount(1);
}
}

0 comments on commit d432211

Please sign in to comment.
You can’t perform that action at this time.