Skip to content

Commit

Permalink
Merge pull request doctrine#2368 from franmomu/add_types_5_2
Browse files Browse the repository at this point in the history
Finish adding return type declarations to phpdoc
  • Loading branch information
malarzm authored Oct 23, 2021
2 parents 60d56b3 + e533f8a commit 6cb1e7f
Show file tree
Hide file tree
Showing 54 changed files with 55 additions and 269 deletions.
9 changes: 0 additions & 9 deletions docs/en/reference/metadata-drivers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,24 +101,15 @@ the ``AbstractFileDriver`` implementation for you to extend from:
class MyMetadataDriver extends AbstractFileDriver
{
/**
* {@inheritdoc}
*/
protected $_fileExtension = '.dcm.ext';
/**
* {@inheritdoc}
*/
public function loadMetadataForClass($className, ClassMetadata $metadata)
{
$data = $this->_loadMappingFile($file);
// populate ClassMetadata instance from $data
}
/**
* {@inheritdoc}
*/
protected function _loadMappingFile($file)
{
// parse contents of $file and return php data structure
Expand Down
8 changes: 5 additions & 3 deletions lib/Doctrine/ODM/MongoDB/Aggregation/Stage/AbstractBucket.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ public function groupBy($expression): self
return $this;
}

/**
* {@inheritdoc}
*/
public function getExpression(): array
{
$stage = [
Expand All @@ -82,6 +79,11 @@ abstract protected function getExtraPipelineFields(): array;
*/
abstract protected function getStageName(): string;

/**
* @param array|mixed|string $expression
*
* @return array|mixed|string
*/
private function convertExpression($expression)
{
if (is_array($expression)) {
Expand Down
3 changes: 0 additions & 3 deletions lib/Doctrine/ODM/MongoDB/Aggregation/Stage/AddFields.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
*/
final class AddFields extends Operator
{
/**
* {@inheritdoc}
*/
public function getExpression(): array
{
return [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ public function __construct(Builder $builder, Stage\AbstractBucket $bucket)
$this->expr = $builder->expr();
}

/**
* {@inheritdoc}
*/
public function getExpression(): array
{
return $this->expr->getExpression();
Expand Down
3 changes: 0 additions & 3 deletions lib/Doctrine/ODM/MongoDB/Aggregation/Stage/CollStats.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ public function showStorageStats(): self
return $this;
}

/**
* {@inheritdoc}
*/
public function getExpression(): array
{
$collStats = [];
Expand Down
3 changes: 0 additions & 3 deletions lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Count.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ public function __construct(Builder $builder, string $fieldName)
$this->fieldName = $fieldName;
}

/**
* {@inheritdoc}
*/
public function getExpression(): array
{
return [
Expand Down
3 changes: 0 additions & 3 deletions lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Facet.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ class Facet extends Stage
/** @var string */
private $field;

/**
* {@inheritdoc}
*/
public function getExpression(): array
{
return [
Expand Down
3 changes: 0 additions & 3 deletions lib/Doctrine/ODM/MongoDB/Aggregation/Stage/GeoNear.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ public function __construct(Builder $builder, $x, $y = null)
$this->near($x, $y);
}

/**
* {@inheritdoc}
*/
public function getExpression(): array
{
$geoNear = [
Expand Down
14 changes: 6 additions & 8 deletions lib/Doctrine/ODM/MongoDB/Aggregation/Stage/GraphLookup.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,6 @@ public function from(string $from): self
return $this;
}

/**
* {@inheritdoc}
*/
public function getExpression(): array
{
$restrictSearchWithMatch = $this->restrictSearchWithMatch->getExpression() ?: (object) [];
Expand Down Expand Up @@ -277,6 +274,11 @@ private function fromReference(string $fieldName): self
return $this;
}

/**
* @param array|mixed|string $expression
*
* @return array|mixed|string
*/
private function convertExpression($expression)
{
if (is_array($expression)) {
Expand All @@ -290,12 +292,8 @@ private function convertExpression($expression)
return Type::convertPHPToDatabaseValue(Expr::convertExpression($expression));
}

private function convertTargetFieldName($fieldName)
private function convertTargetFieldName(string $fieldName): string
{
if (is_array($fieldName)) {
return array_map([$this, 'convertTargetFieldName'], $fieldName);
}

if (! $this->targetClass) {
return $fieldName;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ public function __construct(Builder $builder, GraphLookup $graphLookup)
$this->graphLookup = $graphLookup;
}

/**
* {@inheritdoc}
*/
public function getExpression(): array
{
return $this->query->getQuery();
Expand Down
6 changes: 0 additions & 6 deletions lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,13 @@ class Group extends Operator
/** @var Expr */
protected $expr;

/**
* {@inheritdoc}
*/
public function __construct(Builder $builder)
{
parent::__construct($builder);

$this->expr = $builder->expr();
}

/**
* {@inheritdoc}
*/
public function getExpression(): array
{
return [
Expand Down
3 changes: 0 additions & 3 deletions lib/Doctrine/ODM/MongoDB/Aggregation/Stage/IndexStats.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
*/
class IndexStats extends Stage
{
/**
* {@inheritdoc}
*/
public function getExpression(): array
{
return [
Expand Down
3 changes: 0 additions & 3 deletions lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Limit.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ public function __construct(Builder $builder, int $limit)
$this->limit = $limit;
}

/**
* {@inheritdoc}
*/
public function getExpression(): array
{
return [
Expand Down
3 changes: 0 additions & 3 deletions lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Lookup.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,6 @@ public function from(string $from): self
return $this;
}

/**
* {@inheritdoc}
*/
public function getExpression(): array
{
return [
Expand Down
3 changes: 0 additions & 3 deletions lib/Doctrine/ODM/MongoDB/Aggregation/Stage/MatchStage.php
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,6 @@ public function geoWithinPolygon($point1, $point2, $point3, ...$points): self
return $this;
}

/**
* {@inheritdoc}
*/
public function getExpression(): array
{
return [
Expand Down
3 changes: 0 additions & 3 deletions lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Out.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ public function __construct(Builder $builder, string $collection, DocumentManage
$this->out($collection);
}

/**
* {@inheritdoc}
*/
public function getExpression(): array
{
return [
Expand Down
3 changes: 0 additions & 3 deletions lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
*/
class Project extends Operator
{
/**
* {@inheritdoc}
*/
public function getExpression(): array
{
return [
Expand Down
3 changes: 0 additions & 3 deletions lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Redact.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
*/
class Redact extends Operator
{
/**
* {@inheritdoc}
*/
public function getExpression(): array
{
return [
Expand Down
8 changes: 5 additions & 3 deletions lib/Doctrine/ODM/MongoDB/Aggregation/Stage/ReplaceRoot.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ public function __construct(Builder $builder, DocumentManager $documentManager,
$this->expression = $expression;
}

/**
* {@inheritdoc}
*/
public function getExpression(): array
{
$expression = $this->expression !== null ? $this->convertExpression($this->expression) : $this->expr->getExpression();
Expand All @@ -50,6 +47,11 @@ public function getExpression(): array
];
}

/**
* @param array|string|mixed $expression
*
* @return array|string|mixed
*/
private function convertExpression($expression)
{
if (is_array($expression)) {
Expand Down
3 changes: 0 additions & 3 deletions lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ public function __construct(Builder $builder, int $size)
$this->size = $size;
}

/**
* {@inheritdoc}
*/
public function getExpression(): array
{
return [
Expand Down
3 changes: 0 additions & 3 deletions lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Skip.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ public function __construct(Builder $builder, int $skip)
$this->skip = $skip;
}

/**
* {@inheritdoc}
*/
public function getExpression(): array
{
return [
Expand Down
3 changes: 0 additions & 3 deletions lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Sort.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ public function __construct(Builder $builder, $fieldName, $order = null)
}
}

/**
* {@inheritdoc}
*/
public function getExpression(): array
{
return [
Expand Down
3 changes: 0 additions & 3 deletions lib/Doctrine/ODM/MongoDB/Aggregation/Stage/SortByCount.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ public function __construct(Builder $builder, string $fieldName, DocumentManager
$this->fieldName = '$' . $documentPersister->prepareFieldName(substr($fieldName, 1));
}

/**
* {@inheritdoc}
*/
public function getExpression(): array
{
return [
Expand Down
3 changes: 0 additions & 3 deletions lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Unwind.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ public function __construct(Builder $builder, string $fieldName)
$this->fieldName = $fieldName;
}

/**
* {@inheritdoc}
*/
public function getExpression(): array
{
// Fallback behavior for MongoDB < 3.2
Expand Down
1 change: 0 additions & 1 deletion lib/Doctrine/ODM/MongoDB/Id/AlnumGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ public function setChars(string $chars): void
$this->chars = $chars;
}

/** @inheritDoc */
public function generate(DocumentManager $dm, object $document)
{
$id = (string) parent::generate($dm, $document);
Expand Down
1 change: 0 additions & 1 deletion lib/Doctrine/ODM/MongoDB/Id/AutoGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
*/
final class AutoGenerator extends AbstractIdGenerator
{
/** @inheritDoc */
public function generate(DocumentManager $dm, object $document)
{
return new ObjectId();
Expand Down
1 change: 0 additions & 1 deletion lib/Doctrine/ODM/MongoDB/Id/IncrementGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ public function setStartingId(int $startingId): void
$this->startingId = $startingId;
}

/** @inheritDoc */
public function generate(DocumentManager $dm, object $document)
{
$className = get_class($document);
Expand Down
Loading

0 comments on commit 6cb1e7f

Please sign in to comment.