Skip to content

Commit

Permalink
Run phpcbf
Browse files Browse the repository at this point in the history
  • Loading branch information
malarzm committed Mar 27, 2024
1 parent 8c7fa3f commit 339f618
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,7 @@ public function getOperatorParams(): object
return $this->appendScore($params);
}

/**
* @param array|Geometry $geometry
*
* @return array
*/
/** @param array|Geometry $geometry */
private function convertGeometry($geometry): array
{
if (! $geometry instanceof Geometry) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@ class Output extends Operator implements WindowOperators

private string $currentField = '';

/**
* @var array
* @psalm-var array<string, Window>
*/
/** @psalm-var array<string, Window> */
private array $windows = [];

public function __construct(Builder $builder, private SetWindowFields $setWindowFields)
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -1851,7 +1851,7 @@ public function getEmbeddedFieldsMappings(): array
{
return array_filter(

Check failure on line 1852 in lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadata.php

View workflow job for this annotation

GitHub Actions / Static Analysis with Psalm (8.2)

InvalidReturnStatement

lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadata.php:1852:16: InvalidReturnStatement: The inferred type 'array<string, array{alsoLoadFields?: list<string>, association: int, cascade?: list<string>|string, collectionClass?: class-string, criteria?: array<string, mixed>, declared?: class-string, defaultDiscriminatorValue?: string, discriminatorField?: string, discriminatorMap?: array<string, class-string>, embedded?: bool, fieldName: string, id?: bool, index?: bool, inherited?: string, inversedBy?: null|string, isCascadeDetach: bool, isCascadeMerge: bool, isCascadePersist: bool, isCascadeRefresh: bool, isCascadeRemove: bool, isInverseSide: bool, isOwningSide: bool, limit?: int|null, lock?: bool, mappedBy?: null|string, name: string, notSaved?: bool, nullable?: bool, options?: array<string, mixed>, orphanRemoval?: bool, prime?: list<string>, reference?: bool, repositoryMethod?: null|string, skip?: int|null, sort?: array<string, int|string>, sparse?: bool, storeAs?: string, storeEmptyArray?: bool, strategy?: string, targetDocument: class-string|null, type?: string, unique?: bool, version?: bool}>' does not match the declared return type 'array<string, array{alsoLoadFields?: list<string>, association?: int, cascade?: list<string>|string, collectionClass?: class-string, criteria?: array<string, mixed>, declared?: class-string, defaultDiscriminatorValue?: string, discriminatorField?: string, discriminatorMap?: array<string, class-string>, embedded?: bool, enumType?: class-string<BackedEnum>, fieldName: string, id?: bool, index?: bool, inherited?: string, inversedBy?: null|string, isCascadeDetach: bool, isCascadeMerge: bool, isCascadePersist: bool, isCascadeRefresh: bool, isCascadeRemove: bool, isInverseSide: bool, isOwningSide: bool, limit?: int|null, lock?: bool, mappedBy?: null|string, name: string, notSaved?: bool, nullable?: bool, options?: array<string, mixed>, orphanRemoval?: bool, prime?: list<string>, reference?: bool, repositoryMethod?: null|string, skip?: int|null, sort?: array<string, int|string>, sparse?: bool, storeAs?: string, storeEmptyArray?: bool, strategy?: string, targetDocument?: class-string|null, type: string, unique?: bool, version?: bool}>' for Doctrine\ODM\MongoDB\Mapping\ClassMetadata::getEmbeddedFieldsMappings (see https://psalm.dev/128)
$this->associationMappings,
static fn ($assoc) => ! empty($assoc['embedded'])
static fn ($assoc) => ! empty($assoc['embedded']),
);
}

Expand Down
8 changes: 4 additions & 4 deletions lib/Doctrine/ODM/MongoDB/UnitOfWork.php
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ private function computeOrRecomputeChangeSet(ClassMetadata $class, object $docum
// Look for changes in associations of the document
$associationMappings = array_filter(
$class->associationMappings,
static fn ($assoc) => empty($assoc['notSaved'])
static fn ($assoc) => empty($assoc['notSaved']),
);

foreach ($associationMappings as $mapping) {
Expand Down Expand Up @@ -2169,7 +2169,7 @@ private function cascadeRefresh(object $document, array &$visited): void

$associationMappings = array_filter(
$class->associationMappings,
static fn ($assoc) => $assoc['isCascadeRefresh']
static fn ($assoc) => $assoc['isCascadeRefresh'],
);

foreach ($associationMappings as $mapping) {
Expand Down Expand Up @@ -2229,7 +2229,7 @@ private function cascadeMerge(object $document, object $managedCopy, array &$vis

$associationMappings = array_filter(
$class->associationMappings,
static fn ($assoc) => $assoc['isCascadeMerge']
static fn ($assoc) => $assoc['isCascadeMerge'],
);

foreach ($associationMappings as $assoc) {
Expand Down Expand Up @@ -2261,7 +2261,7 @@ private function cascadePersist(object $document, array &$visited): void

$associationMappings = array_filter(
$class->associationMappings,
static fn ($assoc) => $assoc['isCascadePersist']
static fn ($assoc) => $assoc['isCascadePersist'],
);

foreach ($associationMappings as $fieldName => $mapping) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,6 @@ public function testPrepareQueryOrNewObjWithEmbeddedReferenceToTargetDocumentWit
self::assertEquals($expected, $documentPersister->prepareQueryOrNewObj($value));
}

/** @return array */
public static function dataProviderTestWriteConcern(): array
{
return [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,6 @@ public function testPrepareInsertData(object $document, array $expectedData): vo
/**
* Provides data for @see PersistenceBuilderTest::testPrepareInsertData()
* Returns arrays of array(document => expected data)
*
* @return array
*/
public static function getDocumentsAndExpectedData(): array
{
Expand Down
2 changes: 0 additions & 2 deletions tests/Doctrine/ODM/MongoDB/Tests/Query/BuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -593,8 +593,6 @@ public static function provideExcludeProjections(): array
* Provide arguments for select() and exclude() tests.
*
* @param bool $include Whether the field should be included or excluded
*
* @return array
*/
private static function provideProjections(bool $include): array
{
Expand Down

0 comments on commit 339f618

Please sign in to comment.