Skip to content

Commit

Permalink
Merge pull request #91 from ergebnis/fix/rename
Browse files Browse the repository at this point in the history
Fix: Rename EntityDef to EntityDefinition
  • Loading branch information
localheinz authored Mar 28, 2020
2 parents 6647087 + 1e8c375 commit d7257e2
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 18 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ For a full diff see [`fa9c564...master`][fa9c564...master].
* Marked all classes as `final` ([#33]), by [@localheinz]
* Marked `EntityDef` as internal ([#49]), by [@localheinz]
* Started throwing an `InvalidFieldNames` exception instead of a generic `Exception` when fields are referenced that are not present in the corresponding entity ([#87]), by [@localheinz]
* Renamed `EntityDef` to `EntityDefinition` ([#91]), by [@localheinz]

### Fixed

Expand All @@ -43,5 +44,6 @@ For a full diff see [`fa9c564...master`][fa9c564...master].
[#49]: https://github.com/ergebnis/factory-bot/pull/49
[#79]: https://github.com/ergebnis/factory-bot/pull/79
[#87]: https://github.com/ergebnis/factory-bot/pull/87
[#91]: https://github.com/ergebnis/factory-bot/pull/91

[@localheinz]: https://github.com/localheinz
16 changes: 8 additions & 8 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,27 @@ parameters:
-
message: "#^Parameter \\#2 \\.\\.\\.\\$fieldNames of static method Ergebnis\\\\FactoryBot\\\\Exception\\\\InvalidFieldNames\\:\\:notFoundIn\\(\\) expects array\\<int, string\\>, array\\<int, \\(int\\|string\\)\\> given\\.$#"
count: 1
path: src/EntityDef.php
path: src/EntityDefinition.php

-
message: "#^Method Ergebnis\\\\FactoryBot\\\\EntityDef\\:\\:fieldDefinitions\\(\\) has no return typehint specified\\.$#"
message: "#^Method Ergebnis\\\\FactoryBot\\\\EntityDefinition\\:\\:fieldDefinitions\\(\\) has no return typehint specified\\.$#"
count: 1
path: src/EntityDef.php
path: src/EntityDefinition.php

-
message: "#^Method Ergebnis\\\\FactoryBot\\\\EntityDef\\:\\:normalizeFieldDefinition\\(\\) has no return typehint specified\\.$#"
message: "#^Method Ergebnis\\\\FactoryBot\\\\EntityDefinition\\:\\:normalizeFieldDefinition\\(\\) has no return typehint specified\\.$#"
count: 1
path: src/EntityDef.php
path: src/EntityDefinition.php

-
message: "#^Method Ergebnis\\\\FactoryBot\\\\EntityDef\\:\\:normalizeFieldDefinition\\(\\) has parameter \\$fieldDefinition with no typehint specified\\.$#"
message: "#^Method Ergebnis\\\\FactoryBot\\\\EntityDefinition\\:\\:normalizeFieldDefinition\\(\\) has parameter \\$fieldDefinition with no typehint specified\\.$#"
count: 1
path: src/EntityDef.php
path: src/EntityDefinition.php

-
message: "#^Parameter \\#1 \\$object of function method_exists expects object\\|string, callable given\\.$#"
count: 1
path: src/EntityDef.php
path: src/EntityDefinition.php

-
message: "#^Class \"Ergebnis\\\\FactoryBot\\\\Exception\\\\EntityDefinitionUnavailable\" is not allowed to extend \"OutOfRangeException\"\\.$#"
Expand Down
2 changes: 1 addition & 1 deletion psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="3.10.1@eeed5ecccc10131397f0eb7ee6da810c0be3a7fc">
<file src="src/EntityDef.php">
<file src="src/EntityDefinition.php">
<InvalidArgument occurrences="1">
<code>$fieldDefinition</code>
</InvalidArgument>
Expand Down
2 changes: 1 addition & 1 deletion src/EntityDef.php → src/EntityDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/**
* @internal
*/
final class EntityDef
final class EntityDefinition
{
/**
* @var ORM\Mapping\ClassMetadata
Expand Down
10 changes: 5 additions & 5 deletions src/FixtureFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ final class FixtureFactory
private $entityManager;

/**
* @var array<string, EntityDef>
* @var array<string, EntityDefinition>
*/
private $entityDefinitions = [];

Expand Down Expand Up @@ -84,7 +84,7 @@ public function defineEntity($name, array $fieldDefinitions = [], array $configu
));
}

$this->entityDefinitions[$name] = new EntityDef(
$this->entityDefinitions[$name] = new EntityDefinition(
$classMetadata,
$fieldDefinitions,
$configuration
Expand Down Expand Up @@ -117,7 +117,7 @@ public function get($name, array $fieldOverrides = [])
throw Exception\EntityDefinitionUnavailable::for($name);
}

/** @var EntityDef $entityDefinition */
/** @var EntityDefinition $entityDefinition */
$entityDefinition = $this->entityDefinitions[$name];

$configuration = $entityDefinition->configuration();
Expand Down Expand Up @@ -253,14 +253,14 @@ public function unsetSingleton($name): void
}

/**
* @return EntityDef[]
* @return EntityDefinition[]
*/
public function definitions(): array
{
return $this->entityDefinitions;
}

private function setField($entity, EntityDef $entityDefinition, $fieldName, $fieldValue): void
private function setField($entity, EntityDefinition $entityDefinition, $fieldName, $fieldValue): void
{
$classMetadata = $entityDefinition->classMetadata();

Expand Down
2 changes: 1 addition & 1 deletion test/AutoReview/SrcCodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function testSrcClassesHaveUnitTests(): void
'Ergebnis\\FactoryBot\\',
'Ergebnis\\FactoryBot\\Test\\Unit',
[
FactoryBot\EntityDef::class,
FactoryBot\EntityDefinition::class,
FactoryBot\FieldDef::class,
]
);
Expand Down
2 changes: 1 addition & 1 deletion test/Unit/Definition/DefinitionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
*
* @covers \Ergebnis\FactoryBot\Definition\Definitions
*
* @uses \Ergebnis\FactoryBot\EntityDef
* @uses \Ergebnis\FactoryBot\EntityDefinition
* @uses \Ergebnis\FactoryBot\Exception\InvalidDefinition
* @uses \Ergebnis\FactoryBot\Exception\InvalidDirectory
* @uses \Ergebnis\FactoryBot\FixtureFactory
Expand Down
2 changes: 1 addition & 1 deletion test/Unit/FixtureFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
/**
* @internal
*
* @covers \Ergebnis\FactoryBot\EntityDef
* @covers \Ergebnis\FactoryBot\EntityDefinition
* @covers \Ergebnis\FactoryBot\FieldDef
* @covers \Ergebnis\FactoryBot\FixtureFactory
*
Expand Down

0 comments on commit d7257e2

Please sign in to comment.