Skip to content

Commit

Permalink
Add typed properties
Browse files Browse the repository at this point in the history
  • Loading branch information
IonBazan committed Oct 4, 2022
1 parent a95ea45 commit 42a2059
Show file tree
Hide file tree
Showing 69 changed files with 243 additions and 484 deletions.
3 changes: 1 addition & 2 deletions lib/Doctrine/ODM/MongoDB/APM/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@

final class Command
{
/** @var CommandStartedEvent */
private $startedEvent;
private CommandStartedEvent $startedEvent;

/** @var CommandSucceededEvent|CommandFailedEvent */
private $finishedEvent;
Expand Down
7 changes: 3 additions & 4 deletions lib/Doctrine/ODM/MongoDB/APM/CommandLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@
final class CommandLogger implements Countable, CommandLoggerInterface
{
/** @var Command[] */
private $commands = [];
private array $commands = [];

/** @var CommandStartedEvent[] */
private $startedCommands = [];
private array $startedCommands = [];

/** @var bool */
private $registered = false;
private bool $registered = false;

public function register(): void
{
Expand Down
16 changes: 6 additions & 10 deletions lib/Doctrine/ODM/MongoDB/Aggregation/Aggregation.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,19 @@

final class Aggregation implements IteratorAggregate
{
/** @var DocumentManager */
private $dm;
private DocumentManager $dm;

/** @var ClassMetadata|null */
private $classMetadata;
private ?ClassMetadata $classMetadata;

/** @var Collection */
private $collection;
private Collection $collection;

/** @var array<string, mixed> */
private $pipeline;
private array $pipeline;

/** @var array<string, mixed> */
private $options;
private array $options;

/** @var bool */
private $rewindable;
private bool $rewindable;

/**
* @param array<string, mixed> $pipeline
Expand Down
24 changes: 7 additions & 17 deletions lib/Doctrine/ODM/MongoDB/Aggregation/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,36 +34,26 @@ class Builder
{
/**
* The DocumentManager instance for this query
*
* @var DocumentManager
*/
private $dm;
private DocumentManager $dm;

/**
* The ClassMetadata instance.
*
* @var ClassMetadata
*/
private $class;
private ClassMetadata $class;

/**
* @var string
* @psalm-var class-string
*/
private $hydrationClass;
/** @psalm-var class-string */
private ?string $hydrationClass = null;

/**
* The Collection instance.
*
* @var Collection
*/
private $collection;
private Collection $collection;

/** @var Stage[] */
private $stages = [];
private array $stages = [];

/** @var bool */
private $rewindable = true;
private bool $rewindable = true;

/**
* Create a new aggregation builder.
Expand Down
14 changes: 5 additions & 9 deletions lib/Doctrine/ODM/MongoDB/Aggregation/Expr.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,20 @@
*/
class Expr
{
/** @var DocumentManager */
private $dm;
private DocumentManager $dm;

/** @var ClassMetadata */
private $class;
private ClassMetadata $class;

/** @var array<string, mixed> */
private $expr = [];
private array $expr = [];

/**
* The current field we are operating on.
*
* @var string
*/
private $currentField;
private ?string $currentField = null;

/** @var array{case: mixed|self, then?: mixed|self}|null */
private $switchBranch;
private ?array $switchBranch = null;

public function __construct(DocumentManager $dm, ClassMetadataInterface $class)
{
Expand Down
6 changes: 2 additions & 4 deletions lib/Doctrine/ODM/MongoDB/Aggregation/Stage/AbstractBucket.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@
*/
abstract class AbstractBucket extends Stage
{
/** @var DocumentManager */
private $dm;
private DocumentManager $dm;

/** @var ClassMetadata */
private $class;
private ClassMetadata $class;

/** @var Bucket\AbstractOutput|null */
protected $output;
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Bucket.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
class Bucket extends AbstractBucket
{
/** @var mixed[] */
private $boundaries;
private ?array $boundaries = null;

/** @var mixed */
private $default;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ abstract class AbstractOutput extends Stage
/** @var Stage\AbstractBucket */
protected $bucket;

/** @var Expr */
private $expr;
private Expr $expr;

public function __construct(Builder $builder, Stage\AbstractBucket $bucket)
{
Expand Down
6 changes: 2 additions & 4 deletions lib/Doctrine/ODM/MongoDB/Aggregation/Stage/BucketAuto.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@
*/
class BucketAuto extends AbstractBucket
{
/** @var int */
private $buckets;
private ?int $buckets = null;

/** @var string|null */
private $granularity;
private ?string $granularity = null;

/**
* A positive 32-bit integer that specifies the number of buckets into which
Expand Down
6 changes: 2 additions & 4 deletions lib/Doctrine/ODM/MongoDB/Aggregation/Stage/CollStats.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@ class CollStats extends Stage
public const LATENCY_STATS_SIMPLE = 1;
public const LATENCY_STATS_HISTOGRAMS = 2;

/** @var int */
private $latencyStats = self::LATENCY_STATS_NONE;
private int $latencyStats = self::LATENCY_STATS_NONE;

/** @var bool */
private $storageStats = false;
private bool $storageStats = false;

public function __construct(Builder $builder)
{
Expand Down
3 changes: 1 addition & 2 deletions lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Count.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
*/
class Count extends Stage
{
/** @var string */
private $fieldName;
private string $fieldName;

public function __construct(Builder $builder, string $fieldName)
{
Expand Down
5 changes: 2 additions & 3 deletions lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Facet.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@
class Facet extends Stage
{
/** @var Builder[] */
private $pipelines = [];
private array $pipelines = [];

/** @var string */
private $field;
private ?string $field = null;

public function getExpression(): array
{
Expand Down
24 changes: 8 additions & 16 deletions lib/Doctrine/ODM/MongoDB/Aggregation/Stage/GeoNear.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,24 @@
*/
class GeoNear extends MatchStage
{
/** @var string */
private $distanceField;
private ?string $distanceField = null;

/** @var float */
private $distanceMultiplier;
private ?float $distanceMultiplier = null;

/** @var string */
private $includeLocs;
private ?string $includeLocs = null;

/** @var float */
private $maxDistance;
private ?float $maxDistance = null;

/** @var float */
private $minDistance;
private ?float $minDistance = null;

/** @var array<string, mixed>|array{int|float, int|float} */
private $near;

/** @var int */
private $num;
private ?int $num = null;

/** @var bool */
private $spherical = false;
private bool $spherical = false;

/** @var bool */
private $uniqueDocs;
private ?bool $uniqueDocs = null;

/**
* @param float|array<string, mixed>|Point $x
Expand Down
30 changes: 10 additions & 20 deletions lib/Doctrine/ODM/MongoDB/Aggregation/Stage/GraphLookup.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,38 +25,28 @@
*/
class GraphLookup extends Stage
{
/** @var string|null */
private $from;
private ?string $from;

/** @var string|Expr|mixed[]|null */
private $startWith;

/** @var string|null */
private $connectFromField;
private ?string $connectFromField = null;

/** @var string|null */
private $connectToField;
private ?string $connectToField = null;

/** @var string|null */
private $as;
private ?string $as = null;

/** @var int|null */
private $maxDepth;
private ?int $maxDepth = null;

/** @var string|null */
private $depthField;
private ?string $depthField = null;

/** @var Stage\GraphLookup\MatchStage */
private $restrictSearchWithMatch;
private Stage\GraphLookup\MatchStage $restrictSearchWithMatch;

/** @var DocumentManager */
private $dm;
private DocumentManager $dm;

/** @var ClassMetadata */
private $class;
private ClassMetadata $class;

/** @var ClassMetadata|null */
private $targetClass;
private ?ClassMetadata $targetClass = null;

/**
* @param string $from Target collection for the $graphLookup operation to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@

class MatchStage extends BaseMatchStage
{
/** @var GraphLookup */
private $graphLookup;
private GraphLookup $graphLookup;

public function __construct(Builder $builder, GraphLookup $graphLookup)
{
Expand Down
3 changes: 1 addition & 2 deletions lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Limit.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
*/
class Limit extends Stage
{
/** @var int */
private $limit;
private int $limit;

public function __construct(Builder $builder, int $limit)
{
Expand Down
21 changes: 7 additions & 14 deletions lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Lookup.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,19 @@
*/
class Lookup extends Stage
{
/** @var DocumentManager */
private $dm;
private DocumentManager $dm;

/** @var ClassMetadata */
private $class;
private ClassMetadata $class;

/** @var ClassMetadata */
private $targetClass;
private ?ClassMetadata $targetClass = null;

/** @var string */
private $from;
private string $from;

/** @var string */
private $localField;
private ?string $localField = null;

/** @var string */
private $foreignField;
private ?string $foreignField = null;

/** @var string */
private $as;
private ?string $as = null;

/** @var array */
private $let;
Expand Down
6 changes: 2 additions & 4 deletions lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Out.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@

class Out extends Stage
{
/** @var DocumentManager */
private $dm;
private DocumentManager $dm;

/** @var string */
private $collection;
private ?string $collection = null;

public function __construct(Builder $builder, string $collection, DocumentManager $documentManager)
{
Expand Down
6 changes: 2 additions & 4 deletions lib/Doctrine/ODM/MongoDB/Aggregation/Stage/ReplaceRoot.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@

class ReplaceRoot extends Operator
{
/** @var DocumentManager */
private $dm;
private DocumentManager $dm;

/** @var ClassMetadata */
private $class;
private ClassMetadata $class;

/** @var string|mixed[]|Expr|null */
private $expression;
Expand Down
3 changes: 1 addition & 2 deletions lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
*/
class Sample extends Stage
{
/** @var int */
private $size;
private int $size;

public function __construct(Builder $builder, int $size)
{
Expand Down
Loading

0 comments on commit 42a2059

Please sign in to comment.