Skip to content

Commit d0d073c

Browse files
RuZnikiketangoyal1042Sakthi Shanmuga Sundaram MYashaswiPuthranNikolay Shapovalov
authored
Issue #3328996: phpcs fix (#97)
Co-authored-by: Sahil Goyal <[email protected]> Co-authored-by: Sakthi Shanmuga Sundaram M <[email protected]> Co-authored-by: YashaswiPuthran <[email protected]> Co-authored-by: Nikolay Shapovalov <[email protected]>
1 parent 4a12489 commit d0d073c

File tree

48 files changed

+222
-118
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+222
-118
lines changed

modules/search_api_solr_admin/search_api_solr_admin.module

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ function search_api_solr_admin_form_search_api_server_status_alter(&$form, FormS
4242
/**
4343
* Submit handler.
4444
*
45-
* @see search_api_solr_admin_form_search_api_server_status_alter()
46-
*
4745
* @param array $form
4846
* The form array.
4947
* @param \Drupal\Core\Form\FormStateInterface $form_state
5048
* The form state.
49+
*
50+
* @see search_api_solr_admin_form_search_api_server_status_alter()
5151
*/
52-
function search_api_solr_admin_form_search_api_server_status_submit_delete_collection(&$form, FormStateInterface $form_state) {
52+
function search_api_solr_admin_form_search_api_server_status_submit_delete_collection(array &$form, FormStateInterface $form_state) {
5353
// Redirect to the "delete collection" form.
5454
/** @var \Drupal\search_api\ServerInterface $server */
5555
$server = $form['#server'];

modules/search_api_solr_admin/src/Access/SolrAdminAccessCheck.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
namespace Drupal\search_api_solr_admin\Access;
44

5-
use Drupal\search_api_solr\SolrBackendInterface;
6-
use Drupal\search_api\ServerInterface;
75
use Drupal\Core\Access\AccessResult;
86
use Drupal\Core\Routing\Access\AccessInterface;
97
use Drupal\Core\Session\AccountInterface;
8+
use Drupal\search_api\ServerInterface;
9+
use Drupal\search_api_solr\SolrBackendInterface;
1010

1111
/**
1212
* Provides an access check for the "Solr Admin" routes.

modules/search_api_solr_admin/src/Access/SolrAdminCloudAccessCheck.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
namespace Drupal\search_api_solr_admin\Access;
44

5-
use Drupal\search_api_solr\SolrBackendInterface;
6-
use Drupal\search_api\ServerInterface;
75
use Drupal\Core\Access\AccessResult;
86
use Drupal\Core\Routing\Access\AccessInterface;
97
use Drupal\Core\Session\AccountInterface;
8+
use Drupal\search_api\ServerInterface;
9+
use Drupal\search_api_solr\SolrBackendInterface;
1010

1111
/**
1212
* Provides an access check for the "Solr Admin" routes for Solr Cloud.

modules/search_api_solr_admin/src/Access/SolrAdminTrustedContextSupportedAccessCheck.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
namespace Drupal\search_api_solr_admin\Access;
44

5-
use Drupal\search_api_solr\SolrBackendInterface;
6-
use Drupal\search_api\ServerInterface;
75
use Drupal\Core\Access\AccessResult;
86
use Drupal\Core\Routing\Access\AccessInterface;
97
use Drupal\Core\Session\AccountInterface;
8+
use Drupal\search_api\ServerInterface;
9+
use Drupal\search_api_solr\SolrBackendInterface;
1010

1111
/**
1212
* Provides an access check for the "Solr Admin" routes for Solr Cloud.

modules/search_api_solr_admin/src/Form/SolrAdminFormBase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
namespace Drupal\search_api_solr_admin\Form;
44

55
use Drupal\Core\Form\FormBase;
6-
use Drupal\search_api\LoggerTrait;
76
use Drupal\Core\Messenger\MessengerInterface;
7+
use Drupal\search_api\LoggerTrait;
88
use Drupal\search_api_solr_admin\Utility\SolrAdminCommandHelper;
99
use Symfony\Component\DependencyInjection\ContainerInterface;
1010

modules/search_api_solr_admin/src/Form/SolrFieldAnalysisForm.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public function buildForm(array $form, FormStateInterface $form_state, ServerInt
9292
$solr_fields[$solr_field_type->getFieldTypeName()] = $solr_field_type->label();
9393
}
9494

95-
$form['analysis_field'] = [
95+
$form['analysis_field'] = [
9696
'#type' => 'select',
9797
'#options' => $solr_fields,
9898
'#required' => TRUE,

modules/search_api_solr_admin/src/Utility/SolrAdminCommandHelper.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Drupal\search_api_solr_admin\Utility;
44

55
use Drupal\Core\Entity\EntityTypeManagerInterface;
6-
use Drupal\Core\Extension\ModuleExtensionList;
76
use Drupal\Core\Extension\ModuleHandlerInterface;
87
use Drupal\Core\File\FileSystemInterface;
98
use Drupal\Core\Messenger\MessengerInterface;
@@ -41,12 +40,12 @@ class SolrAdminCommandHelper extends SolrCommandHelper {
4140
* The module handler.
4241
* @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
4342
* The event dispatcher.
43+
* @param \Drupal\search_api_solr\Controller\SolrConfigSetController $configset_controller
44+
* The configset controller.
4445
* @param \Drupal\Core\File\FileSystemInterface $fileSystem
4546
* The file system.
4647
* @param \Drupal\Core\Messenger\MessengerInterface $messenger
4748
* The messenger.
48-
* @param \Drupal\search_api_solr\Controller\SolrConfigSetController $configset_controller
49-
* The configset controller.
5049
*
5150
* @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
5251
* Thrown if the "search_api_index" or "search_api_server" entity types'
@@ -105,6 +104,7 @@ public function deleteCollection(string $server_id): void {
105104
* @param string $server_id
106105
* The ID of the server.
107106
* @param array $collection_params
107+
* The collection of parameters.
108108
* @param bool $messages
109109
* Indicate if messages should be displayed, default is FALSE.
110110
*

modules/search_api_solr_legacy/tests/modules/search_api_solr_legacy_test/src/Plugin/SolrConnector/Solr36TestConnector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function setIntercept(bool $intercept) {
100100
/**
101101
* Adjust a config for test cases.
102102
*
103-
* @param $config_name
103+
* @param string $config_name
104104
* The name of the config.
105105
*
106106
* @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

modules/search_api_solr_legacy/tests/src/Kernel/SolrLegacyTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Drupal\Tests\search_api_solr_legacy\Kernel;
44

55
use Drupal\search_api_solr\Controller\SolrConfigSetController;
6-
use Drupal\search_api_solr\SolrBackendInterface;
76
use Drupal\search_api_solr_legacy_test\Plugin\SolrConnector\Solr36TestConnector;
87
use Drupal\Tests\search_api_solr\Kernel\SearchApiSolrTest;
98

@@ -54,7 +53,7 @@ protected function checkSchemaLanguages() {
5453
*/
5554
public function testConfigGeneration(array $files) {
5655
$server = $this->getServer();
57-
/** @var SolrBackendInterface $backend */
56+
/** @var \Drupal\search_api_solr\SolrBackendInterface $backend */
5857
$backend = $server->getBackend();
5958
$solr_major_version = $backend->getSolrConnector()->getSolrMajorVersion();
6059
$backend_config = $server->getBackendConfig();

phpcs.xml.dist

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ruleset name="search_api_solr">
3+
<description>PHP CodeSniffer configuration.</description>
4+
<file>.</file>
5+
<arg name="extensions" value="inc,install,module,php,profile,test,theme"/>
6+
7+
<!--Use Drupal code rule.-->
8+
<rule ref="vendor/drupal/coder/coder_sniffer/Drupal"></rule>
9+
10+
<!--Use DrupalPractice code rule.-->
11+
<rule ref="vendor/drupal/coder/coder_sniffer/DrupalPractice"></rule>
12+
13+
<rule ref="Drupal.NamingConventions.ValidFunctionName.ScopeNotCamelCaps">
14+
<exclude-pattern>src/Utility/StreamingExpressionBuilder.php</exclude-pattern>
15+
</rule>
16+
<rule ref="Drupal.NamingConventions.ValidVariableName.LowerCamelName">
17+
<exclude-pattern>src/Entity/SolrFieldType.php</exclude-pattern>
18+
<exclude-pattern>src/Entity/SolrRequestHandler.php</exclude-pattern>
19+
<exclude-pattern>src/Entity/SolrRequestDispatcher.php</exclude-pattern>
20+
</rule>
21+
22+
</ruleset>

search_api_solr.api.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
* @{
1111
*/
1212

13-
use Drupal\search_api_solr\SolrBackendInterface;
14-
use Drupal\search_api_solr\Solarium\Autocomplete\Query;
1513
use Drupal\search_api\IndexInterface;
1614
use Drupal\search_api\Query\QueryInterface;
1715
use Drupal\search_api\Query\ResultSetInterface;
16+
use Drupal\search_api_solr\Solarium\Autocomplete\Query;
17+
use Drupal\search_api_solr\SolrBackendInterface;
1818
use Solarium\Core\Query\QueryInterface as SolariumQueryInterface;
1919
use Solarium\QueryType\Select\Result\Result;
2020
use ZipStream\ZipStream;

search_api_solr.install

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ use Drupal\Core\Config\StorageInterface;
1414
use Drupal\Core\Language\LanguageInterface;
1515
use Drupal\Core\StringTranslation\TranslatableMarkup;
1616
use Drupal\Core\Url;
17+
use Drupal\search_api_solr\Controller\SolrConfigSetController;
1718
use Drupal\search_api_solr\SearchApiSolrConflictingEntitiesException;
1819
use Drupal\search_api_solr\SearchApiSolrException;
19-
use Solarium\Client;
20-
use Drupal\search_api_solr\Controller\SolrConfigSetController;
2120
use Drupal\search_api_solr\Utility\Utility as SearchApiSolrUtility;
21+
use Solarium\Client;
2222

2323
/**
2424
* Implements hook_requirements().
@@ -163,7 +163,7 @@ function search_api_solr_requirements($phase) {
163163
}
164164

165165
if ($indexes = $server->getIndexes()) {
166-
foreach ($indexes as $index_id => $index) {
166+
foreach ($indexes as $index) {
167167
$endpoint = $backend->getCollectionEndpoint($index);
168168
if ($connector->pingEndpoint($endpoint)) {
169169
if (!$configuration['suppress_missing_languages']) {
@@ -652,7 +652,9 @@ function search_api_solr_update_8202() {
652652
}
653653
}
654654

655-
// Removed search_api_solr_update_8203().
655+
/**
656+
* Removed search_api_solr_update_8203().
657+
*/
656658

657659
/**
658660
* Enable phrase suggestions support.
@@ -737,8 +739,13 @@ function search_api_solr_update_8208() {
737739
$config->save(TRUE);
738740
}
739741

740-
// Removed search_api_solr_update_8209().
741-
// Removed search_api_solr_update_8210().
742+
/**
743+
* Removed search_api_solr_update_8209().
744+
*/
745+
746+
/**
747+
* Removed search_api_solr_update_8210().
748+
*/
742749

743750
/**
744751
* Add default finalize timeout settings to existing configs.
@@ -1380,7 +1387,7 @@ function search_api_solr_update_8316() {
13801387
if (is_array($components)) {
13811388
foreach ($components as &$analyzers) {
13821389
if (is_array($analyzers)) {
1383-
foreach ($analyzers['filters'] as $key => &$filter) {
1390+
foreach ($analyzers['filters'] as &$filter) {
13841391
if ('solr.SnowballPorterFilterFactory' === $filter['class']) {
13851392
$filter['class'] = 'solr.MorfologikFilterFactory';
13861393
unset($filter['language']);
@@ -1423,7 +1430,7 @@ function search_api_solr_update_8318() {
14231430
if (is_array($components)) {
14241431
foreach ($components as &$analyzers) {
14251432
if (is_array($analyzers)) {
1426-
foreach ($analyzers['filters'] as $key => &$filter) {
1433+
foreach ($analyzers['filters'] as &$filter) {
14271434
if ('solr.MorphologikFilterFactory' === $filter['class']) {
14281435
$filter['class'] = 'solr.MorfologikFilterFactory';
14291436
$filter['dictionary'] = 'org/apache/lucene/analysis/uk/ukrainian.dict';
@@ -1453,7 +1460,7 @@ function search_api_solr_update_8319() {
14531460
if (is_array($components)) {
14541461
foreach ($components as &$analyzers) {
14551462
if (is_array($analyzers)) {
1456-
foreach ($analyzers['filters'] as $key => &$filter) {
1463+
foreach ($analyzers['filters'] as &$filter) {
14571464
if ('solr.RemoveDuplicatesTokenFilterFactor' === $filter['class']) {
14581465
$filter['class'] = 'solr.RemoveDuplicatesTokenFilterFactory';
14591466
$save = TRUE;
@@ -1660,7 +1667,7 @@ function search_api_solr_update_8322() {
16601667
if (is_array($components)) {
16611668
foreach ($components as &$analyzers) {
16621669
if (is_array($analyzers)) {
1663-
foreach ($analyzers['filters'] as $key => &$filter) {
1670+
foreach ($analyzers['filters'] as &$filter) {
16641671
if ('stopwords_tr.tx' === $filter['words']) {
16651672
$filter['words'] = 'stopwords_tr.txt';
16661673
$save = TRUE;
@@ -1727,7 +1734,7 @@ function search_api_solr_update_8325() {
17271734
if (is_array($components)) {
17281735
foreach ($components as &$analyzers) {
17291736
if (is_array($analyzers) && 'query' === $analyzers['type']) {
1730-
foreach ($analyzers['filters'] as $key => &$filter) {
1737+
foreach ($analyzers['filters'] as &$filter) {
17311738
if ('solr.WordDelimiterGraphFilterFactory' === $filter['class'] && 'protwords_de.txt' === $filter['protected']) {
17321739
$filter['protected'] = 'protwords_pl.txt';
17331740
$save = TRUE;
@@ -1779,7 +1786,7 @@ function search_api_solr_update_8326() {
17791786
* Update the Portuguese, Portugal config locale from 'pt' to 'pt-pt'.
17801787
*/
17811788
function search_api_solr_update_8327() {
1782-
foreach (search_api_solr_update_helper_get_field_type_configs() as $field_type_name => $field_type_config) {
1789+
foreach (search_api_solr_update_helper_get_field_type_configs() as $field_type_config) {
17831790
if (!empty($field_type_config['field_type'])) {
17841791
if ('pt' === $field_type_config['field_type_language_code']) {
17851792
$config_factory = \Drupal::configFactory();

search_api_solr.module

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
*/
77

88
use Drupal\Component\Serialization\Json;
9-
use Drupal\Core\Url;
109
use Drupal\Core\Entity\EntityInterface;
1110
use Drupal\Core\Form\FormStateInterface;
1211
use Drupal\Core\Messenger\MessengerInterface;
1312
use Drupal\Core\Routing\RouteMatchInterface;
13+
use Drupal\Core\Url;
1414
use Drupal\search_api\Entity\Server;
1515
use Drupal\search_api\IndexInterface;
1616
use Drupal\search_api\SearchApiException;
@@ -540,7 +540,11 @@ function search_api_solr_form_search_api_index_form_alter(&$form, FormStateInter
540540

541541
$form['third_party_settings']['search_api_solr']['mlt']['interestingTerms'] = [
542542
'#type' => 'select',
543-
'#options' => ['none' => 'none', 'list' => 'list', 'details' => 'details'],
543+
'#options' => [
544+
'none' => t('none'),
545+
'list' => t('list'),
546+
'details' => t('details'),
547+
],
544548
'#title' => t('interestingTerms'),
545549
'#description' => t('Controls how the MoreLikeThis component presents the "interesting" terms (the top TF/IDF terms) for the query. Supports three settings. The setting "list" lists the terms. The setting "none" lists no terms. The setting "details" lists the terms along with the boost value used for each term. Unless mlt.boost=true, all terms will have boost=1.0.'),
546550
'#default_value' => $settings['mlt']['interestingTerms'],

src/Controller/SolrCacheController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ public function disableOnServer(ServerInterface $search_api_server, SolrCacheInt
4141
*
4242
* @param \Drupal\search_api\ServerInterface $search_api_server
4343
* Search API server.
44-
* @param \Drupal\search_api_solr\SolrConfigInterface $solr_cache
45-
* Solr entity.
44+
* @param \Drupal\search_api_solr\SolrCacheInterface $solr_cache
45+
* Solr cache.
4646
*
4747
* @return \Symfony\Component\HttpFoundation\RedirectResponse
4848
* Redirect response.

src/Controller/SolrConfigSetController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
use Drupal\search_api_solr\Event\PostConfigSetTemplateMappingEvent;
1212
use Drupal\search_api_solr\SearchApiSolrConflictingEntitiesException;
1313
use Drupal\search_api_solr\SearchApiSolrException;
14-
use Drupal\search_api_solr\SolrBackendInterface;
1514
use Drupal\search_api_solr\Utility\Utility;
1615
use Drupal\search_api_solr\Utility\ZipStreamFactory;
1716
use Symfony\Component\DependencyInjection\ContainerInterface;
1817
use Symfony\Component\HttpFoundation\RedirectResponse;
1918
use Symfony\Component\HttpFoundation\Response;
19+
use ZipStream\Option\Archive;
2020
use ZipStream\ZipStream;
2121

2222
defined('SEARCH_API_SOLR_JUMP_START_CONFIG_SET') || define('SEARCH_API_SOLR_JUMP_START_CONFIG_SET', getenv('SEARCH_API_SOLR_JUMP_START_CONFIG_SET') ?: 0);
@@ -460,7 +460,7 @@ public function streamConfigZip(ServerInterface $search_api_server): Response {
460460
$archive_options = NULL;
461461
if (class_exists('\ZipStream\Option\Archive')) {
462462
// Version 2.x. Version 3.x uses named parameters instead of options.
463-
$archive_options = new \ZipStream\Option\Archive();
463+
$archive_options = new Archive();
464464
$archive_options->setSendHttpHeaders(TRUE);
465465
}
466466
@ob_clean();
@@ -500,7 +500,7 @@ public function streamCurrentConfigZip(ServerInterface $search_api_server): Resp
500500
$backend = $search_api_server->getBackend();
501501

502502
if (class_exists('\ZipStream\Option\Archive')) {
503-
$archive_options_or_ressource = new \ZipStream\Option\Archive();
503+
$archive_options_or_ressource = new Archive();
504504
$archive_options_or_ressource->setSendHttpHeaders(TRUE);
505505
}
506506
else {

src/Controller/SolrFieldTypeController.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Drupal\search_api\ServerInterface;
66
use Drupal\search_api_solr\SolrFieldTypeInterface;
77
use Symfony\Component\HttpFoundation\RedirectResponse;
8+
use ZipStream\Option\Archive;
89

910
/**
1011
* Provides different listings of SolrFieldType.
@@ -32,7 +33,7 @@ public function getConfigZip(ServerInterface $search_api_server) {
3233
$archive_options = NULL;
3334
if (class_exists('\ZipStream\Option\Archive')) {
3435
// Version 2.x. Version 3.x uses named parameters instead of options.
35-
$archive_options = new \ZipStream\Option\Archive();
36+
$archive_options = new Archive();
3637
$archive_options->setSendHttpHeaders(TRUE);
3738
}
3839
@ob_clean();
@@ -79,8 +80,8 @@ public function disableOnServer(ServerInterface $search_api_server, SolrFieldTyp
7980
*
8081
* @param \Drupal\search_api\ServerInterface $search_api_server
8182
* Search API server.
82-
* @param \Drupal\search_api_solr\SolrConfigInterface $solr_field_type
83-
* Solr entity.
83+
* @param \Drupal\search_api_solr\SolrFieldTypeInterface $solr_field_type
84+
* Solr field type.
8485
*
8586
* @return \Symfony\Component\HttpFoundation\RedirectResponse
8687
* Redirect response.

src/Controller/SolrRequestDispatcherController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ public function disableOnServer(ServerInterface $search_api_server, SolrRequestD
4141
*
4242
* @param \Drupal\search_api\ServerInterface $search_api_server
4343
* Search API server.
44-
* @param \Drupal\search_api_solr\SolrConfigInterface $solr_request_dispatcher
45-
* Solr entity.
44+
* @param \Drupal\search_api_solr\SolrRequestDispatcherInterface $solr_request_dispatcher
45+
* Solr request.
4646
*
4747
* @return \Symfony\Component\HttpFoundation\RedirectResponse
4848
* Redirect response.

src/Controller/SolrRequestHandlerController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ public function disableOnServer(ServerInterface $search_api_server, SolrRequestH
4141
*
4242
* @param \Drupal\search_api\ServerInterface $search_api_server
4343
* Search API server.
44-
* @param \Drupal\search_api_solr\SolrConfigInterface $solr_request_handler
45-
* Solr entity.
44+
* @param \Drupal\search_api_solr\SolrRequestHandlerInterface $solr_request_handler
45+
* Solr request.
4646
*
4747
* @return \Symfony\Component\HttpFoundation\RedirectResponse
4848
* Redirect response.

0 commit comments

Comments
 (0)