Skip to content

Commit 0f4ef7b

Browse files
committed
Fix Smile-SA#3578, phpcs/phpunit issues
1 parent bd51a44 commit 0f4ef7b

File tree

17 files changed

+27
-26
lines changed

17 files changed

+27
-26
lines changed

Resources/tests/unit/.phpunit.result.cache

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

src/module-elasticsuite-catalog-optimizer/Test/Unit/Model/Optimizer/Preview/SearchQueryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ private function getSpellcheckerRequestFactoryMock(): MockObject
105105
{
106106
$spellcheckRequestFactory = $this->getMockBuilder(SpellcheckRequestFactory::class)
107107
->disableOriginalConstructor()
108-
->setMethods(['create'])
108+
->onlyMethods(['create'])
109109
->getMock();
110110

111111
$spellcheckRequestFactory->method('create')->willReturnCallback(function ($args) {

src/module-elasticsuite-catalog-optimizer/Test/Unit/Model/Optimizer/PreviewTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ private function getOptimizerMock(): \PHPUnit\Framework\MockObject\MockObject
500500
return $this
501501
->getMockBuilder(Optimizer::class)
502502
->disableOriginalConstructor()
503-
->setMethods(['getSearchContainer', 'getQuickSearchContainer', 'getCatalogViewContainer'])
503+
->addMethods(['getSearchContainer', 'getQuickSearchContainer', 'getCatalogViewContainer'])
504504
->getMock();
505505
}
506506

src/module-elasticsuite-catalog/Test/Unit/Helper/AbstractAttributeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function testFieldTypes($attributeId, $backendType, $usesSource, $sourceM
5555

5656
$attributeFactoryMock = $this->getMockBuilder('\Magento\Catalog\Model\ResourceModel\Eav\AttributeFactory')
5757
->disableOriginalConstructor()
58-
->setMethods(['create'])
58+
->onlyMethods(['create'])
5959
->getMock();
6060

6161
$attributeFactoryMock->method('create')->will(($this->returnValue($attributeMock)));

src/module-elasticsuite-core/Api/Index/MappingInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,15 @@ public function getIdField();
7575
* @param string|NULL $analyzer Search analyzer.
7676
* @param string|NULL $defaultField Default field added to the list of fields.
7777
* All field weighted with 1 will be ignored if present.
78-
* @param integer $boost A multiplier applied to fields default weight.
78+
* @param integer|null $boost A multiplier applied to fields default weight.
7979
* @param FieldFilterInterface|null $fieldFilter A filter applied to fields.
8080
*
8181
* @return float[]
8282
*/
8383
public function getWeightedSearchProperties(
8484
?string $analyzer = null,
8585
?string $defaultField = null,
86-
int $boost = 1,
86+
?int $boost = 1,
8787
?FieldFilterInterface $fieldFilter = null
8888
);
8989

src/module-elasticsuite-core/Index/Mapping.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public function getIdField()
167167
public function getWeightedSearchProperties(
168168
?string $analyzer = null,
169169
?string $defaultField = null,
170-
int $boost = 1,
170+
?int $boost = 1,
171171
?FieldFilterInterface $fieldFilter = null
172172
) {
173173
$weightedFields = [];

src/module-elasticsuite-core/Search/Request/Aggregation/Bucket/DateHistogram.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class DateHistogram extends Histogram
5151
* @param string|null $nestedPath Nested path for nested bucket.
5252
* @param QueryInterface|null $filter Bucket filter.
5353
* @param QueryInterface|null $nestedFilter Nested filter for the bucket.
54-
* @param int $interval Histogram interval.
54+
* @param string|int $interval Histogram interval.
5555
* @param string|null $calendarInterval Histogram interval.
5656
* @param string $fixedInterval Histogram interval.
5757
* @param integer $minDocCount Histogram min doc count.
@@ -66,7 +66,7 @@ public function __construct(
6666
?string $nestedPath = null,
6767
?QueryInterface $filter = null,
6868
?QueryInterface $nestedFilter = null,
69-
$interval = "1d", // Deprecated.
69+
string|int $interval = "1d", // Deprecated.
7070
?string $calendarInterval = null,
7171
string $fixedInterval = "1d",
7272
int $minDocCount = 0,
@@ -83,7 +83,7 @@ public function __construct(
8383
$nestedPath,
8484
$filter,
8585
$nestedFilter,
86-
$interval,
86+
(int) $interval,
8787
$minDocCount,
8888
$extendedBounds
8989
);

src/module-elasticsuite-core/Search/Request/Aggregation/Bucket/Term.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class Term extends AbstractBucket
6767
* @param QueryInterface|null $filter Bucket filter.
6868
* @param QueryInterface|null $nestedFilter Nested filter for the bucket.
6969
* @param integer $size Bucket size.
70-
* @param string $sortOrder Bucket sort order.
70+
* @param array|string $sortOrder Bucket sort order.
7171
* @param array $include Include bucket filter.
7272
* @param array $exclude Exclude bucket filter.
7373
* @param int|null $minDocCount Min doc count bucket filter.
@@ -82,7 +82,7 @@ public function __construct(
8282
?QueryInterface $filter = null,
8383
?QueryInterface $nestedFilter = null,
8484
int $size = 0,
85-
string $sortOrder = BucketInterface::SORT_ORDER_COUNT,
85+
array|string $sortOrder = BucketInterface::SORT_ORDER_COUNT,
8686
array $include = [],
8787
array $exclude = [],
8888
?int $minDocCount = null

src/module-elasticsuite-core/Search/Request/Aggregation/Bucket/TopHits.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class TopHits extends AbstractBucket
5050
* @param string $name Bucket name.
5151
* @param array $sourceFields Source fields to fetch from the hits.
5252
* @param int $size Bucket size.
53-
* @param string $sortOrder Bucket Sort Order.
53+
* @param array|string $sortOrder Bucket Sort Order.
5454
* @param MetricInterface[] $metrics Bucket metrics.
5555
* @param BucketInterface[] $childBuckets Child buckets.
5656
* @param PipelineInterface[] $pipelines Bucket pipelines.
@@ -62,7 +62,7 @@ public function __construct(
6262
string $name,
6363
array $sourceFields = [],
6464
int $size = 1,
65-
string $sortOrder = BucketInterface::SORT_ORDER_COUNT,
65+
array|string $sortOrder = BucketInterface::SORT_ORDER_COUNT,
6666
array $metrics = [],
6767
array $childBuckets = [],
6868
array $pipelines = [],

src/module-elasticsuite-core/Search/Request/Query/Fulltext/QueryBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ private function getPhoneticQuery(ContainerConfigurationInterface $containerConf
357357
* @param string|null $analyzer Target analyzer.
358358
* @param FieldFilterInterface|null $fieldFilter Field filter.
359359
* @param string|null $defaultField Default search field.
360-
* @param integer $boost Additional boost applied to the fields (multiplicative).
360+
* @param integer|null $boost Additional boost applied to the fields (multiplicative).
361361
*
362362
* @return array
363363
*/
@@ -366,7 +366,7 @@ private function getWeightedFields(
366366
?string $analyzer = null,
367367
?FieldFilterInterface $fieldFilter = null,
368368
?string $defaultField = null,
369-
int $boost = 1
369+
?int $boost = 1
370370
) {
371371

372372
$mapping = $containerConfig->getMapping();

src/module-elasticsuite-core/Search/Request/Query/Span/SpanOr.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ class SpanOr implements SpanQueryInterface
5151
*/
5252
public function __construct(
5353
array $clauses = [],
54-
?string $name = null,
55-
string $boost = QueryInterface::DEFAULT_BOOST_VALUE
54+
?string $name = null,
55+
string $boost = QueryInterface::DEFAULT_BOOST_VALUE
5656
) {
5757
$this->clauses = $clauses;
5858
$this->name = $name;

src/module-elasticsuite-core/Test/Unit/Model/SuggestedTermsProviderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ protected function setUp(): void
6161
$this->termDataProviderMock = $this->createMock(TermDataProvider::class);
6262
$this->queryStringProviderFactoryMock = $this->getMockBuilder(QueryStringProvider::class. 'Factory')
6363
->disableOriginalConstructor()
64-
->setMethods(['create'])
64+
->onlyMethods(['create'])
6565
->getMock();
6666

6767
$this->suggestedTermsProvider = new SuggestedTermsProvider(

src/module-elasticsuite-core/Test/Unit/Search/Adapter/Elasticsuite/AdapterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ private function getQueryResponseFactoryMock()
112112
{
113113
$queryResponseFactoryMock = $this->getMockBuilder(QueryResponse::class . 'Factory')
114114
->disableOriginalConstructor()
115-
->setMethods(['create'])
115+
->onlyMethods(['create'])
116116
->getMock();
117117

118118
$queryResponseFactoryMock->method('create')->will($this->returnArgument(0));

src/module-elasticsuite-core/Test/Unit/Search/Request/Aggregation/AggregationFactoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ private function getAggregationFactory()
5959

6060
$factoryName = sprintf("%s%s", BucketInterface::class, 'Factory');
6161
$aggregationFactoryMock = $this->getMockBuilder($factoryName)
62-
->setMethods(['create'])
62+
->onlyMethods(['create'])
6363
->getMock();
6464

6565
$aggregationFactoryMock->method('create')

src/module-elasticsuite-core/Test/Unit/Search/Request/Aggregation/PipelineFactoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ private function getPipelineFactory()
5959

6060
$factoryName = sprintf("%s%s", PipelineInterface::class, 'Factory');
6161
$pipelineFactoryMock = $this->getMockBuilder($factoryName)
62-
->setMethods(['create'])
62+
->onlyMethods(['create'])
6363
->getMock();
6464

6565
$pipelineFactoryMock->method('create')

src/module-elasticsuite-core/Test/Unit/Search/Request/BuilderTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ private function getSpellcheckerRequestFactoryMock(): MockObject
107107
{
108108
$spellcheckRequestFactory = $this->getMockBuilder(SpellcheckRequestFactory::class)
109109
->disableOriginalConstructor()
110-
->setMethods(['create'])
110+
->onlyMethods(['create'])
111111
->getMock();
112112

113113
$spellcheckRequestFactory->method('create')->willReturnCallback(function ($args) {
@@ -127,7 +127,7 @@ private function getContainerConfigurationFactoryMock(): MockObject
127127
{
128128
$containerConfigurationFactory = $this->getMockBuilder(ContainerConfigurationFactory::class)
129129
->disableOriginalConstructor()
130-
->setMethods(['create'])
130+
->onlyMethods(['create'])
131131
->getMock();
132132

133133
$containerConfigurationFactory->method('create')->willReturnCallback(function ($args) {
@@ -199,7 +199,7 @@ private function getSearchRequestFactoryMock(): MockObject
199199
{
200200
$requestFactory = $this->getMockBuilder(RequestFactory::class)
201201
->disableOriginalConstructor()
202-
->setMethods(['create'])
202+
->onlyMethods(['create'])
203203
->getMock();
204204

205205
$requestFactory->method('create')->willReturn([]);
@@ -216,7 +216,7 @@ private function getDimensionFactoryMock(): MockObject
216216
{
217217
$dimensionFactory = $this->getMockBuilder(DimensionFactory::class)
218218
->disableOriginalConstructor()
219-
->setMethods(['create'])
219+
->onlyMethods(['create'])
220220
->getMock();
221221

222222
$dimensionFactory->method('create')->willReturn([]);

src/module-elasticsuite-core/Test/Unit/Search/Request/Query/QueryFactoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ private function getQueryFactory()
5959

6060
$factoryName = sprintf("%s%s", QueryInterface::class, 'Factory');
6161
$queryFactoryMock = $this->getMockBuilder($factoryName)
62-
->setMethods(['create'])
62+
->onlyMethods(['create'])
6363
->getMock();
6464

6565
$queryFactoryMock->method('create')

0 commit comments

Comments
 (0)