Skip to content
Snippets Groups Projects
Commit cb6e16b2 authored by Andrey Tymchuk's avatar Andrey Tymchuk Committed by A.Tymchuk
Browse files

Issue #3423280 by WalkingDexter: Fix PHPStan errors (level 2)

parent d92036bf
No related branches found
No related tags found
No related merge requests found
......@@ -31,7 +31,7 @@ abstract class SubmitterBase {
/**
* The Drupal state service.
*
* @var \Drupal\workflows\StateInterface
* @var \Drupal\Core\State\StateInterface
*/
protected $state;
......
......@@ -73,11 +73,11 @@ class ArgumentCollector implements EventSubscriberInterface {
}
$view_id = $this->routeMatch->getParameter('view_id');
/** @var \Drupal\views\ViewEntityInterface $view_entity */
if ($view_id && $view_entity = $this->viewStorage->load($view_id)) {
$display_id = $this->routeMatch->getParameter('display_id');
// Get a set of view arguments and try to add them to the index.
/** @var \Drupal\views\ViewEntityInterface $view_entity */
$view = $view_entity->getExecutable();
$args = $this->getViewArgumentsFromRoute();
$this->sitemapViews->addArgumentsToIndex($view, $args, $display_id);
......
parameters:
ignoreErrors:
-
message: "#^Access to an undefined property Drupal\\\\Core\\\\Entity\\\\EntityInterface\\:\\:\\$_simple_sitemap_index_now\\.$#"
count: 1
path: modules/simple_sitemap_engines/src/Form/Handler/EntityFormHandler.php
-
message: """
#^Call to deprecated function watchdog_exception\\(\\)\\:
......@@ -19,6 +24,16 @@ parameters:
count: 2
path: src/Manager/Generator.php
-
message: "#^Access to an undefined property Drupal\\\\Core\\\\Field\\\\Plugin\\\\Field\\\\FieldType\\\\EntityReferenceItem\\<mixed\\>\\:\\:\\$alt\\.$#"
count: 1
path: src/Plugin/simple_sitemap/UrlGenerator/EntityUrlGeneratorBase.php
-
message: "#^Access to an undefined property Drupal\\\\Core\\\\Field\\\\Plugin\\\\Field\\\\FieldType\\\\EntityReferenceItem\\<mixed\\>\\:\\:\\$title\\.$#"
count: 1
path: src/Plugin/simple_sitemap/UrlGenerator/EntityUrlGeneratorBase.php
-
message: "#^\\\\Drupal calls should be avoided in classes, use dependency injection instead$#"
count: 1
......
includes:
- phpstan-baseline.neon
parameters:
level: 1
level: 2
paths:
- .
excludePaths:
......@@ -14,5 +14,16 @@ parameters:
# See https://www.drupal.org/project/simple_sitemap/issues/3344735
- message: '#^Variable \$path on left side of \?\? always exists and is not nullable\.$#'
paths:
- modules/simple_sitemap_engines/src/PathProcessor/IndexNowPathProcessor.php
- src/PathProcessor/SitemapPathProcessor.php
- modules/simple_sitemap_engines/src/PathProcessor/IndexNowPathProcessor.php
- src/PathProcessor/SitemapPathProcessor.php
drupal:
entityMapping:
simple_sitemap:
class: Drupal\simple_sitemap\Entity\SimpleSitemap
storage: Drupal\simple_sitemap\Entity\SimpleSitemapStorage
simple_sitemap_type:
class: Drupal\simple_sitemap\Entity\SimpleSitemapType
storage: Drupal\simple_sitemap\Entity\SimpleSitemapTypeStorage
simple_sitemap_engine:
class: Drupal\simple_sitemap_engines\Entity\SimpleSitemapEngine
storage: Drupal\simple_sitemap_engines\Entity\SimpleSitemapEngineStorage
......@@ -110,6 +110,7 @@ class EntitiesForm extends SimpleSitemapFormBase {
}
natcasesort($entity_types);
/** @var string|\Drupal\Core\StringTranslation\TranslatableMarkup $label */
foreach ($entity_types as $entity_type_id => $label) {
$is_enabled = $this->entityManager->entityTypeIsEnabled($entity_type_id);
......
......@@ -373,7 +373,7 @@ class FormHelper {
/**
* Validates the priority.
*
* @param string|int $priority
* @param string $priority
* The priority value.
*
* @return bool
......
......@@ -15,6 +15,13 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
*/
class SimpleSitemapEntityForm extends EntityForm {
/**
* The entity being used by this form.
*
* @var \Drupal\simple_sitemap\Entity\SimpleSitemapInterface
*/
protected $entity;
/**
* Entity type manager service.
*
......
......@@ -15,6 +15,13 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
*/
class SimpleSitemapTypeEntityForm extends EntityForm {
/**
* The entity being used by this form.
*
* @var \Drupal\simple_sitemap\Entity\SimpleSitemapTypeInterface
*/
protected $entity;
/**
* Entity type manager service.
*
......
......@@ -2,12 +2,13 @@
namespace Drupal\simple_sitemap\Plugin\simple_sitemap;
use Drupal\Component\Plugin\PluginInspectionInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
/**
* Provides an interface for Simple XML Sitemap plugins.
*/
interface SimpleSitemapPluginInterface extends ContainerFactoryPluginInterface {
interface SimpleSitemapPluginInterface extends ContainerFactoryPluginInterface, PluginInspectionInterface {
/**
* Gets the label of this plugin.
......
......@@ -35,6 +35,9 @@ class SimpleSitemapListBuilder extends DraggableListBuilder {
/**
* {@inheritdoc}
*
* @param \Drupal\simple_sitemap\Entity\SimpleSitemapInterface $entity
* The entity for this row of the list.
*/
public function buildRow(EntityInterface $entity) {
$row['name']['#markup'] = '<span title="' . $entity->get('description') . '">' . $entity->label() . '</span>';
......
......@@ -25,6 +25,9 @@ class SimpleSitemapTypeListBuilder extends ConfigEntityListBuilder {
/**
* {@inheritdoc}
*
* @param \Drupal\simple_sitemap\Entity\SimpleSitemapTypeInterface $entity
* The entity for this row of the list.
*/
public function buildRow(EntityInterface $entity) {
$row['label'] = $entity->label();
......
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