Skip to content

Commit

Permalink
Merge pull request #494 from greg0ire/1.8.x
Browse files Browse the repository at this point in the history
Merge 1.7.x up into 1.8.x
  • Loading branch information
greg0ire authored Nov 4, 2024
2 parents eb2e07b + 926092a commit d2ff504
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 91 deletions.
8 changes: 7 additions & 1 deletion .doctrine-project.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@
"slug": "data-fixtures",
"docsSlug": "doctrine-data-fixtures",
"versions": [
{
"name": "2.0",
"branchName": "2.0.x",
"slug": "latest",
"upcoming": true
},
{
"name": "1.8",
"branchName": "1.8.x",
"slug": "latest",
"slug": "1.8",
"upcoming": true
},
{
Expand Down
2 changes: 0 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,3 @@
/phpcs.xml.dist export-ignore
/phpstan.neon.dist export-ignore
/phpstan-baseline.neon export-ignore
/psalm.xml export-ignore
/psalm-baseline.xml export-ignore
2 changes: 1 addition & 1 deletion .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ on:
jobs:
static-analysis:
name: "Static Analysis"
uses: "doctrine/.github/.github/workflows/static-analysis.yml@5.2.0"
uses: "doctrine/.github/.github/workflows/phpstan.yml@5.2.0"
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@
"phpunit/phpunit": "^9.6.13 || ^10.4.2",
"psr/log": "^1.1 || ^2 || ^3",
"symfony/cache": "^5.4 || ^6.3 || ^7",
"symfony/var-exporter": "^5.4 || ^6.3 || ^7",
"vimeo/psalm": "^5.9"
"symfony/var-exporter": "^5.4 || ^6.3 || ^7"
},
"suggest": {
"alcaeus/mongo-php-adapter": "For using MongoDB ODM 1.3 with PHP 7 (deprecated)",
Expand Down
30 changes: 0 additions & 30 deletions psalm-baseline.xml

This file was deleted.

28 changes: 0 additions & 28 deletions psalm.xml

This file was deleted.

6 changes: 3 additions & 3 deletions src/AbstractFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ public function addReference(string $name, object $object)
*
* @see ReferenceRepository::getReference()
*
* @psalm-param class-string<T>|null $class
* @phpstan-param class-string<T>|null $class
*
* @return object
* @psalm-return ($class is null ? object : T)
* @phpstan-return ($class is null ? object : T)
*
* @template T of object
*/
Expand All @@ -106,7 +106,7 @@ public function getReference(string $name, ?string $class = null)
*
* @see ReferenceRepository::hasReference()
*
* @psalm-param class-string|null $class
* @phpstan-param class-string|null $class
*
* @return bool
*/
Expand Down
2 changes: 1 addition & 1 deletion src/DependentFixtureInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ interface DependentFixtureInterface
* This method must return an array of fixtures classes
* on which the implementing class depends on
*
* @psalm-return array<class-string<FixtureInterface>>
* @phpstan-return array<class-string<FixtureInterface>>
*/
public function getDependencies();
}
22 changes: 11 additions & 11 deletions src/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ class Loader
/**
* Array of fixture object instances to execute.
*
* @psalm-var array<class-string<FixtureInterface>, FixtureInterface>
* @phpstan-var array<class-string<FixtureInterface>, FixtureInterface>
*/
private array $fixtures = [];

/**
* Array of ordered fixture object instances.
*
* @psalm-var array<class-string<FixtureInterface>|int, FixtureInterface>
* @phpstan-var array<class-string<FixtureInterface>|int, FixtureInterface>
*/
private array $orderedFixtures = [];

Expand Down Expand Up @@ -171,7 +171,7 @@ public function addFixture(FixtureInterface $fixture)
/**
* Returns the array of data fixtures to execute.
*
* @psalm-return array<class-string<FixtureInterface>|int, FixtureInterface>
* @phpstan-return array<class-string<FixtureInterface>|int, FixtureInterface>
*/
public function getFixtures()
{
Expand All @@ -196,7 +196,7 @@ public function getFixtures()
* Check if a given fixture is transient and should not be considered a data fixtures
* class.
*
* @psalm-param class-string<object> $className
* @phpstan-param class-string<object> $className
*
* @return bool
*/
Expand Down Expand Up @@ -258,7 +258,7 @@ private function orderFixturesByNumber(): void
*/
private function orderFixturesByDependencies()
{
/** @psalm-var array<class-string<DependentFixtureInterface>, int> */
/** @phpstan-var array<class-string<DependentFixtureInterface>, int> */
$sequenceForClasses = [];

// If fixtures were already ordered by number then we need
Expand Down Expand Up @@ -359,7 +359,7 @@ private function orderFixturesByDependencies()
$this->orderedFixtures = array_merge($this->orderedFixtures, $orderedFixtures);
}

/** @psalm-param iterable<class-string> $dependenciesClasses */
/** @phpstan-param iterable<class-string> $dependenciesClasses */
private function validateDependencies(iterable $dependenciesClasses): bool
{
$loadedFixtureClasses = array_keys($this->fixtures);
Expand All @@ -377,10 +377,10 @@ private function validateDependencies(iterable $dependenciesClasses): bool
}

/**
* @psalm-param array<class-string<DependentFixtureInterface>, int> $sequences
* @psalm-param iterable<class-string<FixtureInterface>>|null $classes
* @phpstan-param array<class-string<DependentFixtureInterface>, int> $sequences
* @phpstan-param iterable<class-string<FixtureInterface>>|null $classes
*
* @psalm-return array<class-string<FixtureInterface>>
* @phpstan-return array<class-string<FixtureInterface>>
*/
private function getUnsequencedClasses(array $sequences, ?iterable $classes = null): array
{
Expand All @@ -404,10 +404,10 @@ private function getUnsequencedClasses(array $sequences, ?iterable $classes = nu
/**
* Load fixtures from files contained in iterator.
*
* @psalm-param Iterator<SplFileInfo> $iterator Iterator over files from
* @phpstan-param Iterator<SplFileInfo> $iterator Iterator over files from
* which fixtures should be loaded.
*
* @psalm-return list<FixtureInterface> $fixtures Array of loaded fixture object instances.
* @phpstan-return list<FixtureInterface> $fixtures Array of loaded fixture object instances.
*/
private function loadFromIterator(Iterator $iterator): array
{
Expand Down
22 changes: 11 additions & 11 deletions src/ReferenceRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ class ReferenceRepository
* List of named references to the fixture objects
* gathered during fixure loading
*
* @psalm-var array<string, object>
* @phpstan-var array<string, object>
*/
private array $references = [];

/**
* List of named references to the fixture objects
* gathered during fixure loading
*
* @psalm-var array<class-string, array<string, object>>
* @phpstan-var array<class-string, array<string, object>>
*/
private array $referencesByClass = [];

Expand All @@ -44,7 +44,7 @@ class ReferenceRepository
* in case a reference gets no longer managed, it will
* use a proxy referenced by this identity
*
* @psalm-var array<string, mixed>
* @phpstan-var array<string, mixed>
*/
private array $identities = [];

Expand All @@ -53,7 +53,7 @@ class ReferenceRepository
* in case a reference gets no longer managed, it will
* use a proxy referenced by this identity
*
* @psalm-var array<class-string, array<string, mixed>>
* @phpstan-var array<class-string, array<string, mixed>>
*/
private array $identitiesByClass = [];

Expand Down Expand Up @@ -194,10 +194,10 @@ public function addReference(string $name, object $object)
* Loads an object using stored reference
* named by $name
*
* @psalm-param class-string<T>|null $class
* @phpstan-param class-string<T>|null $class
*
* @return object
* @psalm-return ($class is null ? object : T)
* @phpstan-return ($class is null ? object : T)
*
* @throws OutOfBoundsException - if repository does not exist.
*
Expand Down Expand Up @@ -250,7 +250,7 @@ public function getReference(string $name, ?string $class = null)
* Check if an object is stored using reference
* named by $name
*
* @psalm-param class-string $class
* @phpstan-param class-string $class
*
* @return bool
*/
Expand Down Expand Up @@ -314,7 +314,7 @@ public function hasIdentity(string $name, ?string $class = null)
*
* Get all stored identities
*
* @psalm-return array<string, object>
* @phpstan-return array<string, object>
*/
public function getIdentities()
{
Expand All @@ -324,7 +324,7 @@ public function getIdentities()
/**
* Get all stored identities
*
* @psalm-return array<class-string, array<string, object>>
* @phpstan-return array<class-string, array<string, object>>
*/
public function getIdentitiesByClass(): array
{
Expand All @@ -336,7 +336,7 @@ public function getIdentitiesByClass(): array
*
* Get all stored references
*
* @psalm-return array<string, object>
* @phpstan-return array<string, object>
*/
public function getReferences()
{
Expand All @@ -346,7 +346,7 @@ public function getReferences()
/**
* Get all stored references
*
* @psalm-return array<class-string, array<string, object>>
* @phpstan-return array<class-string, array<string, object>>
*/
public function getReferencesByClass(): array
{
Expand Down
2 changes: 1 addition & 1 deletion src/Sorter/Vertex.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Vertex
public const IN_PROGRESS = 1;
public const VISITED = 2;

/** @psalm-var self::* */
/** @phpstan-var self::* */
public int $state = self::NOT_VISITED;

/** Actual node value. */
Expand Down

0 comments on commit d2ff504

Please sign in to comment.