Skip to content

Commit af51f17

Browse files
committed
Merge branch '4.6'
# Conflicts: # phpstan-baseline-7.4.neon # phpstan-baseline-gte-8.0.neon # tests/lib/Repository/Service/Mock/SearchTest.php
2 parents 97383b0 + fb60a60 commit af51f17

File tree

12 files changed

+72
-89
lines changed

12 files changed

+72
-89
lines changed

phpstan-baseline.neon

Lines changed: 13 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -11076,12 +11076,6 @@ parameters:
1107611076
count: 1
1107711077
path: src/lib/Persistence/Legacy/Content/FieldValue/Converter/AuthorConverter.php
1107811078

11079-
-
11080-
message: '#^Property Ibexa\\Core\\Persistence\\Legacy\\Content\\StorageFieldDefinition\:\:\$dataInt1 \(int\) on left side of \?\? is not nullable\.$#'
11081-
identifier: nullCoalesce.property
11082-
count: 1
11083-
path: src/lib/Persistence/Legacy/Content/FieldValue/Converter/AuthorConverter.php
11084-
1108511079
-
1108611080
message: '#^Property Ibexa\\Core\\Persistence\\Legacy\\Content\\StorageFieldValue\:\:\$sortKeyString \(string\) does not accept bool\|float\|int\|string\|null\.$#'
1108711081
identifier: assign.propertyType
@@ -11521,7 +11515,7 @@ parameters:
1152111515
path: src/lib/Persistence/Legacy/Content/FieldValue/Converter/IntegerConverter.php
1152211516

1152311517
-
11524-
message: '#^Property Ibexa\\Core\\Persistence\\Legacy\\Content\\StorageFieldDefinition\:\:\$dataInt3 \(int\) does not accept array\|bool\|float\|int\|string\|null\.$#'
11518+
message: '#^Property Ibexa\\Core\\Persistence\\Legacy\\Content\\StorageFieldDefinition\:\:\$dataInt3 \(int\|null\) does not accept array\|bool\|float\|int\|string\|null\.$#'
1152511519
identifier: assign.propertyType
1152611520
count: 1
1152711521
path: src/lib/Persistence/Legacy/Content/FieldValue/Converter/IntegerConverter.php
@@ -11532,6 +11526,12 @@ parameters:
1153211526
count: 1
1153311527
path: src/lib/Persistence/Legacy/Content/FieldValue/Converter/IntegerConverter.php
1153411528

11529+
-
11530+
message: '#^Strict comparison using \=\=\= between false and false will always evaluate to true\.$#'
11531+
identifier: identical.alwaysTrue
11532+
count: 1
11533+
path: src/lib/Persistence/Legacy/Content/FieldValue/Converter/IntegerConverter.php
11534+
1153511535
-
1153611536
message: '#^Method Ibexa\\Core\\Persistence\\Legacy\\Content\\FieldValue\\Converter\\KeywordConverter\:\:toFieldDefinition\(\) has no return type specified\.$#'
1153711537
identifier: missingType.return
@@ -11904,18 +11904,6 @@ parameters:
1190411904
count: 1
1190511905
path: src/lib/Persistence/Legacy/Content/FieldValue/Converter/TextLineConverter.php
1190611906

11907-
-
11908-
message: '#^Property Ibexa\\Core\\Persistence\\Legacy\\Content\\StorageFieldDefinition\:\:\$dataInt1 \(int\) in isset\(\) is not nullable\.$#'
11909-
identifier: isset.property
11910-
count: 1
11911-
path: src/lib/Persistence/Legacy/Content/FieldValue/Converter/TextLineConverter.php
11912-
11913-
-
11914-
message: '#^Property Ibexa\\Core\\Persistence\\Legacy\\Content\\StorageFieldDefinition\:\:\$dataInt2 \(int\) in isset\(\) is not nullable\.$#'
11915-
identifier: isset.property
11916-
count: 1
11917-
path: src/lib/Persistence/Legacy/Content/FieldValue/Converter/TextLineConverter.php
11918-
1191911907
-
1192011908
message: '#^Property Ibexa\\Core\\Persistence\\Legacy\\Content\\StorageFieldDefinition\:\:\$dataText1 \(string\) does not accept array\|bool\|float\|int\|string\|null\.$#'
1192111909
identifier: assign.propertyType
@@ -11988,12 +11976,6 @@ parameters:
1198811976
count: 1
1198911977
path: src/lib/Persistence/Legacy/Content/FieldValue/Converter/UrlConverter.php
1199011978

11991-
-
11992-
message: '#^Property Ibexa\\Core\\Persistence\\Legacy\\Content\\StorageFieldDefinition\:\:\$dataInt2 \(int\) does not accept null\.$#'
11993-
identifier: assign.propertyType
11994-
count: 1
11995-
path: src/lib/Persistence/Legacy/Content/FieldValue/Converter/UserConverter.php
11996-
1199711979
-
1199811980
message: '#^Method Ibexa\\Core\\Persistence\\Legacy\\Content\\FieldValue\\ConverterRegistry\:\:__construct\(\) has parameter \$converterMap with no value type specified in iterable type array\.$#'
1199911981
identifier: missingType.iterableValue
@@ -13854,30 +13836,6 @@ parameters:
1385413836
count: 1
1385513837
path: src/lib/Persistence/Legacy/Content/Type/Mapper.php
1385613838

13857-
-
13858-
message: '#^Property Ibexa\\Core\\Persistence\\Legacy\\Content\\StorageFieldDefinition\:\:\$dataInt1 \(int\) does not accept int\|null\.$#'
13859-
identifier: assign.propertyType
13860-
count: 1
13861-
path: src/lib/Persistence/Legacy/Content/Type/Mapper.php
13862-
13863-
-
13864-
message: '#^Property Ibexa\\Core\\Persistence\\Legacy\\Content\\StorageFieldDefinition\:\:\$dataInt2 \(int\) does not accept int\|null\.$#'
13865-
identifier: assign.propertyType
13866-
count: 1
13867-
path: src/lib/Persistence/Legacy/Content/Type/Mapper.php
13868-
13869-
-
13870-
message: '#^Property Ibexa\\Core\\Persistence\\Legacy\\Content\\StorageFieldDefinition\:\:\$dataInt3 \(int\) does not accept int\|null\.$#'
13871-
identifier: assign.propertyType
13872-
count: 1
13873-
path: src/lib/Persistence/Legacy/Content/Type/Mapper.php
13874-
13875-
-
13876-
message: '#^Property Ibexa\\Core\\Persistence\\Legacy\\Content\\StorageFieldDefinition\:\:\$dataInt4 \(int\) does not accept int\|null\.$#'
13877-
identifier: assign.propertyType
13878-
count: 1
13879-
path: src/lib/Persistence/Legacy/Content/Type/Mapper.php
13880-
1388113839
-
1388213840
message: '#^Method Ibexa\\Core\\Persistence\\Legacy\\Content\\Type\\MemoryCachingHandler\:\:getSearchableFieldMap\(\) should return array\<mixed\> but returns array\|object\.$#'
1388313841
identifier: return.type
@@ -35934,12 +35892,6 @@ parameters:
3593435892
count: 1
3593535893
path: tests/integration/Core/Repository/SearchServiceLocationTest.php
3593635894

35937-
-
35938-
message: '#^Parameter \#1 \$class of class ReflectionProperty constructor expects object\|string, class\-string\|false given\.$#'
35939-
identifier: argument.type
35940-
count: 4
35941-
path: tests/integration/Core/Repository/SearchServiceLocationTest.php
35942-
3594335895
-
3594435896
message: '#^Parameter \#1 \$locationId of method Ibexa\\Contracts\\Core\\Repository\\LocationService\:\:loadLocation\(\) expects int, int\|null given\.$#'
3594535897
identifier: argument.type
@@ -36900,12 +36852,6 @@ parameters:
3690036852
count: 1
3690136853
path: tests/integration/Core/Repository/SearchServiceTest.php
3690236854

36903-
-
36904-
message: '#^Parameter \#1 \$class of class ReflectionProperty constructor expects object\|string, class\-string\|false given\.$#'
36905-
identifier: argument.type
36906-
count: 4
36907-
path: tests/integration/Core/Repository/SearchServiceTest.php
36908-
3690936855
-
3691036856
message: '#^Parameter \#1 \$parentLocationId of method Ibexa\\Contracts\\Core\\Repository\\LocationService\:\:newLocationCreateStruct\(\) expects int, int\|null given\.$#'
3691136857
identifier: argument.type
@@ -57924,6 +57870,12 @@ parameters:
5792457870
count: 2
5792557871
path: tests/lib/Repository/Service/Mock/SearchTest.php
5792657872

57873+
-
57874+
message: '#^Property Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Search\\SearchResult\<Ibexa\\Contracts\\Core\\Repository\\Values\\ValueObject\>\:\:\$totalCount \(int\<0, max\>\|null\) does not accept int\<\-1, max\>\.$#'
57875+
identifier: assign.propertyType
57876+
count: 2
57877+
path: tests/lib/Repository/Service/Mock/SearchTest.php
57878+
5792757879
-
5792857880
message: '#^Property Ibexa\\Tests\\Core\\Repository\\Service\\Mock\\SearchTest\:\:\$contentDomainMapperMock has no type specified\.$#'
5792957881
identifier: missingType.property

src/bundle/Core/Imagine/Cache/AliasGeneratorDecorator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function __construct(
7171
*
7272
* @return \Ibexa\Contracts\Core\Variation\Values\Variation
7373
*
74-
* @throws \Psr\Cache\InvalidArgumentException
74+
* @throws \Psr\Cache\InvalidArgumentException&\Throwable
7575
*/
7676
public function getVariation(Field $field, VersionInfo $versionInfo, string $variationName, array $parameters = []): Variation
7777
{

src/lib/Persistence/Cache/ContentTypeHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ function () {
613613
*
614614
* @return \Ibexa\Contracts\Core\Persistence\Content\Type
615615
*
616-
* @throws \Psr\Cache\InvalidArgumentException
616+
* @throws \Psr\Cache\InvalidArgumentException&\Throwable
617617
*/
618618
public function removeContentTypeTranslation(int $contentTypeId, string $languageCode): Type
619619
{

src/lib/Persistence/Cache/SettingHandler.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function create(string $group, string $identifier, string $serializedValu
2222
}
2323

2424
/**
25-
* @throws \Psr\Cache\InvalidArgumentException
25+
* @throws \Psr\Cache\InvalidArgumentException&\Throwable
2626
*/
2727
public function update(string $group, string $identifier, string $serializedValue): Setting
2828
{
@@ -36,7 +36,7 @@ public function update(string $group, string $identifier, string $serializedValu
3636
}
3737

3838
/**
39-
* @throws \Psr\Cache\CacheException
39+
* @throws \Psr\Cache\CacheException&\Throwable
4040
*/
4141
public function load(string $group, string $identifier): Setting
4242
{
@@ -58,7 +58,7 @@ public function load(string $group, string $identifier): Setting
5858
}
5959

6060
/**
61-
* @throws \Psr\Cache\InvalidArgumentException
61+
* @throws (\Psr\Cache\InvalidArgumentException&\Throwable)
6262
*/
6363
public function delete(string $group, string $identifier): void
6464
{

src/lib/Persistence/Cache/UrlAliasHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ public function deleteCorruptedUrlAliases()
491491
* @param int $locationId
492492
*
493493
* @throws \Ibexa\Core\Base\Exceptions\BadStateException
494-
* @throws \Psr\Cache\InvalidArgumentException
494+
* @throws \Psr\Cache\InvalidArgumentException&\Throwable
495495
*/
496496
public function repairBrokenUrlAliasesForLocation(int $locationId)
497497
{

src/lib/Persistence/Cache/UrlWildcardHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function create($sourceUrl, $destinationUrl, $forward = false)
4646
/**
4747
* {@inheritdoc}
4848
*
49-
* @throws \Psr\Cache\InvalidArgumentException
49+
* @throws \Psr\Cache\InvalidArgumentException&\Throwable
5050
*/
5151
public function update(
5252
int $id,

src/lib/Persistence/Legacy/Content/StorageFieldDefinition.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,28 +42,28 @@ class StorageFieldDefinition extends ValueObject
4242
/**
4343
* Data int 1.
4444
*
45-
* @var int
45+
* @var int|null
4646
*/
4747
public $dataInt1;
4848

4949
/**
5050
* Data int 2.
5151
*
52-
* @var int
52+
* @var int|null
5353
*/
5454
public $dataInt2;
5555

5656
/**
5757
* Data int 3.
5858
*
59-
* @var int
59+
* @var int|null
6060
*/
6161
public $dataInt3;
6262

6363
/**
6464
* Data int 4.
6565
*
66-
* @var int
66+
* @var int|null
6767
*/
6868
public $dataInt4;
6969

src/lib/Repository/Mapper/ContentDomainMapper.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,9 @@ public function buildContentDomainObjectsOnSearchResult(SearchResult $result, ar
642642
} else {
643643
$missingContentList[] = $hit->valueObject;
644644
unset($result->searchHits[$key]);
645-
--$result->totalCount;
645+
if ($result->totalCount !== null) {
646+
--$result->totalCount;
647+
}
646648
}
647649
}
648650

@@ -687,7 +689,9 @@ public function buildLocationDomainObjectsOnSearchResult(SearchResult $result, a
687689
} else {
688690
$missingLocations[] = $hit->valueObject;
689691
unset($result->searchHits[$key]);
690-
--$result->totalCount;
692+
if ($result->totalCount !== null) {
693+
--$result->totalCount;
694+
}
691695
}
692696
}
693697

src/lib/Resources/settings/repository/inner.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ services:
160160
alias: 'Ibexa\Core\Repository\ProxyFactory\ProxyGenerator'
161161

162162
Ibexa\Core\Repository\ProxyFactory\ProxyDomainMapperFactory:
163+
lazy: 'Ibexa\Contracts\Core\Repository\Repository\ProxyDomainMapperFactoryInterface'
163164
arguments:
164165
$proxyGenerator: '@Ibexa\Core\Repository\ProxyFactory\ProxyGeneratorInterface'
165166

tests/integration/Core/Repository/SearchServiceLocationTest.php

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,12 +1394,16 @@ protected function assertQueryFixture(LocationQuery $query, $fixture, $closure =
13941394

13951395
if ($ignoreScore) {
13961396
foreach ([$fixture, $result] as $result) {
1397-
$property = new \ReflectionProperty(get_class($result), 'maxScore');
1397+
$resultClass = get_class($result);
1398+
self::assertIsString($resultClass);
1399+
$property = new \ReflectionProperty($resultClass, 'maxScore');
13981400
$property->setAccessible(true);
13991401
$property->setValue($result, 0.0);
14001402

14011403
foreach ($result->searchHits as $hit) {
1402-
$property = new \ReflectionProperty(get_class($hit), 'score');
1404+
$hitClass = get_class($hit);
1405+
self::assertIsString($hitClass);
1406+
$property = new \ReflectionProperty($hitClass, 'score');
14031407
$property->setAccessible(true);
14041408
$property->setValue($hit, 0.0);
14051409
}
@@ -1408,11 +1412,14 @@ protected function assertQueryFixture(LocationQuery $query, $fixture, $closure =
14081412

14091413
foreach ([$fixture, $result] as $set) {
14101414
foreach ($set->searchHits as $hit) {
1411-
$property = new \ReflectionProperty(get_class($hit), 'index');
1415+
$hitClass = get_class($hit);
1416+
self::assertIsString($hitClass);
1417+
1418+
$property = new \ReflectionProperty($hitClass, 'index');
14121419
$property->setAccessible(true);
14131420
$property->setValue($hit, null);
14141421

1415-
$property = new \ReflectionProperty(get_class($hit), 'matchedTranslation');
1422+
$property = new \ReflectionProperty($hitClass, 'matchedTranslation');
14161423
$property->setAccessible(true);
14171424
$property->setValue($hit, null);
14181425
}
@@ -1428,13 +1435,20 @@ protected function assertQueryFixture(LocationQuery $query, $fixture, $closure =
14281435

14291436
/**
14301437
* Show a simplified view of the search result for manual introspection.
1431-
*
1432-
* @return string
14331438
*/
14341439
protected function printResult(SearchResult $result): string
14351440
{
14361441
$printed = '';
14371442
foreach ($result->searchHits as $hit) {
1443+
if (!isset($hit->valueObject['title'], $hit->valueObject['id'])) {
1444+
continue;
1445+
}
1446+
1447+
$printed .= sprintf(
1448+
"%s: %s\n",
1449+
$hit->valueObject['title'],
1450+
$hit->valueObject['description']
1451+
);
14381452
$printed .= sprintf(" - %s (%s)\n", $hit->valueObject['title'], $hit->valueObject['id']);
14391453
}
14401454

0 commit comments

Comments
 (0)