Skip to content

Commit

Permalink
IBX-5827: Replaced deprecated string interpolation (PHP 8.2+) (#246)
Browse files Browse the repository at this point in the history
* IBX-5827: Replaced deprecated string interpolation (PHP 8.2+)

* fix: Escaped variable interpolation
  • Loading branch information
Nattfarinn authored Dec 7, 2023
1 parent 1005e02 commit 8edb630
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions lib/Container/Compiler/AggregateFacetBuilderVisitorPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ public function process(ContainerBuilder $container)

private function processVisitors(ContainerBuilder $container, $name = 'content')
{
if (!$container->hasDefinition("ezpublish.search.solr.query.${name}.facet_builder_visitor.aggregate")) {
if (!$container->hasDefinition("ezpublish.search.solr.query.{$name}.facet_builder_visitor.aggregate")) {
return;
}

$aggregateFacetBuilderVisitorDefinition = $container->getDefinition(
"ezpublish.search.solr.query.${name}.facet_builder_visitor.aggregate"
"ezpublish.search.solr.query.{$name}.facet_builder_visitor.aggregate"
);

foreach ($container->findTaggedServiceIds("ezpublish.search.solr.query.${name}.facet_builder_visitor") as $id => $attributes) {
foreach ($container->findTaggedServiceIds("ezpublish.search.solr.query.{$name}.facet_builder_visitor") as $id => $attributes) {
$aggregateFacetBuilderVisitorDefinition->addMethodCall(
'addVisitor',
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function visit(
$from = $this->formatRangeValue($range->getFrom());
$to = $this->formatRangeValue($range->getTo());

$rangeFacets["${from}_${to}"] = [
$rangeFacets["{$from}_{$to}"] = [
'type' => 'query',
'q' => sprintf('%s:[%s TO %s}', $field, $from, $to),
];
Expand Down
2 changes: 1 addition & 1 deletion lib/Query/Common/FacetBuilderVisitor/ContentType.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function canVisit(FacetBuilder $facetBuilder)
public function visitBuilder(FacetBuilder $facetBuilder, $fieldId)
{
return [
'facet.field' => "{!ex=dt key=${fieldId}}content_type_id_id",
'facet.field' => "{!ex=dt key={$fieldId}}content_type_id_id",
'f.content_type_id_id.facet.limit' => $facetBuilder->limit,
'f.content_type_id_id.facet.mincount' => $facetBuilder->minCount,
];
Expand Down
2 changes: 1 addition & 1 deletion lib/Query/Common/FacetBuilderVisitor/Section.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function canVisit(FacetBuilder $facetBuilder)
public function visitBuilder(FacetBuilder $facetBuilder, $fieldId)
{
return [
'facet.field' => "{!ex=dt key=${fieldId}}content_section_id_id",
'facet.field' => "{!ex=dt key={$fieldId}}content_section_id_id",
'f.content_section_id_id.facet.limit' => $facetBuilder->limit,
'f.content_section_id_id.facet.mincount' => $facetBuilder->minCount,
];
Expand Down
6 changes: 3 additions & 3 deletions lib/Query/Common/FacetBuilderVisitor/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ public function visitBuilder(FacetBuilder $facetBuilder, $fieldId)
$field = self::DOC_FIELD_MAP[$facetBuilder->type];

return [
'facet.field' => "{!ex=dt key=${fieldId}}$field",
"f.${field}.facet.limit" => $facetBuilder->limit,
"f.${field}.facet.mincount" => $facetBuilder->minCount,
'facet.field' => "{!ex=dt key={$fieldId}}$field",
"f.{$field}.facet.limit" => $facetBuilder->limit,
"f.{$field}.facet.mincount" => $facetBuilder->minCount,
];
}
}
2 changes: 1 addition & 1 deletion lib/Query/FacetFieldVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function mapField($field, array $data, FacetBuilder $facetBuilder);
*
* Example:
* return array(
* 'facet.field' => "{!ex=dt key=${fieldId}}content_type_id_id",
* 'facet.field' => "{!ex=dt key={$fieldId}}content_type_id_id",
* 'f.content_type_id_id.facet.limit' => $facetBuilder->limit,
* 'f.content_type_id_id.facet.mincount' => $facetBuilder->minCount,
* );
Expand Down
4 changes: 2 additions & 2 deletions lib/ResultExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ protected function extractFacets(stdClass $data, array $facetBuilders, array $la
@trigger_error(
'Not setting id of field using FacetFieldVisitor::visitBuilder will not be supported in 4.0'
. ', as it makes it impossible to exactly identify which facets belongs to which builder.'
. "\nMake sure to adapt your visitor for the following field: ${field}"
. "\nExample: 'facet.field' => \"{!ex=dt key=\${id}}${field}\",",
. "\nMake sure to adapt your visitor for the following field: {$field}"
. "\nExample: 'facet.field' => \"{!ex=dt key={\$id}}{$field}\",",
E_USER_DEPRECATED);
}

Expand Down

0 comments on commit 8edb630

Please sign in to comment.