Skip to content
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 0 additions & 55 deletions phpstan-baseline-7.4.neon
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,6 @@ parameters:
count: 1
path: src/bundle/Core/Features/Context/UserContext.php

-
message: '#^PHPDoc tag @throws with type Psr\\Cache\\InvalidArgumentException is not subtype of Throwable$#'
identifier: throws.notThrowable
count: 1
path: src/bundle/Core/Imagine/Cache/AliasGeneratorDecorator.php

-
message: '#^Parameter \#2 \$str of function fwrite expects string, string\|false given\.$#'
identifier: argument.type
Expand Down Expand Up @@ -191,37 +185,6 @@ parameters:
identifier: argument.type
count: 1
path: src/lib/MVC/Symfony/Matcher/ContentBased/UrlAlias.php

-
message: '#^PHPDoc tag @throws with type Psr\\Cache\\InvalidArgumentException is not subtype of Throwable$#'
identifier: throws.notThrowable
count: 1
path: src/lib/Persistence/Cache/ContentTypeHandler.php

-
message: '#^PHPDoc tag @throws with type Psr\\Cache\\CacheException is not subtype of Throwable$#'
identifier: throws.notThrowable
count: 1
path: src/lib/Persistence/Cache/SettingHandler.php

-
message: '#^PHPDoc tag @throws with type Psr\\Cache\\InvalidArgumentException is not subtype of Throwable$#'
identifier: throws.notThrowable
count: 2
path: src/lib/Persistence/Cache/SettingHandler.php

-
message: '#^PHPDoc tag @throws with type Ibexa\\Core\\Base\\Exceptions\\BadStateException\|Psr\\Cache\\InvalidArgumentException is not subtype of Throwable$#'
identifier: throws.notThrowable
count: 1
path: src/lib/Persistence/Cache/UrlAliasHandler.php

-
message: '#^PHPDoc tag @throws with type Psr\\Cache\\InvalidArgumentException is not subtype of Throwable$#'
identifier: throws.notThrowable
count: 1
path: src/lib/Persistence/Cache/UrlWildcardHandler.php

-
message: '#^Cannot access property \$ownerDocument on DOMElement\|false\.$#'
identifier: property.nonObject
Expand Down Expand Up @@ -456,18 +419,6 @@ parameters:
count: 3
path: tests/integration/Core/Repository/RoleServiceTest.php

-
message: '#^Parameter \#1 \$class of class ReflectionProperty constructor expects object\|string, class\-string\|false given\.$#'
identifier: argument.type
count: 4
path: tests/integration/Core/Repository/SearchServiceLocationTest.php

-
message: '#^Parameter \#1 \$class of class ReflectionProperty constructor expects object\|string, class\-string\|false given\.$#'
identifier: argument.type
count: 4
path: tests/integration/Core/Repository/SearchServiceTest.php

-
message: '#^Parameter \#1 \$str of function md5 expects string, int\<1, max\> given\.$#'
identifier: argument.type
Expand All @@ -480,12 +431,6 @@ parameters:
count: 1
path: tests/lib/MVC/Symfony/Security/UserWrappedTest.php

-
message: '#^Method Ibexa\\Tests\\Core\\MVC\\Symfony\\Templating\\Twig\\Extension\\FileSystemTwigIntegrationTestCase\:\:doIntegrationTest\(\) has no return type specified\.$#'
identifier: missingType.return
count: 1
path: tests/lib/MVC/Symfony/Templating/Twig/Extension/FileSystemTwigIntegrationTestCase.php

-
message: '#^Parameter \#1 \$function of function call_user_func_array expects callable\(\)\: mixed, array\{mixed, string\} given\.$#'
identifier: argument.type
Expand Down
13 changes: 0 additions & 13 deletions phpstan-baseline-gte-8.0.neon
Original file line number Diff line number Diff line change
Expand Up @@ -413,19 +413,6 @@ parameters:
identifier: argument.type
count: 1
path: tests/integration/Core/Repository/RoleServiceTest.php

-
message: '#^Parameter \#1 \$class of class ReflectionProperty constructor expects object\|string, class\-string\|false given\.$#'
identifier: argument.type
count: 4
path: tests/integration/Core/Repository/SearchServiceLocationTest.php

-
message: '#^Parameter \#1 \$class of class ReflectionProperty constructor expects object\|string, class\-string\|false given\.$#'
identifier: argument.type
count: 4
path: tests/integration/Core/Repository/SearchServiceTest.php

-
message: '#^Parameter \#1 \$string of function md5 expects string, int\<1, max\> given\.$#'
identifier: argument.type
Expand Down
56 changes: 7 additions & 49 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -18060,12 +18060,6 @@ parameters:
count: 1
path: src/lib/Persistence/Legacy/Content/FieldValue/Converter/AuthorConverter.php

-
message: '#^Property Ibexa\\Core\\Persistence\\Legacy\\Content\\StorageFieldDefinition\:\:\$dataInt1 \(int\) on left side of \?\? is not nullable\.$#'
identifier: nullCoalesce.property
count: 1
path: src/lib/Persistence/Legacy/Content/FieldValue/Converter/AuthorConverter.php

-
message: '#^Property Ibexa\\Core\\Persistence\\Legacy\\Content\\StorageFieldValue\:\:\$sortKeyString \(string\) does not accept bool\|float\|int\|string\|null\.$#'
identifier: assign.propertyType
Expand Down Expand Up @@ -18523,7 +18517,7 @@ parameters:
path: src/lib/Persistence/Legacy/Content/FieldValue/Converter/IntegerConverter.php

-
message: '#^Property Ibexa\\Core\\Persistence\\Legacy\\Content\\StorageFieldDefinition\:\:\$dataInt3 \(int\) does not accept array\|bool\|float\|int\|string\|null\.$#'
message: '#^Property Ibexa\\Core\\Persistence\\Legacy\\Content\\StorageFieldDefinition\:\:\$dataInt3 \(int\|null\) does not accept array\|bool\|float\|int\|string\|null\.$#'
identifier: assign.propertyType
count: 1
path: src/lib/Persistence/Legacy/Content/FieldValue/Converter/IntegerConverter.php
Expand All @@ -18534,6 +18528,12 @@ parameters:
count: 1
path: src/lib/Persistence/Legacy/Content/FieldValue/Converter/IntegerConverter.php

-
message: '#^Strict comparison using \=\=\= between false and false will always evaluate to true\.$#'
identifier: identical.alwaysTrue
count: 1
path: src/lib/Persistence/Legacy/Content/FieldValue/Converter/IntegerConverter.php

-
message: '#^Method Ibexa\\Core\\Persistence\\Legacy\\Content\\FieldValue\\Converter\\KeywordConverter\:\:toFieldDefinition\(\) has no return type specified\.$#'
identifier: missingType.return
Expand Down Expand Up @@ -18918,18 +18918,6 @@ parameters:
count: 1
path: src/lib/Persistence/Legacy/Content/FieldValue/Converter/TextLineConverter.php

-
message: '#^Property Ibexa\\Core\\Persistence\\Legacy\\Content\\StorageFieldDefinition\:\:\$dataInt1 \(int\) in isset\(\) is not nullable\.$#'
identifier: isset.property
count: 1
path: src/lib/Persistence/Legacy/Content/FieldValue/Converter/TextLineConverter.php

-
message: '#^Property Ibexa\\Core\\Persistence\\Legacy\\Content\\StorageFieldDefinition\:\:\$dataInt2 \(int\) in isset\(\) is not nullable\.$#'
identifier: isset.property
count: 1
path: src/lib/Persistence/Legacy/Content/FieldValue/Converter/TextLineConverter.php

-
message: '#^Property Ibexa\\Core\\Persistence\\Legacy\\Content\\StorageFieldDefinition\:\:\$dataText1 \(string\) does not accept array\|bool\|float\|int\|string\|null\.$#'
identifier: assign.propertyType
Expand Down Expand Up @@ -19002,12 +18990,6 @@ parameters:
count: 1
path: src/lib/Persistence/Legacy/Content/FieldValue/Converter/UrlConverter.php

-
message: '#^Property Ibexa\\Core\\Persistence\\Legacy\\Content\\StorageFieldDefinition\:\:\$dataInt2 \(int\) does not accept null\.$#'
identifier: assign.propertyType
count: 1
path: src/lib/Persistence/Legacy/Content/FieldValue/Converter/UserConverter.php

-
message: '#^Method Ibexa\\Core\\Persistence\\Legacy\\Content\\FieldValue\\ConverterRegistry\:\:__construct\(\) has parameter \$converterMap with no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
Expand Down Expand Up @@ -21006,30 +20988,6 @@ parameters:
count: 1
path: src/lib/Persistence/Legacy/Content/Type/Mapper.php

-
message: '#^Property Ibexa\\Core\\Persistence\\Legacy\\Content\\StorageFieldDefinition\:\:\$dataInt1 \(int\) does not accept int\|null\.$#'
identifier: assign.propertyType
count: 1
path: src/lib/Persistence/Legacy/Content/Type/Mapper.php

-
message: '#^Property Ibexa\\Core\\Persistence\\Legacy\\Content\\StorageFieldDefinition\:\:\$dataInt2 \(int\) does not accept int\|null\.$#'
identifier: assign.propertyType
count: 1
path: src/lib/Persistence/Legacy/Content/Type/Mapper.php

-
message: '#^Property Ibexa\\Core\\Persistence\\Legacy\\Content\\StorageFieldDefinition\:\:\$dataInt3 \(int\) does not accept int\|null\.$#'
identifier: assign.propertyType
count: 1
path: src/lib/Persistence/Legacy/Content/Type/Mapper.php

-
message: '#^Property Ibexa\\Core\\Persistence\\Legacy\\Content\\StorageFieldDefinition\:\:\$dataInt4 \(int\) does not accept int\|null\.$#'
identifier: assign.propertyType
count: 1
path: src/lib/Persistence/Legacy/Content/Type/Mapper.php

-
message: '#^Method Ibexa\\Core\\Persistence\\Legacy\\Content\\Type\\MemoryCachingHandler\:\:getSearchableFieldMap\(\) should return array\<mixed\> but returns array\|object\.$#'
identifier: return.type
Expand Down
2 changes: 1 addition & 1 deletion src/bundle/Core/Imagine/Cache/AliasGeneratorDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function __construct(
*
* @return \Ibexa\Contracts\Core\Variation\Values\Variation
*
* @throws \Psr\Cache\InvalidArgumentException
* @throws \Psr\Cache\InvalidArgumentException&\Throwable
*/
public function getVariation(Field $field, VersionInfo $versionInfo, $variationName, array $parameters = [])
{
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Persistence/Cache/ContentTypeHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ function () {
*
* @return \Ibexa\Contracts\Core\Persistence\Content\Type
*
* @throws \Psr\Cache\InvalidArgumentException
* @throws \Psr\Cache\InvalidArgumentException&\Throwable
*/
public function removeContentTypeTranslation(int $contentTypeId, string $languageCode): Type
{
Expand Down
6 changes: 3 additions & 3 deletions src/lib/Persistence/Cache/SettingHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function create(string $group, string $identifier, string $serializedValu
}

/**
* @throws \Psr\Cache\InvalidArgumentException
* @throws \Psr\Cache\InvalidArgumentException&\Throwable
*/
public function update(string $group, string $identifier, string $serializedValue): Setting
{
Expand All @@ -35,7 +35,7 @@ public function update(string $group, string $identifier, string $serializedValu
}

/**
* @throws \Psr\Cache\CacheException
* @throws \Psr\Cache\CacheException&\Throwable
*/
public function load(string $group, string $identifier): Setting
{
Expand All @@ -57,7 +57,7 @@ public function load(string $group, string $identifier): Setting
}

/**
* @throws \Psr\Cache\InvalidArgumentException
* @throws (\Psr\Cache\InvalidArgumentException&\Throwable)
*/
public function delete(string $group, string $identifier): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Persistence/Cache/UrlAliasHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ public function deleteCorruptedUrlAliases()
* @param int $locationId
*
* @throws \Ibexa\Core\Base\Exceptions\BadStateException
* @throws \Psr\Cache\InvalidArgumentException
* @throws \Psr\Cache\InvalidArgumentException&\Throwable
*/
public function repairBrokenUrlAliasesForLocation(int $locationId)
{
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Persistence/Cache/UrlWildcardHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function create($sourceUrl, $destinationUrl, $forward = false)
/**
* {@inheritdoc}
*
* @throws \Psr\Cache\InvalidArgumentException
* @throws \Psr\Cache\InvalidArgumentException&\Throwable
*/
public function update(
int $id,
Expand Down
8 changes: 4 additions & 4 deletions src/lib/Persistence/Legacy/Content/StorageFieldDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,28 +41,28 @@ class StorageFieldDefinition extends ValueObject
/**
* Data int 1.
*
* @var int
* @var int|null
*/
public $dataInt1;

/**
* Data int 2.
*
* @var int
* @var int|null
*/
public $dataInt2;

/**
* Data int 3.
*
* @var int
* @var int|null
*/
public $dataInt3;

/**
* Data int 4.
*
* @var int
* @var int|null
*/
public $dataInt4;

Expand Down
8 changes: 6 additions & 2 deletions src/lib/Repository/Mapper/ContentDomainMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,9 @@ public function buildContentDomainObjectsOnSearchResult(SearchResult $result, ar
} else {
$missingContentList[] = $hit->valueObject;
unset($result->searchHits[$key]);
--$result->totalCount;
if ($result->totalCount !== null) {
--$result->totalCount;
}
}
}

Expand Down Expand Up @@ -684,7 +686,9 @@ public function buildLocationDomainObjectsOnSearchResult(SearchResult $result, a
} else {
$missingLocations[] = $hit->valueObject;
unset($result->searchHits[$key]);
--$result->totalCount;
if ($result->totalCount !== null) {
--$result->totalCount;
}
}
}

Expand Down
1 change: 1 addition & 0 deletions src/lib/Resources/settings/repository/inner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ services:
alias: 'Ibexa\Core\Repository\ProxyFactory\ProxyGenerator'

Ibexa\Core\Repository\ProxyFactory\ProxyDomainMapperFactory:
lazy: 'Ibexa\Contracts\Core\Repository\Repository\ProxyDomainMapperFactoryInterface'
arguments:
$proxyGenerator: '@Ibexa\Core\Repository\ProxyFactory\ProxyGeneratorInterface'

Expand Down
28 changes: 21 additions & 7 deletions tests/integration/Core/Repository/SearchServiceLocationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1398,12 +1398,16 @@ protected function assertQueryFixture(LocationQuery $query, $fixture, $closure =

if ($ignoreScore) {
foreach ([$fixture, $result] as $result) {
$property = new \ReflectionProperty(get_class($result), 'maxScore');
$resultClass = get_class($result);
self::assertIsString($resultClass);
$property = new \ReflectionProperty($resultClass, 'maxScore');
$property->setAccessible(true);
$property->setValue($result, 0.0);

foreach ($result->searchHits as $hit) {
$property = new \ReflectionProperty(get_class($hit), 'score');
$hitClass = get_class($hit);
self::assertIsString($hitClass);
$property = new \ReflectionProperty($hitClass, 'score');
$property->setAccessible(true);
$property->setValue($hit, 0.0);
}
Expand All @@ -1412,11 +1416,14 @@ protected function assertQueryFixture(LocationQuery $query, $fixture, $closure =

foreach ([$fixture, $result] as $set) {
foreach ($set->searchHits as $hit) {
$property = new \ReflectionProperty(get_class($hit), 'index');
$hitClass = get_class($hit);
self::assertIsString($hitClass);

$property = new \ReflectionProperty($hitClass, 'index');
$property->setAccessible(true);
$property->setValue($hit, null);

$property = new \ReflectionProperty(get_class($hit), 'matchedTranslation');
$property = new \ReflectionProperty($hitClass, 'matchedTranslation');
$property->setAccessible(true);
$property->setValue($hit, null);
}
Expand All @@ -1432,13 +1439,20 @@ protected function assertQueryFixture(LocationQuery $query, $fixture, $closure =

/**
* Show a simplified view of the search result for manual introspection.
*
* @return string
*/
protected function printResult(SearchResult $result)
protected function printResult(SearchResult $result): string
{
$printed = '';
foreach ($result->searchHits as $hit) {
if (!isset($hit->valueObject['title'], $hit->valueObject['id'])) {
continue;
}

$printed .= sprintf(
"%s: %s\n",
$hit->valueObject['title'],
$hit->valueObject['description']
);
$printed .= sprintf(" - %s (%s)\n", $hit->valueObject['title'], $hit->valueObject['id']);
}

Expand Down
Loading
Loading