Autofix issues detected by CodeSniffer
[MAILPOET-4617]
This commit is contained in:
committed by
Rostislav Wolný
parent
a377f0c946
commit
c601aaa3eb
@ -9,7 +9,6 @@ use MailPoet\Config\AccessControl;
|
||||
use MailPoet\Newsletter\ApiDataSanitizer;
|
||||
use MailPoet\NewsletterTemplates\NewsletterTemplatesRepository;
|
||||
use MailPoet\NewsletterTemplates\ThumbnailSaver;
|
||||
use MailPoet\WP\Functions as WPFunctions;
|
||||
|
||||
class NewsletterTemplates extends APIEndpoint {
|
||||
public $permissions = [
|
||||
|
@ -5,7 +5,6 @@ namespace MailPoet\Automation\Engine\Builder;
|
||||
use MailPoet\Automation\Engine\Data\Workflow;
|
||||
use MailPoet\Automation\Engine\Storage\WorkflowStorage;
|
||||
use MailPoet\Automation\Engine\Storage\WorkflowTemplateStorage;
|
||||
use MailPoet\Automation\Integrations\MailPoet\Templates\WorkflowBuilder;
|
||||
use MailPoet\UnexpectedValueException;
|
||||
|
||||
class CreateWorkflowFromTemplateController {
|
||||
|
@ -1,11 +1,11 @@
|
||||
<?php
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace MailPoet\Automation\Engine\Data;
|
||||
|
||||
use MailPoet\RuntimeException;
|
||||
|
||||
class WorkflowTemplate
|
||||
{
|
||||
class WorkflowTemplate {
|
||||
|
||||
|
||||
public const CATEGORY_WELCOME = 1;
|
||||
public const CATEGORY_ABANDONED_CART = 2;
|
||||
@ -30,7 +30,12 @@ class WorkflowTemplate
|
||||
/** @var Workflow */
|
||||
private $workflow;
|
||||
|
||||
public function __construct(string $slug, int $category, string $description, Workflow $workflow) {
|
||||
public function __construct(
|
||||
string $slug,
|
||||
int $category,
|
||||
string $description,
|
||||
Workflow $workflow
|
||||
) {
|
||||
if (!in_array($category, self::ALL_CATEGORIES)) {
|
||||
throw new RuntimeException("$category is not a valid category.");
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace MailPoet\Automation\Engine\Endpoints\Workflows;
|
||||
|
||||
@ -9,11 +9,14 @@ use MailPoet\Automation\Engine\Data\WorkflowTemplate;
|
||||
use MailPoet\Automation\Engine\Storage\WorkflowTemplateStorage;
|
||||
use MailPoet\Validator\Builder;
|
||||
|
||||
class WorkflowTemplatesGetEndpoint extends Endpoint
|
||||
{
|
||||
class WorkflowTemplatesGetEndpoint extends Endpoint {
|
||||
|
||||
|
||||
private $storage;
|
||||
public function __construct(WorkflowTemplateStorage $storage) {
|
||||
|
||||
public function __construct(
|
||||
WorkflowTemplateStorage $storage
|
||||
) {
|
||||
$this->storage = $storage;
|
||||
}
|
||||
|
||||
|
@ -6,8 +6,6 @@ use MailPoet\Automation\Engine\API\Endpoint;
|
||||
use MailPoet\Automation\Engine\API\Request;
|
||||
use MailPoet\Automation\Engine\API\Response;
|
||||
use MailPoet\Automation\Engine\Builder\CreateWorkflowFromTemplateController;
|
||||
use MailPoet\RuntimeException;
|
||||
use MailPoet\UnexpectedValueException;
|
||||
use MailPoet\Validator\Builder;
|
||||
|
||||
class WorkflowsCreateFromTemplateEndpoint extends Endpoint {
|
||||
|
@ -1,17 +1,14 @@
|
||||
<?php
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace MailPoet\Automation\Engine\Storage;
|
||||
|
||||
use MailPoet\Automation\Engine\Data\WorkflowTemplate;
|
||||
use MailPoet\Automation\Engine\Hooks;
|
||||
use MailPoet\Automation\Integrations\Core\Actions\DelayAction;
|
||||
use MailPoet\Automation\Integrations\MailPoet\Actions\SendEmailAction;
|
||||
use MailPoet\Automation\Integrations\MailPoet\Templates\WorkflowBuilder;
|
||||
use MailPoet\Automation\Integrations\MailPoet\Triggers\SegmentSubscribedTrigger;
|
||||
use MailPoet\WP\Functions as WPFunctions;
|
||||
|
||||
class WorkflowTemplateStorage
|
||||
{
|
||||
class WorkflowTemplateStorage {
|
||||
|
||||
|
||||
/** @var WorkflowTemplate[] */
|
||||
private $templates = [];
|
||||
@ -22,7 +19,10 @@ class WorkflowTemplateStorage
|
||||
/** @var WPFunctions */
|
||||
private $wp;
|
||||
|
||||
public function __construct(WorkflowBuilder $builder, WPFunctions $wp) {
|
||||
public function __construct(
|
||||
WorkflowBuilder $builder,
|
||||
WPFunctions $wp
|
||||
) {
|
||||
$this->builder = $builder;
|
||||
$this->wp = $wp;
|
||||
$this->templates = $this->createTemplates();
|
||||
|
@ -4,12 +4,8 @@ namespace MailPoet\Automation\Integrations\MailPoet\Templates;
|
||||
|
||||
use MailPoet\Automation\Engine\Data\Step;
|
||||
use MailPoet\Automation\Engine\Data\Workflow;
|
||||
use MailPoet\Automation\Engine\Data\WorkflowTemplate;
|
||||
use MailPoet\Automation\Engine\Registry;
|
||||
use MailPoet\Automation\Engine\Workflows\Trigger;
|
||||
use MailPoet\Automation\Integrations\Core\Actions\DelayAction;
|
||||
use MailPoet\Automation\Integrations\MailPoet\Actions\SendEmailAction;
|
||||
use MailPoet\Automation\Integrations\MailPoet\Triggers\SegmentSubscribedTrigger;
|
||||
use MailPoet\Util\Security;
|
||||
use MailPoet\Validator\Schema\ObjectSchema;
|
||||
|
||||
@ -18,7 +14,9 @@ class WorkflowBuilder {
|
||||
/** @var Registry */
|
||||
private $registry;
|
||||
|
||||
public function __construct(Registry $registry) {
|
||||
public function __construct(
|
||||
Registry $registry
|
||||
) {
|
||||
$this->registry = $registry;
|
||||
}
|
||||
|
||||
@ -53,7 +51,6 @@ class WorkflowBuilder {
|
||||
return Security::generateRandomString(16);
|
||||
}
|
||||
|
||||
|
||||
private function getDefaultArgs(ObjectSchema $argsSchema): array {
|
||||
$args = [];
|
||||
foreach ($argsSchema->toArray()['properties'] ?? [] as $name => $schema) {
|
||||
|
@ -12,7 +12,10 @@ class AssetsLoader {
|
||||
/** @var WPFunctions */
|
||||
private $wp;
|
||||
|
||||
public function __construct(RendererFactory $rendererFactory, WPFunctions $wp) {
|
||||
public function __construct(
|
||||
RendererFactory $rendererFactory,
|
||||
WPFunctions $wp
|
||||
) {
|
||||
$this->renderer = $rendererFactory->getRenderer();
|
||||
$this->wp = $wp;
|
||||
}
|
||||
|
@ -9,8 +9,8 @@ use MailPoetVendor\Doctrine\Common\Cache\CacheProvider;
|
||||
* Based on https://github.com/doctrine/cache/blob/1.11.x/lib/Doctrine/Common/Cache/ArrayCache.php
|
||||
* The cache implementation was removed from the doctrine/cache v2.0 so we need to provide own implementation.
|
||||
*/
|
||||
class ArrayCache extends CacheProvider
|
||||
{
|
||||
class ArrayCache extends CacheProvider {
|
||||
|
||||
/** @var mixed[] */
|
||||
private $data = [];
|
||||
|
||||
@ -26,8 +26,7 @@ class ArrayCache extends CacheProvider
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
public function __construct() {
|
||||
$this->upTime = time();
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,10 @@ class ConfigurationFactory {
|
||||
/** @var AnnotationReaderProvider */
|
||||
private $annotationReaderProvider;
|
||||
|
||||
public function __construct(AnnotationReaderProvider $annotationReaderProvider, $isDevMode = null) {
|
||||
public function __construct(
|
||||
AnnotationReaderProvider $annotationReaderProvider,
|
||||
$isDevMode = null
|
||||
) {
|
||||
$this->isDevMode = $isDevMode === null ? WP_DEBUG : $isDevMode;
|
||||
$this->annotationReaderProvider = $annotationReaderProvider;
|
||||
}
|
||||
|
@ -4,12 +4,12 @@ namespace MailPoet\Doctrine;
|
||||
|
||||
use MailPoet\Config\Env;
|
||||
use MailPoet\Doctrine\Types\BigIntType;
|
||||
use MailPoet\Doctrine\Types\DateTimeTzToStringType;
|
||||
use MailPoet\Doctrine\Types\JsonOrSerializedType;
|
||||
use MailPoet\Doctrine\Types\JsonType;
|
||||
use MailPoet\Doctrine\Types\SerializedArrayType;
|
||||
use MailPoet\Doctrine\Types\DateTimeTzToStringType;
|
||||
use MailPoetVendor\Doctrine\DBAL\DriverManager;
|
||||
use MailPoetVendor\Doctrine\DBAL\Driver\PDO\MySQL\Driver;
|
||||
use MailPoetVendor\Doctrine\DBAL\DriverManager;
|
||||
use MailPoetVendor\Doctrine\DBAL\Platforms\MySqlPlatform;
|
||||
use MailPoetVendor\Doctrine\DBAL\Types\Type;
|
||||
use PDO;
|
||||
|
@ -10,7 +10,9 @@ class EmojiEncodingListener {
|
||||
/** @var Emoji */
|
||||
private $emoji;
|
||||
|
||||
public function __construct(Emoji $emoji) {
|
||||
public function __construct(
|
||||
Emoji $emoji
|
||||
) {
|
||||
$this->emoji = $emoji;
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,9 @@ class LastSubscribedAtListener {
|
||||
/** @var Carbon */
|
||||
private $now;
|
||||
|
||||
public function __construct(WPFunctions $wp) {
|
||||
public function __construct(
|
||||
WPFunctions $wp
|
||||
) {
|
||||
$this->now = Carbon::createFromTimestamp($wp->currentTime('timestamp'));
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,9 @@ class TimestampListener {
|
||||
/** @var Carbon */
|
||||
private $now;
|
||||
|
||||
public function __construct(WPFunctions $wp) {
|
||||
public function __construct(
|
||||
WPFunctions $wp
|
||||
) {
|
||||
$this->now = Carbon::createFromTimestamp($wp->currentTime('timestamp'));
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,9 @@ class ValidationListener {
|
||||
/** @var ValidatorInterface */
|
||||
private $validator;
|
||||
|
||||
public function __construct(ValidatorInterface $validator) {
|
||||
public function __construct(
|
||||
ValidatorInterface $validator
|
||||
) {
|
||||
$this->validator = $validator;
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,10 @@ class MetadataCache extends CacheProvider {
|
||||
/** @var string */
|
||||
private $directory;
|
||||
|
||||
public function __construct($dir, $isReadOnly) {
|
||||
public function __construct(
|
||||
$dir,
|
||||
$isReadOnly
|
||||
) {
|
||||
$this->isDevMode = defined('WP_DEBUG') && WP_DEBUG && !$isReadOnly;
|
||||
$this->directory = rtrim($dir, '/\\');
|
||||
if (!file_exists($this->directory)) {
|
||||
|
@ -15,7 +15,10 @@ class PSRCacheItem implements CacheItemInterface {
|
||||
/** @var bool */
|
||||
private $isHit;
|
||||
|
||||
public function __construct(string $key, bool $isHit) {
|
||||
public function __construct(
|
||||
string $key,
|
||||
bool $isHit
|
||||
) {
|
||||
$this->key = $key;
|
||||
$this->isHit = $isHit;
|
||||
}
|
||||
|
@ -9,7 +9,10 @@ class PSRMetadataCache implements CacheItemPoolInterface {
|
||||
/** @var MetadataCache */
|
||||
private $metadataCache;
|
||||
|
||||
public function __construct(string $dir, bool $isReadOnly) {
|
||||
public function __construct(
|
||||
string $dir,
|
||||
bool $isReadOnly
|
||||
) {
|
||||
$this->metadataCache = new MetadataCache($dir, $isReadOnly);
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,6 @@ use MailPoetVendor\Doctrine\Persistence\Mapping\ProxyClassNameResolver as IProxy
|
||||
* @see https://github.com/doctrine/persistence/blob/2.2.x/lib/Doctrine/Persistence/Mapping/AbstractClassMetadataFactory.php#L516-L536
|
||||
*/
|
||||
class ProxyClassNameResolver implements IProxyClassNameResolver {
|
||||
|
||||
/**
|
||||
* @template T
|
||||
* @return class-string<T>
|
||||
|
@ -26,7 +26,9 @@ abstract class Repository {
|
||||
'created_at',
|
||||
];
|
||||
|
||||
public function __construct(EntityManager $entityManager) {
|
||||
public function __construct(
|
||||
EntityManager $entityManager
|
||||
) {
|
||||
$this->entityManager = $entityManager;
|
||||
$this->classMetadata = $entityManager->getClassMetadata($this->getEntityClassName());
|
||||
$this->doctrineRepository = new DoctrineEntityRepository($this->entityManager, $this->classMetadata);
|
||||
|
@ -13,7 +13,12 @@ class SerializableConnection extends Connection {
|
||||
private $config;
|
||||
private $eventManager;
|
||||
|
||||
public function __construct(array $params, Driver $driver, Configuration $config = null, EventManager $eventManager = null) {
|
||||
public function __construct(
|
||||
array $params,
|
||||
Driver $driver,
|
||||
Configuration $config = null,
|
||||
EventManager $eventManager = null
|
||||
) {
|
||||
$this->params = $params;
|
||||
$this->driver = $driver;
|
||||
$this->config = $config;
|
||||
|
@ -3,8 +3,8 @@
|
||||
namespace MailPoet\Doctrine\Types;
|
||||
|
||||
use MailPoetVendor\Carbon\Carbon;
|
||||
use MailPoetVendor\Doctrine\DBAL\Types\DateTimeTzType;
|
||||
use MailPoetVendor\Doctrine\DBAL\Platforms\AbstractPlatform;
|
||||
use MailPoetVendor\Doctrine\DBAL\Types\DateTimeTzType;
|
||||
|
||||
class DateTimeTzToStringType extends DateTimeTzType {
|
||||
const NAME = 'datetimetz_to_string';
|
||||
|
@ -12,7 +12,10 @@ class ValidationException extends \RuntimeException {
|
||||
/** @var ConstraintViolationListInterface|ConstraintViolationInterface[] */
|
||||
private $violations;
|
||||
|
||||
public function __construct($resourceName, ConstraintViolationListInterface $violations) {
|
||||
public function __construct(
|
||||
$resourceName,
|
||||
ConstraintViolationListInterface $violations
|
||||
) {
|
||||
$this->resourceName = $resourceName;
|
||||
$this->violations = $violations;
|
||||
|
||||
|
@ -12,7 +12,9 @@ class ValidatorFactory {
|
||||
/** @var AnnotationReaderProvider */
|
||||
private $annotationReaderProvider;
|
||||
|
||||
public function __construct(AnnotationReaderProvider $annotationReaderProvider) {
|
||||
public function __construct(
|
||||
AnnotationReaderProvider $annotationReaderProvider
|
||||
) {
|
||||
$this->annotationReaderProvider = $annotationReaderProvider;
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,11 @@ class AssetsController {
|
||||
|
||||
const RECAPTCHA_API_URL = 'https://www.google.com/recaptcha/api.js?render=explicit';
|
||||
|
||||
public function __construct(WPFunctions $wp, BasicRenderer $renderer, SettingsController $settings) {
|
||||
public function __construct(
|
||||
WPFunctions $wp,
|
||||
BasicRenderer $renderer,
|
||||
SettingsController $settings
|
||||
) {
|
||||
$this->wp = $wp;
|
||||
$this->renderer = $renderer;
|
||||
$this->settings = $settings;
|
||||
|
@ -16,7 +16,9 @@ class DoctrinePanel implements IBarPanel {
|
||||
/** @var DebugStack */
|
||||
private $sqlLogger;
|
||||
|
||||
public function __construct(Configuration $doctrineConfiguration) {
|
||||
public function __construct(
|
||||
Configuration $doctrineConfiguration
|
||||
) {
|
||||
$this->sqlLogger = new DebugStack();
|
||||
$doctrineConfiguration->setSQLLogger($this->sqlLogger);
|
||||
}
|
||||
|
@ -14,7 +14,10 @@ class Assets extends AbstractExtension {
|
||||
/** @var CdnAssetUrl|null */
|
||||
private $cdnAssetsUrl;
|
||||
|
||||
public function __construct(array $globals, CdnAssetUrl $cdnAssetsUrl = null) {
|
||||
public function __construct(
|
||||
array $globals,
|
||||
CdnAssetUrl $cdnAssetsUrl = null
|
||||
) {
|
||||
$this->globals = $globals;
|
||||
$this->cdnAssetsUrl = $cdnAssetsUrl;
|
||||
}
|
||||
|
Reference in New Issue
Block a user