Skip to content

Commit

Permalink
Fixed issues reported by phpstan
Browse files Browse the repository at this point in the history
  • Loading branch information
adamwojs committed Oct 2, 2023
1 parent 5e57fb2 commit d9a5eaa
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/bundle/ApiLoader/BoostFactorProviderFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
namespace Ibexa\Bundle\Solr\ApiLoader;

use Ibexa\Bundle\Core\ApiLoader\RepositoryConfigurationProvider;
use Ibexa\Solr\FieldMapper\BoostFactorProvider;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;

Expand Down Expand Up @@ -48,6 +49,10 @@ public function __construct(

public function buildService()
{
if ($this->container === null) {
return new BoostFactorProvider();
}

$repositoryConfig = $this->repositoryConfigurationProvider->getRepositoryConfig();

$connection = $this->defaultConnection;
Expand Down
5 changes: 5 additions & 0 deletions src/bundle/ApiLoader/IndexingDepthProviderFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
namespace Ibexa\Bundle\Solr\ApiLoader;

use Ibexa\Bundle\Core\ApiLoader\RepositoryConfigurationProvider;
use Ibexa\Solr\FieldMapper\IndexingDepthProvider;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;

Expand Down Expand Up @@ -43,6 +44,10 @@ public function __construct(

public function buildService()
{
if ($this->container === null) {
return new IndexingDepthProvider();
}

$repositoryConfig = $this->repositoryConfigurationProvider->getRepositoryConfig();

$connection = $this->defaultConnection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function visit(Criterion $criterion, CriterionVisitor $subVisitor = null)

foreach ($criterion->value as $identifier) {
try {
$validIds[] = $contentTypeHandler->loadByIdentifier($identifier)->id;
$validIds[] = $contentTypeHandler->loadByIdentifier((string) $identifier)->id;
} catch (NotFoundException $e) {
// Filter out non-existing content types, but track for code below
$invalidIdentifiers[] = $identifier;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Query/Content/CriterionVisitor/Ancestor.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function visit(Criterion $criterion, CriterionVisitor $subVisitor = null)
{
$idSet = [];
foreach ($criterion->value as $value) {
foreach (explode('/', trim($value, '/')) as $id) {
foreach (explode('/', trim((string)$value, '/')) as $id) {
$idSet[$id] = true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Query/Location/CriterionVisitor/Ancestor.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function visit(Criterion $criterion, CriterionVisitor $subVisitor = null)
{
$idSet = [];
foreach ($criterion->value as $value) {
foreach (explode('/', trim($value, '/')) as $id) {
foreach (explode('/', trim((string)$value, '/')) as $id) {
$idSet[$id] = true;
}
}
Expand Down

0 comments on commit d9a5eaa

Please sign in to comment.