Skip to content
Snippets Groups Projects
Commit cddc5b93 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3471818 by alexpott: Fix PHPCS, PHPStan and tests on Drupal 10.3

parent 042d4807
No related branches found
No related tags found
1 merge request!52Fix PHPCS
Pipeline #273474 failed
Showing
with 66 additions and 6 deletions
......@@ -24,6 +24,7 @@ variables:
SKIP_ESLINT: '1'
SKIP_STYLELINT: '1'
OPT_IN_TEST_PREVIOUS_MAJOR: '1'
OPT_IN_TEST_NEXT_MAJOR: '0'
# Have to override this because the module minimum is higher.
CORE_PREVIOUS_PHP_MIN: '8.1'
......
parameters:
ignoreErrors:
-
message: """
#^Call to deprecated method renderPlain\\(\\) of interface Drupal\\\\Core\\\\Render\\\\RendererInterface\\:
in drupal\\:10\\.3\\.0 and is removed from drupal\\:12\\.0\\.0\\. Use
\\\\Drupal\\\\Core\\\\Render\\\\RendererInterface\\:\\:renderInIsolation\\(\\) instead\\.$#
"""
count: 1
path: src/Controller/MessageTextView.php
-
message: """
#^Call to deprecated method renderPlain\\(\\) of interface Drupal\\\\Core\\\\Render\\\\RendererInterface\\:
in drupal\\:10\\.3\\.0 and is removed from drupal\\:12\\.0\\.0\\. Use
\\\\Drupal\\\\Core\\\\Render\\\\RendererInterface\\:\\:renderInIsolation\\(\\) instead\\.$#
"""
count: 1
path: src/EntityInfo.php
-
message: "#^\\\\Drupal calls should be avoided in classes, use dependency injection instead$#"
count: 1
path: src/EntityQueuer.php
-
message: """
#^Call to deprecated method renderPlain\\(\\) of interface Drupal\\\\Core\\\\Render\\\\RendererInterface\\:
in drupal\\:10\\.3\\.0 and is removed from drupal\\:12\\.0\\.0\\. Use
\\\\Drupal\\\\Core\\\\Render\\\\RendererInterface\\:\\:renderInIsolation\\(\\) instead\\.$#
"""
count: 1
path: src/MessageGenerator.php
-
message: """
#^Call to deprecated method renderPlain\\(\\) of interface Drupal\\\\Core\\\\Render\\\\RendererInterface\\:
in drupal\\:10\\.3\\.0 and is removed from drupal\\:12\\.0\\.0\\. Use
\\\\Drupal\\\\Core\\\\Render\\\\RendererInterface\\:\\:renderInIsolation\\(\\) instead\\.$#
"""
count: 1
path: src/Plugin/GraphQL/DataProducer/VgWort.php
-
message: """
#^Usage of deprecated trait Drupal\\\\Tests\\\\field\\\\Traits\\\\EntityReferenceTestTrait in class Drupal\\\\Tests\\\\vgwort\\\\Functional\\\\VGWortTest\\:
......
......@@ -57,7 +57,7 @@ class NewMessage implements \JsonSerializable {
private readonly bool $reproductionRight = FALSE,
private readonly bool $rightsGrantedConfirmation = FALSE,
private readonly bool $otherRightsOfPublicReproduction = FALSE,
private readonly bool $withoutOwnParticipation = FALSE
private readonly bool $withoutOwnParticipation = FALSE,
) {
assert(Inspector::assertAllObjects($participants, Participant::class));
assert(Inspector::assertAllObjects($webranges, Webrange::class));
......
......@@ -20,7 +20,7 @@ class EntityInfo {
private readonly MessageGenerator $apiMessageGenerator,
private readonly MessengerInterface $messenger,
private readonly RendererInterface $renderer,
private readonly EntityTypeBundleInfoInterface $bundleInfo
private readonly EntityTypeBundleInfoInterface $bundleInfo,
) {
}
......
......@@ -37,7 +37,7 @@ class EntityQueuer {
* @param \Drupal\Core\Extension\ModuleHandlerInterface|null $moduleHandler
* The module handler.
*/
public function __construct(ConfigFactoryInterface $configFactory, private readonly EntityJobMapper $entityJobMapper, ModuleHandlerInterface $moduleHandler = NULL) {
public function __construct(ConfigFactoryInterface $configFactory, private readonly EntityJobMapper $entityJobMapper, ?ModuleHandlerInterface $moduleHandler = NULL) {
$this->config = $configFactory->get('vgwort.settings');
// Provide BC so sites do not need to run a container rebuild.
// @todo remove in a few releases.
......@@ -59,7 +59,7 @@ class EntityQueuer {
* @return bool
* TRUE if the entity is in the queue, FALSE if not.
*/
public function queueEntity(EntityInterface $entity, int $delay = NULL): bool {
public function queueEntity(EntityInterface $entity, ?int $delay = NULL): bool {
// This service only supports entity types that can be configured in the UI.
// @see \Drupal\vgwort\Form\SettingsForm::buildForm()
if (!$entity instanceof EntityPublishedInterface || !$entity instanceof FieldableEntityInterface) {
......
......@@ -350,7 +350,12 @@ class VGWortTest extends BrowserTestBase {
$this->assertSession()->fieldExists('modules[vgwort][enable]')->check();
$this->submitForm([], 'Install');
$this->assertSession()->statusCodeEquals(200);
$this->assertSession()->pageTextContains('Module VG Wort has been enabled.');
if ((float) \Drupal::VERSION < 10.3) {
$this->assertSession()->pageTextContains('Module VG Wort has been enabled.');
}
else {
$this->assertSession()->pageTextContains('Module VG Wort has been installed.');
}
// Test that reinstalling the module has created the suffix field on nodes.
$this->assertTrue(\Drupal::database()->schema()->fieldExists('node_field_data', 'vgwort_counter_suffix'));
}
......
<?php
declare(strict_types=1);
namespace Drupal\Tests\vgwort\Kernel\DataProducer;
use Drupal\node\Entity\Node;
......
<?php
declare(strict_types=1);
namespace Drupal\Tests\vgwort\Kernel;
use Drupal\advancedqueue\Entity\Queue;
......
<?php
declare(strict_types=1);
namespace Drupal\Tests\vgwort\Kernel;
use Drupal\KernelTests\KernelTestBase;
......
<?php
declare(strict_types=1);
namespace Drupal\Tests\vgwort\Kernel;
use Drupal\Core\Entity\Entity\EntityViewDisplay;
......
<?php
declare(strict_types=1);
namespace Drupal\Tests\vgwort\Kernel;
use Drupal\field\Entity\FieldConfig;
......
<?php
declare(strict_types=1);
namespace Drupal\Tests\vgwort\Kernel;
use Drupal\advancedqueue\Job;
......
<?php
declare(strict_types=1);
namespace Drupal\Tests\vgwort\Kernel;
use Drupal\advancedqueue\Entity\Queue;
......
<?php
declare(strict_types=1);
namespace Drupal\Tests\vgwort\Kernel;
/**
......
<?php
declare(strict_types=1);
namespace Drupal\Tests\vgwort\Kernel;
use Drupal\Core\Entity\Entity\EntityViewDisplay;
......
......@@ -154,7 +154,7 @@ function _vgwort_entity_type_has_counter_id(string $entity_type_id): bool {
* @param string|null $field_name
* The field name.
*/
function _vgwort_add_entity_reference_to_participant_map(string $entity_type, string $field_name = NULL): void {
function _vgwort_add_entity_reference_to_participant_map(string $entity_type, ?string $field_name = NULL): void {
if (!\Drupal::entityTypeManager()->hasDefinition($entity_type)) {
throw new \RuntimeException("The $entity_type does not exist");
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment