Issue #3041985 by alexpott, pifagor: Add Generic.CodeAnalysis.EmptyPHPStatement to phpcs rules to prevent empty PHP statements
parent
fe33718231
commit
f2eaf0178c
|
@ -837,7 +837,7 @@ function batch_process($redirect = NULL, Url $url = NULL, $redirect_callback = N
|
|||
|
||||
// Assign an arbitrary id: don't rely on a serial column in the 'batch'
|
||||
// table, since non-progressive batches skip database storage completely.
|
||||
$batch['id'] = \Drupal::database()->nextId();;
|
||||
$batch['id'] = \Drupal::database()->nextId();
|
||||
|
||||
// Move operations to a job queue. Non-progressive batches will use a
|
||||
// memory-based queue.
|
||||
|
|
|
@ -76,7 +76,7 @@ class DeletedFieldsRepository implements DeletedFieldsRepositoryInterface {
|
|||
* {@inheritdoc}
|
||||
*/
|
||||
public function removeFieldDefinition(FieldDefinitionInterface $field_definition) {
|
||||
$deleted_field_definitions = $this->state->get('field.field.deleted', []);;
|
||||
$deleted_field_definitions = $this->state->get('field.field.deleted', []);
|
||||
unset($deleted_field_definitions[$field_definition->getUniqueIdentifier()]);
|
||||
$this->state->set('field.field.deleted', $deleted_field_definitions);
|
||||
|
||||
|
|
|
@ -49,7 +49,6 @@ class AggregatorLocalTasksTest extends LocalTaskIntegrationTestBase {
|
|||
$this->assertLocalTasks($route, [
|
||||
0 => ['entity.aggregator_feed.canonical', 'entity.aggregator_feed.edit_form', 'entity.aggregator_feed.delete_form'],
|
||||
]);
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -55,7 +55,7 @@ class CommentFieldsTest extends CommentTestBase {
|
|||
|
||||
// Test adding a field that defaults to CommentItemInterface::CLOSED.
|
||||
$this->addDefaultCommentField('node', 'test_node_type', 'who_likes_ponies', CommentItemInterface::CLOSED, 'who_likes_ponies');
|
||||
$field = FieldConfig::load('node.test_node_type.who_likes_ponies');;
|
||||
$field = FieldConfig::load('node.test_node_type.who_likes_ponies');
|
||||
$this->assertEqual($field->getDefaultValueLiteral()[0]['status'], CommentItemInterface::CLOSED);
|
||||
}
|
||||
|
||||
|
|
|
@ -556,7 +556,7 @@ class ContactSitewideTest extends BrowserTestBase {
|
|||
* Deletes all forms.
|
||||
*/
|
||||
public function deleteContactForms() {
|
||||
$contact_forms = ContactForm::loadMultiple();;
|
||||
$contact_forms = ContactForm::loadMultiple();
|
||||
foreach ($contact_forms as $id => $contact_form) {
|
||||
if ($id == 'personal') {
|
||||
// Personal form could not be deleted.
|
||||
|
|
|
@ -56,7 +56,7 @@ class ModerationStateNodeTest extends ModerationStateTestBase {
|
|||
|
||||
// Disable content moderation.
|
||||
$edit['bundles[moderated_content]'] = FALSE;
|
||||
$this->drupalPostForm('admin/config/workflow/workflows/manage/editorial/type/node', $edit, t('Save'));;
|
||||
$this->drupalPostForm('admin/config/workflow/workflows/manage/editorial/type/node', $edit, t('Save'));
|
||||
// Ensure the parent environment is up-to-date.
|
||||
// @see content_moderation_workflow_insert()
|
||||
\Drupal::service('entity_type.bundle.info')->clearCachedBundles();
|
||||
|
|
|
@ -34,7 +34,7 @@ class ImageUrlFormatter extends ImageFormatter {
|
|||
public function settingsForm(array $form, FormStateInterface $form_state) {
|
||||
$element = parent::settingsForm($form, $form_state);
|
||||
|
||||
unset($element['image_link']);;
|
||||
unset($element['image_link']);
|
||||
|
||||
return $element;
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ abstract class ConfigurableLanguageResourceTestBase extends EntityResourceTestBa
|
|||
*/
|
||||
public function testGetDefaultConfig() {
|
||||
$this->initAuthentication();
|
||||
$url = Url::fromUri('base:/entity/configurable_language/en')->setOption('query', ['_format' => static::$format]);;
|
||||
$url = Url::fromUri('base:/entity/configurable_language/en')->setOption('query', ['_format' => static::$format]);
|
||||
$request_options = $this->getAuthenticationRequestOptions('GET');
|
||||
$this->provisionEntityResource();
|
||||
$this->setUpAuthorization('GET');
|
||||
|
|
|
@ -117,7 +117,7 @@ class BlockFilterTest extends WebDriverTestBase {
|
|||
});
|
||||
|
||||
// Test Drupal.announce() message when all blocks are listed.
|
||||
$filter->setValue('');;
|
||||
$filter->setValue('');
|
||||
$this->assertAnnounceContains('All available blocks are listed.');
|
||||
// Confirm the Content Fields category remains collapsed after filtering.
|
||||
$this->assertFalse($promoteToFrontPageLink->isVisible());
|
||||
|
|
|
@ -1141,13 +1141,13 @@ abstract class EntityResourceTestBase extends ResourceTestBase {
|
|||
$this->assertResourceErrorResponse(403, "Access denied on updating field 'field_rest_test'.", $response);
|
||||
|
||||
// DX: 403 when entity trying to update an entity's ID field.
|
||||
$request_options[RequestOptions::BODY] = $this->serializer->encode($this->makeNormalizationInvalid($this->getNormalizedPatchEntity(), 'id'), static::$format);;
|
||||
$request_options[RequestOptions::BODY] = $this->serializer->encode($this->makeNormalizationInvalid($this->getNormalizedPatchEntity(), 'id'), static::$format);
|
||||
$response = $this->request('PATCH', $url, $request_options);
|
||||
$this->assertResourceErrorResponse(403, "Access denied on updating field '{$this->entity->getEntityType()->getKey('id')}'. The entity ID cannot be changed.", $response);
|
||||
|
||||
if ($this->entity->getEntityType()->hasKey('uuid')) {
|
||||
// DX: 403 when entity trying to update an entity's UUID field.
|
||||
$request_options[RequestOptions::BODY] = $this->serializer->encode($this->makeNormalizationInvalid($this->getNormalizedPatchEntity(), 'uuid'), static::$format);;
|
||||
$request_options[RequestOptions::BODY] = $this->serializer->encode($this->makeNormalizationInvalid($this->getNormalizedPatchEntity(), 'uuid'), static::$format);
|
||||
$response = $this->request('PATCH', $url, $request_options);
|
||||
$this->assertResourceErrorResponse(403, "Access denied on updating field '{$this->entity->getEntityType()->getKey('uuid')}'. The entity UUID cannot be changed.", $response);
|
||||
}
|
||||
|
|
|
@ -372,7 +372,7 @@ abstract class TermResourceTestBase extends EntityResourceTestBase {
|
|||
protected function getExpectedUnauthorizedEntityAccessCacheability($is_authenticated) {
|
||||
// @see \Drupal\taxonomy\TermAccessControlHandler::checkAccess()
|
||||
return parent::getExpectedUnauthorizedEntityAccessCacheability($is_authenticated)
|
||||
->addCacheTags(['taxonomy_term:1']);;
|
||||
->addCacheTags(['taxonomy_term:1']);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -47,7 +47,6 @@ class UpdateLocalTasksTest extends LocalTaskIntegrationTestBase {
|
|||
$this->assertLocalTasks($route, [
|
||||
0 => ['update.module_update'],
|
||||
]);
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -68,7 +67,6 @@ class UpdateLocalTasksTest extends LocalTaskIntegrationTestBase {
|
|||
$this->assertLocalTasks($route, [
|
||||
0 => ['update.theme_update'],
|
||||
]);
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -148,6 +148,7 @@
|
|||
|
||||
<!-- Generic sniffs -->
|
||||
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
|
||||
<rule ref="Generic.CodeAnalysis.EmptyPHPStatement" />
|
||||
<rule ref="Generic.Files.ByteOrderMark"/>
|
||||
<rule ref="Generic.Files.LineEndings"/>
|
||||
<rule ref="Generic.Formatting.SpaceAfterCast"/>
|
||||
|
|
|
@ -737,7 +737,7 @@ class InstallHelper implements ContainerInjectionInterface {
|
|||
*/
|
||||
protected function getUser($name) {
|
||||
$user_storage = $this->entityTypeManager->getStorage('user');
|
||||
$users = $user_storage->loadByProperties(['name' => $name]);;
|
||||
$users = $user_storage->loadByProperties(['name' => $name]);
|
||||
if (empty($users)) {
|
||||
// Creating user without any password.
|
||||
$user = $user_storage->create([
|
||||
|
|
|
@ -117,7 +117,7 @@ class ConfigDependencyTest extends EntityKernelTestBase {
|
|||
'type' => 'entity_test',
|
||||
]);
|
||||
$entity_test->save();
|
||||
$entity2->setEnforcedDependencies(['config' => [$entity1->getConfigDependencyName()], 'content' => [$entity_test->getConfigDependencyName()]])->save();;
|
||||
$entity2->setEnforcedDependencies(['config' => [$entity1->getConfigDependencyName()], 'content' => [$entity_test->getConfigDependencyName()]])->save();
|
||||
$dependents = $config_manager->findConfigEntityDependents('content', [$entity_test->getConfigDependencyName()]);
|
||||
$this->assertFalse(isset($dependents['config_test.dynamic.entity1']), 'config_test.dynamic.entity1 does not have a dependency on the content entity.');
|
||||
$this->assertTrue(isset($dependents['config_test.dynamic.entity2']), 'config_test.dynamic.entity2 has a dependency on the content entity.');
|
||||
|
@ -175,7 +175,7 @@ class ConfigDependencyTest extends EntityKernelTestBase {
|
|||
|
||||
// Add a fake missing dependency to ensure multiple missing dependencies
|
||||
// work.
|
||||
$entity1->setEnforcedDependencies(['content' => [$entity_test->getConfigDependencyName(), 'entity_test:bundle:uuid']])->save();;
|
||||
$entity1->setEnforcedDependencies(['content' => [$entity_test->getConfigDependencyName(), 'entity_test:bundle:uuid']])->save();
|
||||
$expected['uuid'] = [
|
||||
'entity_type' => 'entity_test',
|
||||
'bundle' => 'bundle',
|
||||
|
|
|
@ -39,7 +39,7 @@ class StreamWrapperTest extends FileTestBase {
|
|||
parent::setUp();
|
||||
|
||||
// Add file_private_path setting.
|
||||
$request = Request::create('/');;
|
||||
$request = Request::create('/');
|
||||
$site_path = DrupalKernel::findSitePath($request);
|
||||
$this->setSetting('file_private_path', $site_path . '/private');
|
||||
}
|
||||
|
|
|
@ -170,7 +170,7 @@ class FieldDefinitionTest extends UnitTestCase {
|
|||
*/
|
||||
public function testDefaultFieldSettings($factory_name) {
|
||||
$definition = $this->initializeFieldUsingFactory($factory_name);
|
||||
$expected_settings = $this->fieldTypeDefinition['field_settings'] + $this->fieldTypeDefinition['storage_settings'];;
|
||||
$expected_settings = $this->fieldTypeDefinition['field_settings'] + $this->fieldTypeDefinition['storage_settings'];
|
||||
$this->assertEquals($expected_settings, $definition->getSettings());
|
||||
foreach ($expected_settings as $setting => $value) {
|
||||
$this->assertEquals($value, $definition->getSetting($setting));
|
||||
|
|
|
@ -218,7 +218,7 @@ class DefaultHtmlRouteProviderTest extends UnitTestCase {
|
|||
$entity_type1->hasLinkTemplate('canonical')->willReturn(FALSE);
|
||||
$data['no_canonical_link_template'] = [NULL, $entity_type1->reveal()];
|
||||
|
||||
$entity_type2 = $this->getEntityType();;
|
||||
$entity_type2 = $this->getEntityType();
|
||||
$entity_type2->hasLinkTemplate('canonical')->willReturn(TRUE);
|
||||
$entity_type2->hasViewBuilderClass()->willReturn(FALSE);
|
||||
$data['no_view_builder'] = [NULL, $entity_type2->reveal()];
|
||||
|
|
|
@ -1477,7 +1477,7 @@ class FormStateDecoratorBaseTest extends UnitTestCase {
|
|||
$form = $this->getMock(FormInterface::class);
|
||||
|
||||
$this->decoratedFormState->setFormObject($form)
|
||||
->shouldBeCalled();;
|
||||
->shouldBeCalled();
|
||||
|
||||
$this->assertSame($this->formStateDecoratorBase, $this->formStateDecoratorBase->setFormObject($form));
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
namespace Drupal\Tests\Listeners;
|
||||
|
||||
use Drupal\KernelTests\KernelTestBase;;
|
||||
use Drupal\Tests\BrowserTestBase;;
|
||||
use Drupal\KernelTests\KernelTestBase;
|
||||
use Drupal\Tests\BrowserTestBase;
|
||||
use Drupal\Tests\UnitTestCase;
|
||||
use PHPUnit\Framework\AssertionFailedError;
|
||||
|
||||
|
|
Loading…
Reference in New Issue