Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable declare_strict_types option and apply @PHP80Migration set with… #2190

Merged
merged 8 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 4 additions & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

$finder = (new PhpCsFixer\Finder())
->in(__DIR__.'/src')
->in(__DIR__.'/tests')
Expand All @@ -8,7 +10,8 @@
return (new PhpCsFixer\Config())
->setFinder($finder)
->setRules([
'@PHP71Migration' => true,
'@PHP80Migration' => true,
'@PHP80Migration:risky' => true,
'@PhpCsFixer' => true,
'@PHPUnit75Migration:risky' => true,
'@PSR2' => true,
Expand Down
2 changes: 2 additions & 0 deletions src/AbstractUpdateAction.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this line automatically added to each file or is this something done manually?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the help of PHP-CS-Fixer declare_strict_types rule included in @PHP80Migration:risky rule set.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, I was worried there would a be manual step involved.


namespace Elastica;

use Elastica\Exception\InvalidException;
Expand Down
2 changes: 2 additions & 0 deletions src/Aggregation/AbstractAggregation.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

use Elastica\Exception\InvalidException;
Expand Down
2 changes: 2 additions & 0 deletions src/Aggregation/AbstractSimpleAggregation.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

use Elastica\Exception\InvalidException;
Expand Down
2 changes: 2 additions & 0 deletions src/Aggregation/AbstractTermsAggregation.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Aggregation/AdjacencyMatrix.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

use Elastica\Query\AbstractQuery;
Expand Down
2 changes: 2 additions & 0 deletions src/Aggregation/AutoDateHistogram.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

use Elastica\Aggregation\Traits\MissingTrait;
Expand Down
2 changes: 2 additions & 0 deletions src/Aggregation/Avg.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Aggregation/AvgBucket.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Aggregation/BucketScript.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Aggregation/BucketSelector.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Aggregation/Cardinality.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Aggregation/Children.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Aggregation/Composite.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

class Composite extends AbstractAggregation
Expand Down
2 changes: 2 additions & 0 deletions src/Aggregation/CumulativeSum.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Aggregation/DateHistogram.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Aggregation/DateRange.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Aggregation/Derivative.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Aggregation/DiversifiedSampler.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Aggregation/ExtendedStats.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Aggregation/ExtendedStatsBucket.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Aggregation/Filter.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

use Elastica\Exception\InvalidException;
Expand Down
2 changes: 2 additions & 0 deletions src/Aggregation/Filters.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

use Elastica\Exception\InvalidException;
Expand Down
2 changes: 2 additions & 0 deletions src/Aggregation/GapPolicyInterface.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

use Elastica\Aggregation\Traits\GapPolicyTrait;
Expand Down
2 changes: 2 additions & 0 deletions src/Aggregation/GeoBounds.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Aggregation/GeoCentroid.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Aggregation/GeoDistance.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

use Elastica\Exception\InvalidException;
Expand Down
4 changes: 3 additions & 1 deletion src/Aggregation/GeohashGrid.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

/**
Expand Down Expand Up @@ -46,7 +48,7 @@ public function setField(string $field): self
public function setPrecision($precision): self
{
if (!\is_int($precision) && !\is_string($precision)) {
throw new \TypeError(\sprintf('Argument 1 passed to "%s()" must be of type int|string, %s given.', __METHOD__, \is_object($precision) ? \get_class($precision) : \gettype($precision)));
throw new \TypeError(\sprintf('Argument 1 passed to "%s()" must be of type int|string, %s given.', __METHOD__, \is_object($precision) ? $precision::class : \gettype($precision)));
}

return $this->setParam('precision', $precision);
Expand Down
2 changes: 2 additions & 0 deletions src/Aggregation/GeotileGridAggregation.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Aggregation/GlobalAggregation.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Aggregation/Histogram.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Aggregation/IpRange.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

use Elastica\Exception\InvalidException;
Expand Down
2 changes: 2 additions & 0 deletions src/Aggregation/Max.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Aggregation/Min.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Aggregation/Missing.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Aggregation/Nested.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Aggregation/NormalizeAggregation.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Aggregation/ParentAggregation.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Aggregation/Percentiles.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Aggregation/PercentilesBucket.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Aggregation/Range.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

use Elastica\Exception\InvalidException;
Expand Down
2 changes: 2 additions & 0 deletions src/Aggregation/ReverseNested.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Aggregation/Sampler.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Aggregation/ScriptedMetric.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Aggregation/SerialDiff.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Aggregation/SignificantTerms.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

use Elastica\Query\AbstractQuery;
Expand Down
2 changes: 2 additions & 0 deletions src/Aggregation/Stats.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Elastica\Aggregation;

/**
Expand Down
Loading
Loading