Skip to content

Commit

Permalink
Fixes PHPCS issues for phpstan v12.4 (#1085)
Browse files Browse the repository at this point in the history
  • Loading branch information
kedarkhaire authored Oct 1, 2024
1 parent 34bef3f commit 48b7e83
Show file tree
Hide file tree
Showing 254 changed files with 523 additions and 560 deletions.
4 changes: 2 additions & 2 deletions modules/apigee_edge_actions/apigee_edge_actions.tokens.inc
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
*/


use Drupal\apigee_edge\Entity\EdgeEntityInterface;
use Drupal\Component\Utility\Html;
use Drupal\Core\Render\BubbleableMetadata;
use Drupal\apigee_edge\Entity\EdgeEntityInterface;

/**
* Implements hook_token_info_alter().
Expand Down Expand Up @@ -79,7 +79,7 @@ function apigee_edge_actions_tokens($type, $tokens, array $data, array $options,
$replacements = [];

if ($type == 'entity' && !empty($data['entity_type']) && !empty($data['entity']) && !empty($data['token_type'])) {
/* @var \Drupal\Core\Entity\ContentEntityInterface $entity */
/** @var \Drupal\Core\Entity\ContentEntityInterface $entity */
$entity = $data['entity'];

if ($entity instanceof EdgeEntityInterface) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

namespace Drupal\apigee_edge_actions_debug\EventSubscriber;

use Drupal\Core\Logger\LoggerChannelInterface;
use Drupal\apigee_edge_actions\Event\ApigeeEdgeActionsEventInterface;
use Drupal\apigee_edge_actions\Event\EdgeEntityEventEdge;
use Drupal\Core\Logger\LoggerChannelInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

namespace Drupal\apigee_edge_actions;

use Drupal\apigee_edge\Entity\FieldableEdgeEntityInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\apigee_edge\Entity\FieldableEdgeEntityInterface;

/**
* Defines the apigee_edge_actions.edge_entity_type_manager service.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
/**
* Base class for Edge events.
*
* TODO: Rules does not support non GenericEvent context.
* @todo Rules does not support non GenericEvent context.
*/
abstract class EdgeEntityEventBase extends GenericEvent {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@

namespace Drupal\apigee_edge_actions\EventSubscriber;

use Drupal\apigee_edge\Entity\AppInterface;
use Drupal\apigee_edge\Event\AppCredentialAddApiProductEvent;
use Drupal\apigee_edge\Event\AppCredentialDeleteApiProductEvent;
use Drupal\apigee_edge_actions\Event\EdgeEntityEventEdge;
use Drupal\Component\Plugin\Exception\PluginException;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Logger\LoggerChannelInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\apigee_edge\Entity\AppInterface;
use Drupal\apigee_edge\Event\AppCredentialAddApiProductEvent;
use Drupal\apigee_edge\Event\AppCredentialDeleteApiProductEvent;
use Drupal\apigee_edge_actions\Event\EdgeEntityEventEdge;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Contracts\EventDispatcher\Event;
Expand Down Expand Up @@ -177,17 +177,17 @@ protected function dispatchRulesEvent(string $rules_event_name, Event $event, ar
* The app with the provided name or null.
*/
protected function getAppByName(string $name, string $owner_id, string $app_type): ?AppInterface {
/* @var \Drupal\apigee_edge\Entity\AppInterface $appClass */
/** @var \Drupal\apigee_edge\Entity\AppInterface $appClass */
$appClass = $this->entityTypeManger->getStorage("{$app_type}_app")->getEntityType()->getClass();

try {
if ($app_type == 'developer') {
/* @var \Drupal\apigee_edge\Entity\Controller\DeveloperAppControllerFactoryInterface $controller */
/** @var \Drupal\apigee_edge\Entity\Controller\DeveloperAppControllerFactoryInterface $controller */
$controller = \Drupal::service('apigee_edge.controller.developer_app_controller_factory');
$edge_app = $controller->developerAppController($owner_id)->load($name);
}
else {
/* @var \Drupal\apigee_edge_teams\Entity\Controller\TeamAppControllerFactory $controller */
/** @var \Drupal\apigee_edge_teams\Entity\Controller\TeamAppControllerFactory $controller */
$controller = \Drupal::service('apigee_edge_teams.controller.team_app_controller_factory');
$edge_app = $controller->teamAppController($owner_id)->load($name);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@

namespace Drupal\apigee_edge_actions\Plugin\RulesAction;

use Drupal\Core\Annotation\ContextDefinition;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\rules\Core\Annotation\RulesAction;
use Drupal\rules\Core\RulesActionBase;
use Psr\Log\LoggerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public static function create(ContainerInterface $container, array $configuratio
/**
* {@inheritdoc}
*/
protected function doExecute(array $roles, $subject, $message, $reply = NULL, LanguageInterface $language = NULL) {
protected function doExecute(array $roles, $subject, $message, $reply = NULL, ?LanguageInterface $language = NULL) {
// SystemMailToUsersOfRole::doExecute() expects an array of RoleInterface.
// Upcast is done in RulesActionBase.
parent::doExecute($roles, $subject, $message, $reply, $language);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@

namespace Drupal\apigee_edge_actions\Plugin\RulesEvent;

use Drupal\Component\Plugin\Derivative\DeriverBase;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\apigee_edge\Entity\AppInterface;
use Drupal\apigee_edge\Entity\EdgeEntityTypeInterface;
use Drupal\apigee_edge_actions\ApigeeActionsEntityTypeHelperInterface;
use Drupal\apigee_edge_teams\Entity\TeamAppInterface;
use Drupal\Component\Plugin\Derivative\DeriverBase;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

namespace Drupal\apigee_edge_actions\Plugin\RulesEvent;

use Drupal\apigee_edge\Entity\EdgeEntityTypeInterface;
use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface;
use Drupal\apigee_edge\Entity\EdgeEntityTypeInterface;

/**
* Provides an interface for Apigee Edge entity event deriver.
Expand Down
6 changes: 3 additions & 3 deletions modules/apigee_edge_actions/src/TeamMembershipManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@

namespace Drupal\apigee_edge_actions;

use Drupal\Core\Cache\CacheTagsInvalidatorInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\apigee_edge\Entity\Controller\DeveloperControllerInterface;
use Drupal\apigee_edge\Entity\DeveloperCompaniesCacheInterface;
use Drupal\apigee_edge_actions\Event\EdgeEntityEventEdge;
use Drupal\apigee_edge_teams\CompanyMembersControllerFactoryInterface;
use Drupal\apigee_edge_teams\TeamMembershipManagerInterface;
use Drupal\Core\Cache\CacheTagsInvalidatorInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\user\UserInterface;
use Psr\Log\LoggerInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
Expand Down Expand Up @@ -151,7 +151,7 @@ public function removeMembers(string $team, array $developers): void {
/**
* {@inheritdoc}
*/
public function getTeams(string $developer, string $team = NULL): array {
public function getTeams(string $developer, ?string $team = NULL): array {
return $this->inner->getTeams($developer, $team);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@

namespace Drupal\Tests\apigee_edge_actions\Kernel;

use Drupal\apigee_edge\Plugin\EdgeKeyTypeInterface;
use Drupal\Core\Database\Database;
use Drupal\dblog\Controller\DbLogController;
use Drupal\Tests\apigee_mock_api_client\Traits\ApigeeMockApiClientHelperTrait;
use Drupal\Tests\rules\Kernel\RulesKernelTestBase;
use Drupal\apigee_edge\Plugin\EdgeKeyTypeInterface;
use Drupal\dblog\Controller\DbLogController;
use Drupal\user\Entity\User;
use Symfony\Component\HttpFoundation\Response;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

namespace Drupal\Tests\apigee_edge_actions\Kernel\Plugin\RulesAction;

use Drupal\rules\Context\ContextConfig;
use Drupal\Tests\apigee_edge_actions\Kernel\ApigeeEdgeActionsRulesKernelTestBase;
use Drupal\rules\Context\ContextConfig;

/**
* Tests Edge entity add_member event.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

namespace Drupal\Tests\apigee_edge_actions\Kernel\Plugin\RulesEvent;

use Drupal\rules\Context\ContextConfig;
use Drupal\Tests\apigee_edge_actions\Kernel\ApigeeEdgeActionsRulesKernelTestBase;
use Drupal\rules\Context\ContextConfig;

/**
* Tests Edge entity add_member event.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

namespace Drupal\Tests\apigee_edge_actions\Kernel\Plugin\RulesEvent;

use Drupal\Tests\apigee_edge_actions\Kernel\ApigeeEdgeActionsRulesKernelTestBase;
use Drupal\apigee_edge\Entity\ApiProduct;
use Drupal\rules\Context\ContextConfig;
use Drupal\Tests\apigee_edge_actions\Kernel\ApigeeEdgeActionsRulesKernelTestBase;

/**
* Tests Edge entity add_product event.
Expand Down Expand Up @@ -103,7 +103,7 @@ public function testEvent() {
$this->queueDeveloperResponse($this->account);
$this->stack->queueMockResponse([
'get_developer_apps' => [
'apps' => [$developer_app]
'apps' => [$developer_app],
],
]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

namespace Drupal\Tests\apigee_edge_actions\Kernel\Plugin\RulesEvent;

use Drupal\rules\Context\ContextConfig;
use Drupal\Tests\apigee_edge_actions\Kernel\ApigeeEdgeActionsRulesKernelTestBase;
use Drupal\rules\Context\ContextConfig;

/**
* Tests Edge entity delete event.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

namespace Drupal\Tests\apigee_edge_actions\Kernel\Plugin\RulesEvent;

use Drupal\rules\Context\ContextConfig;
use Drupal\Tests\apigee_edge_actions\Kernel\ApigeeEdgeActionsRulesKernelTestBase;
use Drupal\rules\Context\ContextConfig;

/**
* Tests Edge entity insert event.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

namespace Drupal\Tests\apigee_edge_actions\Kernel\Plugin\RulesEvent;

use Drupal\rules\Context\ContextConfig;
use Drupal\Tests\apigee_edge_actions\Kernel\ApigeeEdgeActionsRulesKernelTestBase;
use Drupal\rules\Context\ContextConfig;

/**
* Tests Edge entity remove_member event.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

namespace Drupal\Tests\apigee_edge_actions\Kernel\Plugin\RulesEvent;

use Drupal\Tests\apigee_edge_actions\Kernel\ApigeeEdgeActionsRulesKernelTestBase;
use Drupal\apigee_edge\Entity\ApiProduct;
use Drupal\rules\Context\ContextConfig;
use Drupal\Tests\apigee_edge_actions\Kernel\ApigeeEdgeActionsRulesKernelTestBase;

/**
* Tests Edge entity remove_product event.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

namespace Drupal\Tests\apigee_edge_actions\Kernel\Plugin\RulesEvent;

use Drupal\rules\Context\ContextConfig;
use Drupal\Tests\apigee_edge_actions\Kernel\ApigeeEdgeActionsRulesKernelTestBase;
use Drupal\rules\Context\ContextConfig;

/**
* Tests Edge entity update event.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
use Apigee\Edge\Exception\ApiException;
use Apigee\Edge\Structure\AttributesProperty;
use Apigee\Edge\Structure\PagerInterface;
use Drupal\apigee_edge\Entity\Controller\ApiProductControllerInterface;
use Drupal\Core\State\StateInterface;
use Drupal\apigee_edge\Entity\Controller\ApiProductControllerInterface;

/**
* API product controller that reads and writes attributes from/to States API.
Expand Down Expand Up @@ -139,7 +139,7 @@ public function delete(string $entity_id): EntityInterface {
/**
* {@inheritdoc}
*/
public function getEntities(PagerInterface $pager = NULL, string $key_provider = 'id'): array {
public function getEntities(?PagerInterface $pager = NULL, string $key_provider = 'id'): array {
/** @var \Drupal\apigee_edge\Entity\ApiProductInterface $entity */
$ids = array_map(function ($id) {
return $this->generateApiProductStateKey($id);
Expand Down Expand Up @@ -255,7 +255,7 @@ public function createPager(int $limit = 0, ?string $startKey = NULL): PagerInte
/**
* {@inheritdoc}
*/
public function getEntityIds(PagerInterface $pager = NULL): array {
public function getEntityIds(?PagerInterface $pager = NULL): array {
return $this->innerService->getEntityIds($pager);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@

namespace Drupal\apigee_edge_apiproduct_rbac_test;

use Drupal\apigee_edge\Entity\Controller\ApiProductControllerInterface;
use Drupal\apigee_edge\Entity\Storage\ApiProductStorage as OriginalApiProductStorage;
use Drupal\Component\Datetime\TimeInterface;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Cache\MemoryCache\MemoryCacheInterface;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\State\StateInterface;
use Drupal\apigee_edge\Entity\Controller\ApiProductControllerInterface;
use Drupal\apigee_edge\Entity\Storage\ApiProductStorage as OriginalApiProductStorage;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

namespace Drupal\Tests\apigee_edge_apiproduct_rbac\FunctionalJavascript;

use Drupal\apigee_edge\Entity\ApiProductInterface;
use Drupal\Core\Url;
use Drupal\Tests\apigee_edge\FunctionalJavascript\ApiProductAccessTest;
use Drupal\apigee_edge\Entity\ApiProductInterface;
use Drupal\user\UserInterface;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@

namespace Drupal\apigee_edge_debug;

use Drupal\apigee_edge_debug\Annotation\DebugMessageFormatter;
use Drupal\apigee_edge_debug\Plugin\DebugMessageFormatter\DebugMessageFormatterPluginInterface;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Plugin\DefaultPluginManager;
use Drupal\apigee_edge_debug\Annotation\DebugMessageFormatter;
use Drupal\apigee_edge_debug\Plugin\DebugMessageFormatter\DebugMessageFormatterPluginInterface;

/**
* Provides a debug message formatter plugin manager.
Expand Down
2 changes: 1 addition & 1 deletion modules/apigee_edge_debug/src/Form/ConfigForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@

namespace Drupal\apigee_edge_debug\Form;

use Drupal\apigee_edge_debug\DebugMessageFormatterPluginManager;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\apigee_edge_debug\DebugMessageFormatterPluginManager;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@

namespace Drupal\apigee_edge_debug\HttpClientMiddleware;

use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\apigee_edge_debug\DebugMessageFormatterPluginManager;
use Drupal\apigee_edge_debug\SDKConnector;
use Drupal\Core\Config\ConfigFactoryInterface;
use GuzzleHttp\RequestOptions;
use GuzzleHttp\TransferStats;
use Psr\Http\Message\RequestInterface;
use Psr\Log\LoggerInterface;
use Psr\Log\LogLevel;
use Psr\Log\LoggerInterface;

/**
* Http client middleware that profiles Apigee Edge API calls.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@

namespace Drupal\apigee_edge_debug\HttpClientMiddleware;

use Drupal\apigee_edge_debug\DebugMessageFormatterPluginManager;
use Drupal\apigee_edge_debug\SDKConnector;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Messenger\MessengerInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\apigee_edge_debug\DebugMessageFormatterPluginManager;
use GuzzleHttp\RequestOptions;
use GuzzleHttp\TransferStats;
use Psr\Http\Message\RequestInterface;
Expand Down
4 changes: 2 additions & 2 deletions modules/apigee_edge_debug/src/SDKConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@

namespace Drupal\apigee_edge_debug;

use Drupal\apigee_edge\SDKConnector as OriginalSDKConnector;
use Drupal\apigee_edge\SDKConnectorInterface;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Extension\InfoParserInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Http\ClientFactory;
use Drupal\apigee_edge\SDKConnector as OriginalSDKConnector;
use Drupal\apigee_edge\SDKConnectorInterface;
use Drupal\key\KeyRepositoryInterface;

/**
Expand Down
Loading

0 comments on commit 48b7e83

Please sign in to comment.