Skip to content
Open
Show file tree
Hide file tree
Changes from 4 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
6 changes: 0 additions & 6 deletions phpstan-baseline-lte-8.3.neon
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
parameters:
ignoreErrors:
-
message: '#^Call to new Ibexa\\Core\\Repository\\URLAliasService\(\) on a separate line has no effect\.$#'
identifier: new.resultUnused
count: 1
path: tests/lib/Repository/Service/Mock/UrlAliasTest.php

-
message: '#^Dead catch \- Ibexa\\Contracts\\Core\\Repository\\Exceptions\\NotFoundException is never thrown in the try block\.$#'
identifier: catch.neverThrown
Expand Down
2 changes: 1 addition & 1 deletion phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -31239,7 +31239,7 @@ parameters:
-
message: '#^Offset ''scheme'' might not exist on array\{scheme\?\: string, host\: string, port\: int\<0, 65535\>, user\?\: string, pass\?\: string, path\?\: string, query\?\: string, fragment\?\: string\}\.$#'
identifier: offsetAccess.notFound
count: 4
count: 2
path: tests/bundle/Core/Routing/DefaultRouterTest.php

-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Generator;
use Ibexa\Bundle\Core\Command\Indexer\ContentIdListGeneratorStrategyInterface;
use Ibexa\Contracts\Core\Repository\ContentService;
use Ibexa\Contracts\Core\Repository\Repository;
use Ibexa\Contracts\Core\Repository\Values\Content\ContentList;
use Ibexa\Contracts\Core\Repository\Values\Content\Query;
use Ibexa\Contracts\Core\Repository\Values\Filter\Filter;
Expand All @@ -24,9 +25,12 @@
{
private ContentService $contentService;

public function __construct(ContentService $contentService)
private Repository $repository;

public function __construct(ContentService $contentService, Repository $repository)
{
$this->contentService = $contentService;
$this->repository = $repository;
}

/**
Expand Down Expand Up @@ -74,6 +78,11 @@
)
;

return $this->contentService->find($filter);
/** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentList $contentList */
$contentList = $this->repository->sudo(function () use ($filter) {

Check warning on line 82 in src/bundle/Core/Command/Indexer/ContentIdList/ContentTypeInputGeneratorStrategy.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Immediately return this expression instead of assigning it to the temporary variable "$contentList".

See more on https://sonarcloud.io/project/issues?id=ibexa_core&issues=AZ6Xoz1-f6rVfIBwb6Kf&open=AZ6Xoz1-f6rVfIBwb6Kf&pullRequest=760
Comment thread
vidarl marked this conversation as resolved.
Outdated
return $this->contentService->find($filter);
});

return $contentList;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

use Ibexa\Bundle\Core\Command\Indexer\ContentIdList\ContentTypeInputGeneratorStrategy;
use Ibexa\Contracts\Core\Repository\ContentService;
use Ibexa\Contracts\Core\Repository\Repository;
use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo;
use Ibexa\Contracts\Core\Repository\Values\Content\ContentList;
use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo;
Expand All @@ -32,10 +33,20 @@ public function testGetGenerator(ContentList $contentList, int $batchSize, array
$contentServiceMock = $this->createMock(ContentService::class);
$contentServiceMock->method('find')->willReturn($contentList);

$repositoryMock = $this->createMock(Repository::class);
$repositoryMock
->method('sudo')
->willReturnCallback(
static fn (callable $callback) => $callback()
);

$inputMock = $this->createMock(InputInterface::class);
$inputMock->method('getOption')->with('content-type')->willReturn(uniqid('type', true));

$strategy = new ContentTypeInputGeneratorStrategy($contentServiceMock);
$strategy = new ContentTypeInputGeneratorStrategy(
$contentServiceMock,
$repositoryMock
);

self::assertSame(
$expectedBatches,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ public function getTypeName()
*/
protected function supportsLikeWildcard($value)
{
parent::supportsLikeWildcard($value);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In 7129d21, parent::supportsLikeWildcard() read:

    protected function supportsLikeWildcard($value)
    {
        if ($this->getSetupFactory() instanceof LegacyElasticsearch) {
            $this->markTestSkipped('Elasticsearch Search Engine does not support Field Criterion LIKE');
        }

        return !is_numeric($value) && !is_bool($value);
    }

However, now it only returns the return. Thus it should be safe to remove the call to parent::supportsLikeWildcard()


return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ public function getTypeName()
*/
protected function supportsLikeWildcard($value)
{
parent::supportsLikeWildcard($value);

return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ public function getTypeName()
*/
protected function supportsLikeWildcard($value)
{
parent::supportsLikeWildcard($value);

return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ public function getTypeName()
*/
protected function supportsLikeWildcard($value)
{
parent::supportsLikeWildcard($value);

return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ public function getTypeName()
*/
protected function supportsLikeWildcard($value)
{
parent::supportsLikeWildcard($value);

return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ public function getTypeName()
*/
protected function supportsLikeWildcard($value)
{
parent::supportsLikeWildcard($value);

return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public function testNormalization(): void
$matcher = new HostElement(2);
// Set request and invoke match to initialize HostElement::$hostElements
$matcher->setRequest(SimplifiedRequest::fromUrl('http://ibexa.dev/foo/bar'));
// @phpstan-ignore method.resultUnused
$matcher->match();

$this->assertEquals(
Expand Down
1 change: 1 addition & 0 deletions tests/lib/Repository/Service/Mock/ContentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public function testConstructor(): void
'remove_archived_versions_on_publish' => true,
];

// @phpstan-ignore new.resultUnused
new ContentService(
$repositoryMock,
$persistenceHandlerMock,
Expand Down
1 change: 1 addition & 0 deletions tests/lib/Repository/Service/Mock/UrlAliasTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public function testConstructor()
{
$repositoryMock = $this->getRepositoryMock();

// @phpstan-ignore new.resultUnused
new UrlALiasService(
$repositoryMock,
$this->urlAliasHandler,
Expand Down
Loading