From 8edb63067ebc8fe27eb6b139d6965759bab46e16 Mon Sep 17 00:00:00 2001 From: Slawomir Dolzycki-Uchto Date: Thu, 7 Dec 2023 13:24:00 +0100 Subject: [PATCH] IBX-5827: Replaced deprecated string interpolation (PHP 8.2+) (#246) * IBX-5827: Replaced deprecated string interpolation (PHP 8.2+) * fix: Escaped variable interpolation --- lib/Container/Compiler/AggregateFacetBuilderVisitorPass.php | 6 +++--- .../AggregationVisitor/AbstractRangeAggregationVisitor.php | 2 +- lib/Query/Common/FacetBuilderVisitor/ContentType.php | 2 +- lib/Query/Common/FacetBuilderVisitor/Section.php | 2 +- lib/Query/Common/FacetBuilderVisitor/User.php | 6 +++--- lib/Query/FacetFieldVisitor.php | 2 +- lib/ResultExtractor.php | 4 ++-- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/Container/Compiler/AggregateFacetBuilderVisitorPass.php b/lib/Container/Compiler/AggregateFacetBuilderVisitorPass.php index 1798fbb7..77fef202 100644 --- a/lib/Container/Compiler/AggregateFacetBuilderVisitorPass.php +++ b/lib/Container/Compiler/AggregateFacetBuilderVisitorPass.php @@ -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', [ diff --git a/lib/Query/Common/AggregationVisitor/AbstractRangeAggregationVisitor.php b/lib/Query/Common/AggregationVisitor/AbstractRangeAggregationVisitor.php index b84ab97d..143fb93b 100644 --- a/lib/Query/Common/AggregationVisitor/AbstractRangeAggregationVisitor.php +++ b/lib/Query/Common/AggregationVisitor/AbstractRangeAggregationVisitor.php @@ -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), ]; diff --git a/lib/Query/Common/FacetBuilderVisitor/ContentType.php b/lib/Query/Common/FacetBuilderVisitor/ContentType.php index bffaf6fc..3c2eb2ba 100644 --- a/lib/Query/Common/FacetBuilderVisitor/ContentType.php +++ b/lib/Query/Common/FacetBuilderVisitor/ContentType.php @@ -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, ]; diff --git a/lib/Query/Common/FacetBuilderVisitor/Section.php b/lib/Query/Common/FacetBuilderVisitor/Section.php index 82bd1ba4..9779e253 100644 --- a/lib/Query/Common/FacetBuilderVisitor/Section.php +++ b/lib/Query/Common/FacetBuilderVisitor/Section.php @@ -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, ]; diff --git a/lib/Query/Common/FacetBuilderVisitor/User.php b/lib/Query/Common/FacetBuilderVisitor/User.php index e95b5dbb..6a8170f2 100644 --- a/lib/Query/Common/FacetBuilderVisitor/User.php +++ b/lib/Query/Common/FacetBuilderVisitor/User.php @@ -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, ]; } } diff --git a/lib/Query/FacetFieldVisitor.php b/lib/Query/FacetFieldVisitor.php index b14c895c..2e5a94fa 100644 --- a/lib/Query/FacetFieldVisitor.php +++ b/lib/Query/FacetFieldVisitor.php @@ -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, * ); diff --git a/lib/ResultExtractor.php b/lib/ResultExtractor.php index 3cc4ebc4..6dd5bbcb 100644 --- a/lib/ResultExtractor.php +++ b/lib/ResultExtractor.php @@ -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); }