Skip to content

Commit

Permalink
Merge pull request #495 from greg0ire/2.0.x
Browse files Browse the repository at this point in the history
Merge 1.8.x up into 2.0.x
  • Loading branch information
greg0ire authored Nov 4, 2024
2 parents c24b184 + 058b8bd commit eac9304
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 81 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[email protected]"
uses: "doctrine/.github/.github/workflows/phpstan[email protected]"
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^10.5.3",
"symfony/cache": "^6.4 || ^7",
"symfony/var-exporter": "^6.4 || ^7",
"vimeo/psalm": "^5.18"
"symfony/var-exporter": "^6.4 || ^7"
},
"suggest": {
"alcaeus/mongo-php-adapter": "For using MongoDB ODM 1.3 with PHP 7 (deprecated)",
Expand Down
24 changes: 0 additions & 24 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 @@ -69,9 +69,9 @@ public function addReference(string $name, object $object): void
*
* @see ReferenceRepository::getReference()
*
* @psalm-param class-string<T> $class
* @phpstan-param class-string<T> $class
*
* @psalm-return T
* @phpstan-return T
*
* @template T of object
*/
Expand All @@ -86,7 +86,7 @@ public function getReference(string $name, string $class): object
*
* @see ReferenceRepository::hasReference()
*
* @psalm-param class-string $class
* @phpstan-param class-string $class
*/
public function hasReference(string $name, string $class): 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(): array;
}
22 changes: 11 additions & 11 deletions src/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,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 @@ -166,7 +166,7 @@ public function addFixture(FixtureInterface $fixture): void
/**
* 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 @@ -191,7 +191,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
*/
public function isTransient(string $className): bool
{
Expand Down Expand Up @@ -247,7 +247,7 @@ private function orderFixturesByNumber(): void
*/
private function orderFixturesByDependencies(): void
{
/** @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 @@ -348,7 +348,7 @@ private function orderFixturesByDependencies(): void
$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 @@ -366,10 +366,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|null $classes = null): array
{
Expand All @@ -393,10 +393,10 @@ private function getUnsequencedClasses(array $sequences, iterable|null $classes
/**
* 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
14 changes: 7 additions & 7 deletions src/ReferenceRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ReferenceRepository
* 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 @@ -34,7 +34,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 @@ -140,9 +140,9 @@ public function addReference(string $name, object $object): void
* Loads an object using stored reference
* named by $name
*
* @psalm-param class-string<T> $class
* @phpstan-param class-string<T> $class
*
* @psalm-return T
* @phpstan-return T
*
* @throws OutOfBoundsException - if repository does not exist.
*
Expand Down Expand Up @@ -172,7 +172,7 @@ public function getReference(string $name, string $class): object
* Check if an object is stored using reference
* named by $name
*
* @psalm-param class-string $class
* @phpstan-param class-string $class
*/
public function hasReference(string $name, string $class): bool
{
Expand Down Expand Up @@ -208,7 +208,7 @@ public function hasIdentity(string $name, string $class): bool
/**
* 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 @@ -218,7 +218,7 @@ public function getIdentitiesByClass(): array
/**
* 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 eac9304

Please sign in to comment.