From bb28ac46875f43bc2138e8b2482be424f5eacbb0 Mon Sep 17 00:00:00 2001 From: Oleg Zhulnev Date: Sat, 27 Jan 2024 23:40:06 +0300 Subject: [PATCH] Enable declare_strict_types option and apply @PHP80Migration set with risky rules --- .php-cs-fixer.dist.php | 3 ++- src/AbstractUpdateAction.php | 2 ++ src/Aggregation/AbstractAggregation.php | 2 ++ src/Aggregation/AbstractSimpleAggregation.php | 2 ++ src/Aggregation/AbstractTermsAggregation.php | 2 ++ src/Aggregation/AdjacencyMatrix.php | 2 ++ src/Aggregation/AutoDateHistogram.php | 2 ++ src/Aggregation/Avg.php | 2 ++ src/Aggregation/AvgBucket.php | 2 ++ src/Aggregation/BucketScript.php | 2 ++ src/Aggregation/BucketSelector.php | 2 ++ src/Aggregation/Cardinality.php | 2 ++ src/Aggregation/Children.php | 2 ++ src/Aggregation/Composite.php | 2 ++ src/Aggregation/CumulativeSum.php | 2 ++ src/Aggregation/DateHistogram.php | 2 ++ src/Aggregation/DateRange.php | 2 ++ src/Aggregation/Derivative.php | 2 ++ src/Aggregation/DiversifiedSampler.php | 2 ++ src/Aggregation/ExtendedStats.php | 2 ++ src/Aggregation/ExtendedStatsBucket.php | 2 ++ src/Aggregation/Filter.php | 2 ++ src/Aggregation/Filters.php | 2 ++ src/Aggregation/GapPolicyInterface.php | 2 ++ src/Aggregation/GeoBounds.php | 2 ++ src/Aggregation/GeoCentroid.php | 2 ++ src/Aggregation/GeoDistance.php | 2 ++ src/Aggregation/GeohashGrid.php | 4 +++- src/Aggregation/GeotileGridAggregation.php | 2 ++ src/Aggregation/GlobalAggregation.php | 2 ++ src/Aggregation/Histogram.php | 2 ++ src/Aggregation/IpRange.php | 2 ++ src/Aggregation/Max.php | 2 ++ src/Aggregation/Min.php | 2 ++ src/Aggregation/Missing.php | 2 ++ src/Aggregation/Nested.php | 2 ++ src/Aggregation/NormalizeAggregation.php | 2 ++ src/Aggregation/ParentAggregation.php | 2 ++ src/Aggregation/Percentiles.php | 2 ++ src/Aggregation/PercentilesBucket.php | 2 ++ src/Aggregation/Range.php | 2 ++ src/Aggregation/ReverseNested.php | 2 ++ src/Aggregation/Sampler.php | 2 ++ src/Aggregation/ScriptedMetric.php | 2 ++ src/Aggregation/SerialDiff.php | 2 ++ src/Aggregation/SignificantTerms.php | 2 ++ src/Aggregation/Stats.php | 2 ++ src/Aggregation/StatsBucket.php | 2 ++ src/Aggregation/Sum.php | 2 ++ src/Aggregation/SumBucket.php | 2 ++ src/Aggregation/Terms.php | 2 ++ src/Aggregation/TopHits.php | 2 ++ src/Aggregation/Traits/BucketsPathTrait.php | 2 ++ src/Aggregation/Traits/GapPolicyTrait.php | 2 ++ src/Aggregation/Traits/KeyedTrait.php | 2 ++ src/Aggregation/Traits/MissingTrait.php | 2 ++ src/Aggregation/Traits/ShardSizeTrait.php | 2 ++ src/Aggregation/ValueCount.php | 2 ++ src/Aggregation/WeightedAvg.php | 2 ++ src/ArrayableInterface.php | 2 ++ src/Bulk.php | 2 ++ src/Bulk/Action.php | 2 ++ src/Bulk/Action/AbstractDocument.php | 2 ++ src/Bulk/Action/CreateDocument.php | 2 ++ src/Bulk/Action/DeleteDocument.php | 2 ++ src/Bulk/Action/IndexDocument.php | 2 ++ src/Bulk/Action/UpdateDocument.php | 2 ++ src/Bulk/Response.php | 2 ++ src/Bulk/ResponseSet.php | 2 ++ src/Client.php | 10 ++++++---- src/ClientConfiguration.php | 2 ++ src/Cluster.php | 2 ++ src/Cluster/Health.php | 2 ++ src/Cluster/Health/Index.php | 2 ++ src/Cluster/Health/Shard.php | 2 ++ src/Cluster/Settings.php | 4 +++- src/Collapse.php | 2 ++ src/Collapse/InnerHits.php | 2 ++ src/Connection.php | 2 ++ src/Connection/ConnectionPool.php | 2 ++ src/Connection/Strategy/CallbackStrategy.php | 2 ++ src/Connection/Strategy/RoundRobin.php | 2 ++ src/Connection/Strategy/Simple.php | 2 ++ src/Connection/Strategy/StrategyFactory.php | 2 ++ src/Connection/Strategy/StrategyInterface.php | 2 ++ src/Document.php | 2 ++ src/Exception/Bulk/Response/ActionException.php | 2 ++ src/Exception/Bulk/ResponseException.php | 2 ++ src/Exception/BulkException.php | 2 ++ src/Exception/ClientException.php | 2 ++ src/Exception/DeprecatedException.php | 2 ++ src/Exception/ExceptionInterface.php | 2 ++ src/Exception/InvalidException.php | 2 ++ src/Exception/NotFoundException.php | 2 ++ src/Exception/NotImplementedException.php | 2 ++ src/Exception/QueryBuilderException.php | 2 ++ src/Exception/RequestEntityTooLargeException.php | 2 ++ src/Exception/RuntimeException.php | 2 ++ src/Index.php | 2 ++ src/Index/Recovery.php | 2 ++ src/Index/Settings.php | 4 +++- src/Index/Stats.php | 2 ++ src/IndexTemplate.php | 2 ++ src/JSON.php | 2 ++ src/Mapping.php | 2 ++ src/Multi/MultiBuilder.php | 2 ++ src/Multi/MultiBuilderInterface.php | 2 ++ src/Multi/ResultSet.php | 2 ++ src/Multi/Search.php | 2 ++ src/NameableInterface.php | 2 ++ src/Node.php | 2 ++ src/Node/Info.php | 2 ++ src/Node/Stats.php | 2 ++ src/Param.php | 2 ++ src/Pipeline.php | 2 ++ src/PointInTime.php | 2 ++ src/Processor/AbstractProcessor.php | 2 ++ src/Processor/AppendProcessor.php | 2 ++ src/Processor/AttachmentProcessor.php | 2 ++ src/Processor/BytesProcessor.php | 2 ++ src/Processor/ConvertProcessor.php | 2 ++ src/Processor/DateIndexNameProcessor.php | 2 ++ src/Processor/DateProcessor.php | 2 ++ src/Processor/DotExpanderProcessor.php | 2 ++ src/Processor/FailProcessor.php | 2 ++ src/Processor/ForeachProcessor.php | 4 +++- src/Processor/JoinProcessor.php | 2 ++ src/Processor/JsonProcessor.php | 2 ++ src/Processor/KvProcessor.php | 2 ++ src/Processor/LowercaseProcessor.php | 2 ++ src/Processor/RemoveProcessor.php | 2 ++ src/Processor/RenameProcessor.php | 2 ++ src/Processor/SetProcessor.php | 2 ++ src/Processor/SortProcessor.php | 2 ++ src/Processor/SplitProcessor.php | 2 ++ src/Processor/Traits/FieldTrait.php | 2 ++ src/Processor/Traits/IgnoreFailureTrait.php | 2 ++ src/Processor/Traits/IgnoreMissingTrait.php | 2 ++ src/Processor/Traits/TargetFieldTrait.php | 2 ++ src/Processor/TrimProcessor.php | 2 ++ src/Processor/UppercaseProcessor.php | 2 ++ src/Query.php | 2 ++ src/Query/AbstractGeoDistance.php | 2 ++ src/Query/AbstractGeoShape.php | 2 ++ src/Query/AbstractQuery.php | 2 ++ src/Query/AbstractSpanQuery.php | 2 ++ src/Query/BoolQuery.php | 2 ++ src/Query/Boosting.php | 2 ++ src/Query/ConstantScore.php | 2 ++ src/Query/DisMax.php | 2 ++ src/Query/DistanceFeature.php | 2 ++ src/Query/Exists.php | 2 ++ src/Query/FunctionScore.php | 2 ++ src/Query/Fuzzy.php | 2 ++ src/Query/GeoBoundingBox.php | 2 ++ src/Query/GeoDistance.php | 2 ++ src/Query/GeoPolygon.php | 2 ++ src/Query/GeoShapePreIndexed.php | 2 ++ src/Query/GeoShapeProvided.php | 2 ++ src/Query/HasChild.php | 2 ++ src/Query/HasParent.php | 2 ++ src/Query/Ids.php | 2 ++ src/Query/InnerHits.php | 2 ++ src/Query/Limit.php | 2 ++ src/Query/MatchAll.php | 2 ++ src/Query/MatchNone.php | 2 ++ src/Query/MatchPhrase.php | 2 ++ src/Query/MatchPhrasePrefix.php | 2 ++ src/Query/MatchQuery.php | 2 ++ src/Query/MoreLikeThis.php | 2 ++ src/Query/MultiMatch.php | 2 ++ src/Query/Nested.php | 2 ++ src/Query/ParentId.php | 2 ++ src/Query/Percolate.php | 2 ++ src/Query/Prefix.php | 2 ++ src/Query/QueryString.php | 2 ++ src/Query/Range.php | 2 ++ src/Query/Regexp.php | 2 ++ src/Query/Script.php | 2 ++ src/Query/Simple.php | 2 ++ src/Query/SimpleQueryString.php | 2 ++ src/Query/SpanContaining.php | 2 ++ src/Query/SpanFirst.php | 2 ++ src/Query/SpanMulti.php | 2 ++ src/Query/SpanNear.php | 2 ++ src/Query/SpanNot.php | 2 ++ src/Query/SpanOr.php | 2 ++ src/Query/SpanTerm.php | 2 ++ src/Query/SpanWithin.php | 2 ++ src/Query/Term.php | 2 ++ src/Query/Terms.php | 4 +++- src/Query/TermsSet.php | 4 +++- src/Query/Wildcard.php | 2 ++ src/QueryBuilder.php | 2 ++ src/QueryBuilder/DSL.php | 2 ++ src/QueryBuilder/DSL/Aggregation.php | 2 ++ src/QueryBuilder/DSL/Collapse.php | 2 ++ src/QueryBuilder/DSL/Query.php | 2 ++ src/QueryBuilder/DSL/Suggest.php | 2 ++ src/QueryBuilder/Facade.php | 2 ++ src/QueryBuilder/Version.php | 2 ++ src/QueryBuilder/Version/Latest.php | 2 ++ src/QueryBuilder/Version/Version700.php | 2 ++ src/Reindex.php | 2 ++ src/Request.php | 2 ++ src/Rescore/AbstractRescore.php | 2 ++ src/Rescore/Query.php | 2 ++ src/Response.php | 2 ++ src/ResponseConverter.php | 2 ++ src/Result.php | 2 ++ src/ResultSet.php | 2 ++ src/ResultSet/BuilderInterface.php | 2 ++ src/ResultSet/ChainProcessor.php | 2 ++ src/ResultSet/DefaultBuilder.php | 2 ++ src/ResultSet/ProcessingBuilder.php | 2 ++ src/ResultSet/ProcessorInterface.php | 2 ++ src/Script/AbstractScript.php | 2 ++ src/Script/Script.php | 2 ++ src/Script/ScriptFields.php | 2 ++ src/Script/ScriptId.php | 2 ++ src/Scroll.php | 2 ++ src/Search.php | 2 ++ src/SearchableInterface.php | 2 ++ src/Snapshot.php | 2 ++ src/Status.php | 6 +++--- src/Suggest.php | 2 ++ src/Suggest/AbstractSuggest.php | 2 ++ .../AbstractCandidateGenerator.php | 2 ++ .../CandidateGenerator/DirectGenerator.php | 2 ++ src/Suggest/Completion.php | 2 ++ src/Suggest/Phrase.php | 2 ++ src/Suggest/Term.php | 2 ++ src/Task.php | 2 ++ src/Util.php | 6 ++++-- .../AbstractSimpleAggregationTest.php | 2 ++ tests/Aggregation/AdjacencyMatrixTest.php | 2 ++ tests/Aggregation/AggregationMetadataTest.php | 2 ++ tests/Aggregation/AutoDateHistogramTest.php | 2 ++ tests/Aggregation/AvgBucketTest.php | 2 ++ tests/Aggregation/AvgTest.php | 2 ++ tests/Aggregation/BaseAggregationTest.php | 2 ++ tests/Aggregation/BucketScriptTest.php | 2 ++ tests/Aggregation/BucketSelectorTest.php | 2 ++ tests/Aggregation/CardinalityTest.php | 2 ++ tests/Aggregation/ChildrenTest.php | 2 ++ tests/Aggregation/CompositeTest.php | 2 ++ tests/Aggregation/CumulativeSumTest.php | 2 ++ tests/Aggregation/DateHistogramTest.php | 2 ++ tests/Aggregation/DateRangeTest.php | 2 ++ tests/Aggregation/DerivativeTest.php | 2 ++ tests/Aggregation/DiversifiedSamplerTest.php | 2 ++ tests/Aggregation/ExtendedStatsBucketTest.php | 2 ++ tests/Aggregation/ExtendedStatsTest.php | 2 ++ tests/Aggregation/FilterTest.php | 2 ++ tests/Aggregation/FiltersTest.php | 2 ++ tests/Aggregation/GeoBoundsTest.php | 2 ++ tests/Aggregation/GeoCentroidTest.php | 2 ++ tests/Aggregation/GeoDistanceTest.php | 2 ++ tests/Aggregation/GeohashGridTest.php | 2 ++ tests/Aggregation/GeotileGridAggregationTest.php | 2 ++ tests/Aggregation/GlobalAggregationTest.php | 2 ++ tests/Aggregation/HistogramTest.php | 2 ++ tests/Aggregation/IpRangeTest.php | 2 ++ tests/Aggregation/MaxTest.php | 2 ++ tests/Aggregation/MinTest.php | 2 ++ tests/Aggregation/MissingTest.php | 2 ++ tests/Aggregation/NestedTest.php | 2 ++ tests/Aggregation/NormalizeAggregationTest.php | 2 ++ tests/Aggregation/ParentAggregationTest.php | 2 ++ tests/Aggregation/PercentilesBucketTest.php | 2 ++ tests/Aggregation/PercentilesTest.php | 2 ++ tests/Aggregation/RangeTest.php | 2 ++ tests/Aggregation/ReverseNestedTest.php | 2 ++ tests/Aggregation/SamplerTest.php | 2 ++ tests/Aggregation/ScriptTest.php | 2 ++ tests/Aggregation/ScriptedMetricTest.php | 2 ++ tests/Aggregation/SerialDiffTest.php | 2 ++ tests/Aggregation/SignificantTermsTest.php | 2 ++ tests/Aggregation/StatsBucketTest.php | 2 ++ tests/Aggregation/StatsTest.php | 2 ++ tests/Aggregation/SumBucketTest.php | 2 ++ tests/Aggregation/SumTest.php | 2 ++ tests/Aggregation/TermsTest.php | 2 ++ tests/Aggregation/TopHitsTest.php | 2 ++ tests/Aggregation/ValueCountTest.php | 2 ++ tests/Aggregation/WeightedAvgTest.php | 2 ++ tests/Base.php | 2 ++ tests/BasePipeline.php | 2 ++ tests/Bulk/Action/AbstractDocumentTest.php | 2 ++ tests/Bulk/Action/UpdateDocumentTest.php | 14 ++++++++------ tests/Bulk/ActionTest.php | 2 ++ tests/Bulk/ResponseSetTest.php | 2 ++ tests/BulkTest.php | 16 +++++++++------- tests/ClientConfigurationTest.php | 2 ++ tests/ClientFunctionalTest.php | 4 +++- tests/ClientTest.php | 2 ++ tests/Cluster/Health/IndexTest.php | 2 ++ tests/Cluster/Health/ShardTest.php | 2 ++ tests/Cluster/HealthTest.php | 2 ++ tests/Cluster/SettingsTest.php | 2 ++ tests/ClusterTest.php | 2 ++ tests/Collapse/CollapseTest.php | 2 ++ tests/Connection/ConnectionPoolTest.php | 2 ++ .../Connection/Strategy/CallbackStrategyTest.php | 2 ++ tests/Connection/Strategy/EmptyStrategy.php | 2 ++ tests/Connection/Strategy/RoundRobinTest.php | 4 +++- tests/Connection/Strategy/SimpleTest.php | 4 +++- .../Connection/Strategy/StrategyFactoryTest.php | 2 ++ tests/ConnectionTest.php | 2 ++ tests/DeprecatedClassBase.php | 2 ++ tests/DocumentTest.php | 2 ++ tests/ExampleTest.php | 2 ++ tests/Exception/AbstractExceptionTest.php | 2 ++ .../Bulk/Response/ActionExceptionTest.php | 2 ++ tests/Exception/Bulk/ResponseExceptionTest.php | 2 ++ tests/Exception/BulkExceptionTest.php | 2 ++ tests/Exception/ClientExceptionTest.php | 2 ++ tests/Exception/InvalidExceptionTest.php | 2 ++ tests/Exception/NotFoundExceptionTest.php | 2 ++ tests/Exception/NotImplementedExceptionTest.php | 2 ++ tests/Exception/QueryBuilderExceptionTest.php | 2 ++ tests/Exception/RuntimeExceptionTest.php | 2 ++ tests/Index/RecoveryTest.php | 2 ++ tests/Index/SettingsTest.php | 2 ++ tests/Index/StatsTest.php | 2 ++ tests/IndexTemplateTest.php | 2 ++ tests/IndexTest.php | 2 ++ tests/JSONTest.php | 2 ++ tests/MappingTest.php | 2 ++ tests/Multi/MultiBuilderTest.php | 2 ++ tests/Multi/SearchTest.php | 2 ++ tests/Node/InfoTest.php | 2 ++ tests/NodeTest.php | 2 ++ tests/ParamTest.php | 2 ++ tests/PipelineTest.php | 2 ++ tests/PointInTimeTest.php | 2 ++ tests/Processor/AppendProcessorTest.php | 2 ++ tests/Processor/AttachmentProcessorTest.php | 2 ++ tests/Processor/BytesProcessorTest.php | 2 ++ tests/Processor/ConvertProcessorTest.php | 2 ++ tests/Processor/DateIndexNameProcessorTest.php | 2 ++ tests/Processor/DateProcessorTest.php | 2 ++ tests/Processor/DotExpanderProcessorTest.php | 2 ++ tests/Processor/FailProcessorTest.php | 2 ++ tests/Processor/ForeachProcessorTest.php | 2 ++ tests/Processor/JoinProcessorTest.php | 2 ++ tests/Processor/JsonProcessorTest.php | 2 ++ tests/Processor/KvProcessorTest.php | 2 ++ tests/Processor/LowercaseProcessorTest.php | 2 ++ tests/Processor/RemoveProcessorTest.php | 2 ++ tests/Processor/RenameProcessorTest.php | 2 ++ tests/Processor/SetProcessorTest.php | 2 ++ tests/Processor/SortProcessorTest.php | 2 ++ tests/Processor/SplitProcessorTest.php | 2 ++ tests/Processor/TrimProcessorTest.php | 2 ++ tests/Processor/UppercaseProcessorTest.php | 2 ++ tests/Query/BoolQueryTest.php | 2 ++ tests/Query/BoostingTest.php | 2 ++ tests/Query/ConstantScoreTest.php | 2 ++ tests/Query/DisMaxTest.php | 2 ++ tests/Query/DistanceFeatureTest.php | 2 ++ tests/Query/EscapeStringTest.php | 2 ++ tests/Query/ExistsTest.php | 2 ++ tests/Query/FunctionScoreTest.php | 2 ++ tests/Query/FuzzyTest.php | 2 ++ tests/Query/GeoBoundingBoxTest.php | 2 ++ tests/Query/GeoDistanceTest.php | 2 ++ tests/Query/GeoPolygonTest.php | 2 ++ tests/Query/GeoShapePreIndexedTest.php | 2 ++ tests/Query/GeoShapeProvidedTest.php | 2 ++ tests/Query/HasChildTest.php | 2 ++ tests/Query/HasParentTest.php | 2 ++ tests/Query/HighlightTest.php | 2 ++ tests/Query/IdsTest.php | 2 ++ tests/Query/InnerHitsTest.php | 2 ++ tests/Query/LimitTest.php | 2 ++ tests/Query/MatchAllTest.php | 2 ++ tests/Query/MatchNoneTest.php | 2 ++ tests/Query/MatchPhrasePrefixTest.php | 2 ++ tests/Query/MatchPhraseTest.php | 2 ++ tests/Query/MatchQueryTest.php | 2 ++ tests/Query/MoreLikeThisTest.php | 2 ++ tests/Query/MultiMatchTest.php | 2 ++ tests/Query/NestedTest.php | 2 ++ tests/Query/ParentIdTest.php | 2 ++ tests/Query/PercolateTest.php | 2 ++ tests/Query/PostFilterTest.php | 2 ++ tests/Query/PrefixTest.php | 2 ++ tests/Query/QueryStringTest.php | 4 +++- tests/Query/RangeTest.php | 2 ++ tests/Query/RegexpTest.php | 2 ++ tests/Query/RescoreTest.php | 2 ++ tests/Query/ScriptTest.php | 2 ++ tests/Query/SimpleQueryStringTest.php | 2 ++ tests/Query/SimpleTest.php | 2 ++ tests/Query/SpanContainingTest.php | 2 ++ tests/Query/SpanFirstTest.php | 2 ++ tests/Query/SpanMultiTest.php | 2 ++ tests/Query/SpanNearTest.php | 2 ++ tests/Query/SpanNotTest.php | 2 ++ tests/Query/SpanOrTest.php | 2 ++ tests/Query/SpanTermTest.php | 2 ++ tests/Query/SpanWithinTest.php | 2 ++ tests/Query/TermTest.php | 2 ++ tests/Query/TermsSetTest.php | 2 ++ tests/Query/TermsTest.php | 2 ++ tests/Query/WildcardTest.php | 2 ++ tests/QueryBuilder/DSL/AbstractDSLTest.php | 4 +++- tests/QueryBuilder/DSL/AggregationTest.php | 2 ++ tests/QueryBuilder/DSL/CollapseTest.php | 2 ++ tests/QueryBuilder/DSL/QueryTest.php | 2 ++ tests/QueryBuilder/DSL/SuggestTest.php | 2 ++ tests/QueryBuilder/VersionTest.php | 10 ++++++---- tests/QueryBuilderTest.php | 2 ++ tests/QueryTest.php | 2 ++ tests/ReindexTest.php | 2 ++ tests/ResponseFunctionalTest.php | 2 ++ tests/ResponseTest.php | 2 ++ tests/ResultSet/BuilderTest.php | 2 ++ tests/ResultSet/ChainProcessorTest.php | 2 ++ tests/ResultSet/ProcessingBuilderTest.php | 2 ++ tests/ResultSetTest.php | 2 ++ tests/ResultTest.php | 2 ++ tests/Script/ScriptFieldsTest.php | 2 ++ tests/Script/ScriptIdTest.php | 2 ++ tests/Script/ScriptTest.php | 2 ++ tests/ScrollTest.php | 2 ++ tests/SearchTest.php | 2 ++ tests/SnapshotTest.php | 2 ++ tests/StatusTest.php | 6 +++--- tests/Suggest/CompletionTest.php | 2 ++ tests/Suggest/PhraseTest.php | 2 ++ tests/Suggest/TermTest.php | 2 ++ tests/SuggestTest.php | 2 ++ tests/TaskTest.php | 2 ++ tests/UtilTest.php | 2 ++ tests/bootstrap.php | 2 ++ 437 files changed, 910 insertions(+), 41 deletions(-) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index c612e7edd8..0ffa3293c3 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -8,7 +8,8 @@ return (new PhpCsFixer\Config()) ->setFinder($finder) ->setRules([ - '@PHP71Migration' => true, + '@PHP80Migration' => true, + '@PHP80Migration:risky' => true, '@PhpCsFixer' => true, '@PHPUnit75Migration:risky' => true, '@PSR2' => true, diff --git a/src/AbstractUpdateAction.php b/src/AbstractUpdateAction.php index 6ddbf84163..508f63df84 100644 --- a/src/AbstractUpdateAction.php +++ b/src/AbstractUpdateAction.php @@ -1,5 +1,7 @@ setParam('precision', $precision); diff --git a/src/Aggregation/GeotileGridAggregation.php b/src/Aggregation/GeotileGridAggregation.php index aa41687313..aa2b6ec2cc 100644 --- a/src/Aggregation/GeotileGridAggregation.php +++ b/src/Aggregation/GeotileGridAggregation.php @@ -1,5 +1,7 @@ _initConnections(); } @@ -897,11 +899,11 @@ protected function _buildTransport(array $config): Transport */ protected function isSymfonyHttpClient(Transport $transport): bool { - if (false !== \strpos(\get_class($transport->getClient()), 'Symfony\Component\HttpClient')) { + if (\str_contains(\get_class($transport->getClient()), 'Symfony\Component\HttpClient')) { return true; } try { - if (false !== \strpos(\get_class($transport->getAsyncClient()), 'Symfony\Component\HttpClient')) { + if (\str_contains(\get_class($transport->getAsyncClient()), 'Symfony\Component\HttpClient')) { return true; } } catch (NoAsyncClientException $e) { @@ -916,7 +918,7 @@ protected function setTransportClientOptions(HttpClientInterface $client, array if (empty($config) && empty($clientOptions)) { return $client; } - $class = \get_class($client); + $class = $client::class; if (!isset(AdapterOptions::HTTP_ADAPTERS[$class])) { throw new HttpClientException(\sprintf('The HTTP client %s is not supported for custom options', $class)); } diff --git a/src/ClientConfiguration.php b/src/ClientConfiguration.php index 61020e5d05..6094982bcb 100644 --- a/src/ClientConfiguration.php +++ b/src/ClientConfiguration.php @@ -1,5 +1,7 @@ setRawProcessor($processor); } else { - throw new \TypeError(\sprintf('Argument 2 passed to %s::__construct() must be of type %s|array, %s given.', self::class, AbstractProcessor::class, \is_object($processor) ? \get_class($processor) : \gettype($processor))); + throw new \TypeError(\sprintf('Argument 2 passed to %s::__construct() must be of type %s|array, %s given.', self::class, AbstractProcessor::class, \is_object($processor) ? $processor::class : \gettype($processor))); } } diff --git a/src/Processor/JoinProcessor.php b/src/Processor/JoinProcessor.php index d3d786b3fa..52ddcf6b1d 100644 --- a/src/Processor/JoinProcessor.php +++ b/src/Processor/JoinProcessor.php @@ -1,5 +1,7 @@ getParam($this->field); diff --git a/src/Query/TermsSet.php b/src/Query/TermsSet.php index ab52d42db0..68032be1ce 100644 --- a/src/Query/TermsSet.php +++ b/src/Query/TermsSet.php @@ -1,5 +1,7 @@ setMinimumShouldMatchScript($minimumShouldMatch); } else { - throw new \TypeError(\sprintf('Argument 3 passed to "%s()" must be of type %s|string, %s given.', __METHOD__, AbstractScript::class, \is_object($minimumShouldMatch) ? \get_class($minimumShouldMatch) : \gettype($minimumShouldMatch))); + throw new \TypeError(\sprintf('Argument 3 passed to "%s()" must be of type %s|string, %s given.', __METHOD__, AbstractScript::class, \is_object($minimumShouldMatch) ? $minimumShouldMatch::class : \gettype($minimumShouldMatch))); } } diff --git a/src/Query/Wildcard.php b/src/Query/Wildcard.php index 1bc20e13d9..e62f4180b2 100644 --- a/src/Query/Wildcard.php +++ b/src/Query/Wildcard.php @@ -1,5 +1,7 @@ getData(); - return \array_map(static function ($name): string { - return (string) $name; - }, \array_keys($data['indices'])); + return \array_map(static fn ($name): string => (string) $name, \array_keys($data['indices'])); } /** diff --git a/src/Suggest.php b/src/Suggest.php index dfe604b84b..1fa1536d9d 100644 --- a/src/Suggest.php +++ b/src/Suggest.php @@ -1,5 +1,7 @@ '%2F' - return false !== \strpos(\strtoupper($requestUri), '%2F'); + return \str_contains(\strtoupper($requestUri), '%2F'); } /** @@ -64,7 +66,7 @@ public static function escapeDateMath($requestUri) $escapedUriSegment = \str_replace(static::$dateMathSymbols, static::$escapedDateMathSymbols, $uriSegment); // '\\{' and '\\}' should not be escaped - if (false !== \strpos($uriSegment, '\\\\')) { + if (\str_contains($uriSegment, '\\\\')) { $escapedUriSegment = \str_replace(['\\\\%7B', '\\\\%7D'], ['\\\\{', '\\\\}'], $escapedUriSegment); } diff --git a/tests/Aggregation/AbstractSimpleAggregationTest.php b/tests/Aggregation/AbstractSimpleAggregationTest.php index 2580fb5822..2e2740917a 100644 --- a/tests/Aggregation/AbstractSimpleAggregationTest.php +++ b/tests/Aggregation/AbstractSimpleAggregationTest.php @@ -1,5 +1,7 @@ assertTrue($action->hasSource()); $expected = <<<'JSON' -{"update":{"_id":"1","_index":"index"}} -{"doc":{"foo":"bar"},"doc_as_upsert":true} -JSON; + {"update":{"_id":"1","_index":"index"}} + {"doc":{"foo":"bar"},"doc_as_upsert":true} + JSON; $this->assertSame($expected, \trim((string) $action)); @@ -81,9 +83,9 @@ public function testUpdateDocumentAsUpsert(): void $action->setDocument($document); $expected = <<<'JSON' -{"update":{"_id":"1","_index":"index"}} -{"doc":{"foo":"bar"}} -JSON; + {"update":{"_id":"1","_index":"index"}} + {"doc":{"foo":"bar"}} + JSON; $this->assertSame($expected, \trim((string) $action)); diff --git a/tests/Bulk/ActionTest.php b/tests/Bulk/ActionTest.php index 644bf6440e..c4200f856a 100644 --- a/tests/Bulk/ActionTest.php +++ b/tests/Bulk/ActionTest.php @@ -1,5 +1,7 @@ assertSame($expectedJson, \trim((string) $bulk)); diff --git a/tests/ClientConfigurationTest.php b/tests/ClientConfigurationTest.php index 4bc6c274a3..17a13f9713 100644 --- a/tests/ClientConfigurationTest.php +++ b/tests/ClientConfigurationTest.php @@ -1,5 +1,7 @@ assertEquals(['query_string' => $expected], $query->toArray()); $fields = []; - $max = \mt_rand(1, 10); + $max = \random_int(1, 10); for ($i = 0; $i < $max; ++$i) { $fields[] = \uniqid(); } diff --git a/tests/Query/RangeTest.php b/tests/Query/RangeTest.php index 71320a7efa..f687b4cf19 100644 --- a/tests/Query/RangeTest.php +++ b/tests/Query/RangeTest.php @@ -1,5 +1,7 @@ hasMethod('__construct')) { $this->assertEmpty($method->getParameters(), 'Constructor is not defined, but method has some parameters'); } else { diff --git a/tests/QueryBuilder/DSL/AggregationTest.php b/tests/QueryBuilder/DSL/AggregationTest.php index a00b792852..5dd9fa4c63 100644 --- a/tests/QueryBuilder/DSL/AggregationTest.php +++ b/tests/QueryBuilder/DSL/AggregationTest.php @@ -1,5 +1,7 @@ getQueries() as $query) { $this->assertTrue( \method_exists($dsl[0], $query), - 'query "'.$query.'" in '.\get_class($version).' must be defined in '.\get_class($dsl[0]) + 'query "'.$query.'" in '.$version::class.' must be defined in '.\get_class($dsl[0]) ); } foreach ($version->getAggregations() as $aggregation) { $this->assertTrue( \method_exists($dsl[1], $aggregation), - 'aggregation "'.$aggregation.'" in '.\get_class($version).' must be defined in '.\get_class($dsl[2]) + 'aggregation "'.$aggregation.'" in '.$version::class.' must be defined in '.\get_class($dsl[2]) ); } foreach ($version->getSuggesters() as $suggester) { $this->assertTrue( \method_exists($dsl[2], $suggester), - 'suggester "'.$suggester.'" in '.\get_class($version).' must be defined in '.\get_class($dsl[2]) + 'suggester "'.$suggester.'" in '.$version::class.' must be defined in '.\get_class($dsl[2]) ); } foreach ($version->getCollapsers() as $collapser) { $this->assertTrue( \method_exists($dsl[3], $collapser), - 'suggester "'.$collapser.'" in '.\get_class($version).' must be defined in '.\get_class($dsl[3]) + 'suggester "'.$collapser.'" in '.$version::class.' must be defined in '.\get_class($dsl[3]) ); } } diff --git a/tests/QueryBuilderTest.php b/tests/QueryBuilderTest.php index ba0660e078..f7d0d28a79 100644 --- a/tests/QueryBuilderTest.php +++ b/tests/QueryBuilderTest.php @@ -1,5 +1,7 @@ getIndicesWithAlias($aliasName); $this->assertEquals([$indexName], \array_map( - static function ($index) { - return $index->getName(); - }, + static fn ($index) => $index->getName(), $indicesWithAlias )); } diff --git a/tests/Suggest/CompletionTest.php b/tests/Suggest/CompletionTest.php index 58df78ee97..7833319fdb 100644 --- a/tests/Suggest/CompletionTest.php +++ b/tests/Suggest/CompletionTest.php @@ -1,5 +1,7 @@