Autofix issues detected by CodeSniffer

[MAILPOET-4617]
This commit is contained in:
Jan Jakes
2022-09-06 16:49:20 +02:00
committed by Rostislav Wolný
parent a377f0c946
commit c601aaa3eb
29 changed files with 123 additions and 80 deletions

View File

@ -9,7 +9,6 @@ use MailPoet\Config\AccessControl;
use MailPoet\Newsletter\ApiDataSanitizer; use MailPoet\Newsletter\ApiDataSanitizer;
use MailPoet\NewsletterTemplates\NewsletterTemplatesRepository; use MailPoet\NewsletterTemplates\NewsletterTemplatesRepository;
use MailPoet\NewsletterTemplates\ThumbnailSaver; use MailPoet\NewsletterTemplates\ThumbnailSaver;
use MailPoet\WP\Functions as WPFunctions;
class NewsletterTemplates extends APIEndpoint { class NewsletterTemplates extends APIEndpoint {
public $permissions = [ public $permissions = [

View File

@ -5,7 +5,6 @@ namespace MailPoet\Automation\Engine\Builder;
use MailPoet\Automation\Engine\Data\Workflow; use MailPoet\Automation\Engine\Data\Workflow;
use MailPoet\Automation\Engine\Storage\WorkflowStorage; use MailPoet\Automation\Engine\Storage\WorkflowStorage;
use MailPoet\Automation\Engine\Storage\WorkflowTemplateStorage; use MailPoet\Automation\Engine\Storage\WorkflowTemplateStorage;
use MailPoet\Automation\Integrations\MailPoet\Templates\WorkflowBuilder;
use MailPoet\UnexpectedValueException; use MailPoet\UnexpectedValueException;
class CreateWorkflowFromTemplateController { class CreateWorkflowFromTemplateController {
@ -26,7 +25,7 @@ class CreateWorkflowFromTemplateController {
public function createWorkflow(string $slug): Workflow { public function createWorkflow(string $slug): Workflow {
$template = $this->templateStorage->getTemplateBySlug($slug); $template = $this->templateStorage->getTemplateBySlug($slug);
if (! $template) { if (!$template) {
throw UnexpectedValueException::create()->withMessage('Template not found.'); throw UnexpectedValueException::create()->withMessage('Template not found.');
} }

View File

@ -1,11 +1,11 @@
<?php <?php declare(strict_types = 1);
namespace MailPoet\Automation\Engine\Data; namespace MailPoet\Automation\Engine\Data;
use MailPoet\RuntimeException; use MailPoet\RuntimeException;
class WorkflowTemplate class WorkflowTemplate {
{
public const CATEGORY_WELCOME = 1; public const CATEGORY_WELCOME = 1;
public const CATEGORY_ABANDONED_CART = 2; public const CATEGORY_ABANDONED_CART = 2;
@ -30,8 +30,13 @@ class WorkflowTemplate
/** @var Workflow */ /** @var Workflow */
private $workflow; private $workflow;
public function __construct(string $slug, int $category, string $description, Workflow $workflow) { public function __construct(
if (! in_array($category, self::ALL_CATEGORIES)) { string $slug,
int $category,
string $description,
Workflow $workflow
) {
if (!in_array($category, self::ALL_CATEGORIES)) {
throw new RuntimeException("$category is not a valid category."); throw new RuntimeException("$category is not a valid category.");
} }
$this->slug = $slug; $this->slug = $slug;
@ -40,27 +45,27 @@ class WorkflowTemplate
$this->workflow = $workflow; $this->workflow = $workflow;
} }
public function getSlug() : string { public function getSlug(): string {
return $this->slug; return $this->slug;
} }
public function getName() : string { public function getName(): string {
return $this->workflow->getName(); return $this->workflow->getName();
} }
public function getCategory() : int { public function getCategory(): int {
return $this->category; return $this->category;
} }
public function getDescription() : string { public function getDescription(): string {
return $this->description; return $this->description;
} }
public function getWorkflow() : Workflow { public function getWorkflow(): Workflow {
return $this->workflow; return $this->workflow;
} }
public function toArray() : array { public function toArray(): array {
return [ return [
'slug' => $this->getSlug(), 'slug' => $this->getSlug(),
'name' => $this->getName(), 'name' => $this->getName(),

View File

@ -1,4 +1,4 @@
<?php <?php declare(strict_types = 1);
namespace MailPoet\Automation\Engine\Endpoints\Workflows; namespace MailPoet\Automation\Engine\Endpoints\Workflows;
@ -9,22 +9,25 @@ use MailPoet\Automation\Engine\Data\WorkflowTemplate;
use MailPoet\Automation\Engine\Storage\WorkflowTemplateStorage; use MailPoet\Automation\Engine\Storage\WorkflowTemplateStorage;
use MailPoet\Validator\Builder; use MailPoet\Validator\Builder;
class WorkflowTemplatesGetEndpoint extends Endpoint class WorkflowTemplatesGetEndpoint extends Endpoint {
{
private $storage; private $storage;
public function __construct(WorkflowTemplateStorage $storage) {
public function __construct(
WorkflowTemplateStorage $storage
) {
$this->storage = $storage; $this->storage = $storage;
} }
public function handle(Request $request): Response { public function handle(Request $request): Response {
$templates = $this->storage->getTemplates((int) $request->getParam('category')); $templates = $this->storage->getTemplates((int)$request->getParam('category'));
return new Response(array_map(function (WorkflowTemplate $workflow) { return new Response(array_map(function (WorkflowTemplate $workflow) {
return $workflow->toArray(); return $workflow->toArray();
}, $templates)); }, $templates));
} }
public static function getRequestSchema() : array { public static function getRequestSchema(): array {
return [ return [
'category' => Builder::integer()->nullable(), 'category' => Builder::integer()->nullable(),
]; ];

View File

@ -6,8 +6,6 @@ use MailPoet\Automation\Engine\API\Endpoint;
use MailPoet\Automation\Engine\API\Request; use MailPoet\Automation\Engine\API\Request;
use MailPoet\Automation\Engine\API\Response; use MailPoet\Automation\Engine\API\Response;
use MailPoet\Automation\Engine\Builder\CreateWorkflowFromTemplateController; use MailPoet\Automation\Engine\Builder\CreateWorkflowFromTemplateController;
use MailPoet\RuntimeException;
use MailPoet\UnexpectedValueException;
use MailPoet\Validator\Builder; use MailPoet\Validator\Builder;
class WorkflowsCreateFromTemplateEndpoint extends Endpoint { class WorkflowsCreateFromTemplateEndpoint extends Endpoint {

View File

@ -1,17 +1,14 @@
<?php <?php declare(strict_types = 1);
namespace MailPoet\Automation\Engine\Storage; namespace MailPoet\Automation\Engine\Storage;
use MailPoet\Automation\Engine\Data\WorkflowTemplate; use MailPoet\Automation\Engine\Data\WorkflowTemplate;
use MailPoet\Automation\Engine\Hooks; 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\Templates\WorkflowBuilder;
use MailPoet\Automation\Integrations\MailPoet\Triggers\SegmentSubscribedTrigger;
use MailPoet\WP\Functions as WPFunctions; use MailPoet\WP\Functions as WPFunctions;
class WorkflowTemplateStorage class WorkflowTemplateStorage {
{
/** @var WorkflowTemplate[] */ /** @var WorkflowTemplate[] */
private $templates = []; private $templates = [];
@ -22,13 +19,16 @@ class WorkflowTemplateStorage
/** @var WPFunctions */ /** @var WPFunctions */
private $wp; private $wp;
public function __construct(WorkflowBuilder $builder, WPFunctions $wp) { public function __construct(
WorkflowBuilder $builder,
WPFunctions $wp
) {
$this->builder = $builder; $this->builder = $builder;
$this->wp = $wp; $this->wp = $wp;
$this->templates = $this->createTemplates(); $this->templates = $this->createTemplates();
} }
public function getTemplateBySlug(string $slug) : ?WorkflowTemplate { public function getTemplateBySlug(string $slug): ?WorkflowTemplate {
foreach ($this->templates as $template) { foreach ($this->templates as $template) {
if ($template->getSlug() === $slug) { if ($template->getSlug() === $slug) {
return $template; return $template;
@ -38,21 +38,21 @@ class WorkflowTemplateStorage
} }
/** @return WorkflowTemplate[] */ /** @return WorkflowTemplate[] */
public function getTemplates(int $category = null) : array { public function getTemplates(int $category = null): array {
if (! $category) { if (!$category) {
return $this->templates; return $this->templates;
} }
return array_values( return array_values(
array_filter( array_filter(
$this->templates, $this->templates,
function(WorkflowTemplate $template) use ($category) : bool { function(WorkflowTemplate $template) use ($category): bool {
return $template->getCategory() === $category; return $template->getCategory() === $category;
} }
) )
); );
} }
private function createTemplates() : array { private function createTemplates(): array {
$simpleWelcomeEmail = new WorkflowTemplate( $simpleWelcomeEmail = new WorkflowTemplate(
'simple-welcome-email', 'simple-welcome-email',
WorkflowTemplate::CATEGORY_WELCOME, WorkflowTemplate::CATEGORY_WELCOME,
@ -67,9 +67,9 @@ class WorkflowTemplateStorage
) )
); );
$templates = $this->wp->applyFilters(Hooks::WORKFLOW_TEMPLATES,[ $templates = $this->wp->applyFilters(Hooks::WORKFLOW_TEMPLATES, [
$simpleWelcomeEmail, $simpleWelcomeEmail,
]); ]);
return is_array($templates)?$templates:[]; return is_array($templates) ? $templates : [];
} }
} }

View File

@ -1,15 +1,11 @@
<?php declare(strict_types=1); <?php declare(strict_types = 1);
namespace MailPoet\Automation\Integrations\MailPoet\Templates; namespace MailPoet\Automation\Integrations\MailPoet\Templates;
use MailPoet\Automation\Engine\Data\Step; use MailPoet\Automation\Engine\Data\Step;
use MailPoet\Automation\Engine\Data\Workflow; use MailPoet\Automation\Engine\Data\Workflow;
use MailPoet\Automation\Engine\Data\WorkflowTemplate;
use MailPoet\Automation\Engine\Registry; use MailPoet\Automation\Engine\Registry;
use MailPoet\Automation\Engine\Workflows\Trigger; 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\Util\Security;
use MailPoet\Validator\Schema\ObjectSchema; use MailPoet\Validator\Schema\ObjectSchema;
@ -18,22 +14,24 @@ class WorkflowBuilder {
/** @var Registry */ /** @var Registry */
private $registry; private $registry;
public function __construct(Registry $registry) { public function __construct(
Registry $registry
) {
$this->registry = $registry; $this->registry = $registry;
} }
public function createFromSequence(string $name, array $sequence, array $sequenceArgs = []) : Workflow { public function createFromSequence(string $name, array $sequence, array $sequenceArgs = []): Workflow {
$steps = []; $steps = [];
$nextStep = null; $nextStep = null;
foreach (array_reverse($sequence) as $index => $stepKey) { foreach (array_reverse($sequence) as $index => $stepKey) {
$workflowStep = $this->registry->getStep($stepKey); $workflowStep = $this->registry->getStep($stepKey);
if (! $workflowStep) { if (!$workflowStep) {
continue; continue;
} }
$args = array_merge($this->getDefaultArgs($workflowStep->getArgsSchema()), array_reverse($sequenceArgs)[$index] ?? []); $args = array_merge($this->getDefaultArgs($workflowStep->getArgsSchema()), array_reverse($sequenceArgs)[$index] ?? []);
$step = new Step( $step = new Step(
$this->uniqueId(), $this->uniqueId(),
in_array(Trigger::class, (array) class_implements($workflowStep)) ? Step::TYPE_TRIGGER : Step::TYPE_ACTION, in_array(Trigger::class, (array)class_implements($workflowStep)) ? Step::TYPE_TRIGGER : Step::TYPE_ACTION,
$stepKey, $stepKey,
$nextStep, $nextStep,
$args $args
@ -53,7 +51,6 @@ class WorkflowBuilder {
return Security::generateRandomString(16); return Security::generateRandomString(16);
} }
private function getDefaultArgs(ObjectSchema $argsSchema): array { private function getDefaultArgs(ObjectSchema $argsSchema): array {
$args = []; $args = [];
foreach ($argsSchema->toArray()['properties'] ?? [] as $name => $schema) { foreach ($argsSchema->toArray()['properties'] ?? [] as $name => $schema) {

View File

@ -12,14 +12,17 @@ class AssetsLoader {
/** @var WPFunctions */ /** @var WPFunctions */
private $wp; private $wp;
public function __construct(RendererFactory $rendererFactory, WPFunctions $wp) { public function __construct(
RendererFactory $rendererFactory,
WPFunctions $wp
) {
$this->renderer = $rendererFactory->getRenderer(); $this->renderer = $rendererFactory->getRenderer();
$this->wp = $wp; $this->wp = $wp;
} }
public function loadStyles(): void { public function loadStyles(): void {
// MailPoet plugin style should be loaded on all mailpoet sites // MailPoet plugin style should be loaded on all mailpoet sites
if (isset($_GET['page']) && strpos($_GET['page'], 'mailpoet-') === 0 ) { if (isset($_GET['page']) && strpos($_GET['page'], 'mailpoet-') === 0) {
$this->enqueueStyle('mailpoet-plugin', [ $this->enqueueStyle('mailpoet-plugin', [
'forms', // To prevent conflict in CSS with WP forms we need to add dependency 'forms', // To prevent conflict in CSS with WP forms we need to add dependency
'buttons', 'buttons',

View File

@ -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 * 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. * 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[] */ /** @var mixed[] */
private $data = []; private $data = [];
@ -26,8 +26,7 @@ class ArrayCache extends CacheProvider
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function __construct() public function __construct() {
{
$this->upTime = time(); $this->upTime = time();
} }
@ -35,7 +34,7 @@ class ArrayCache extends CacheProvider
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function doFetch($id) { protected function doFetch($id) {
if (! $this->doContains($id)) { if (!$this->doContains($id)) {
$this->missesCount += 1; $this->missesCount += 1;
return false; return false;
} }
@ -47,7 +46,7 @@ class ArrayCache extends CacheProvider
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function doContains($id) { protected function doContains($id) {
if (! isset($this->data[$id])) { if (!isset($this->data[$id])) {
return false; return false;
} }
$expiration = $this->data[$id][1]; $expiration = $this->data[$id][1];
@ -87,10 +86,10 @@ class ArrayCache extends CacheProvider
*/ */
protected function doGetStats() { protected function doGetStats() {
return [ return [
CacheProvider::STATS_HITS => $this->hitsCount, CacheProvider::STATS_HITS => $this->hitsCount,
CacheProvider::STATS_MISSES => $this->missesCount, CacheProvider::STATS_MISSES => $this->missesCount,
CacheProvider::STATS_UPTIME => $this->upTime, CacheProvider::STATS_UPTIME => $this->upTime,
CacheProvider::STATS_MEMORY_USAGE => null, CacheProvider::STATS_MEMORY_USAGE => null,
CacheProvider::STATS_MEMORY_AVAILABLE => null, CacheProvider::STATS_MEMORY_AVAILABLE => null,
]; ];
} }

View File

@ -49,7 +49,7 @@ class CacheOnlyMappingDriver implements MappingDriver {
/** /**
* Copy pasted from MailPoetVendor\Doctrine\Persistence\Mapping\AbstractClassMetadataFactory * Copy pasted from MailPoetVendor\Doctrine\Persistence\Mapping\AbstractClassMetadataFactory
*/ */
protected function getCacheKey(string $className) : string { protected function getCacheKey(string $className): string {
return str_replace('\\', '__', $className) . $this->cacheSalt; return str_replace('\\', '__', $className) . $this->cacheSalt;
} }
} }

View File

@ -20,7 +20,10 @@ class ConfigurationFactory {
/** @var AnnotationReaderProvider */ /** @var AnnotationReaderProvider */
private $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->isDevMode = $isDevMode === null ? WP_DEBUG : $isDevMode;
$this->annotationReaderProvider = $annotationReaderProvider; $this->annotationReaderProvider = $annotationReaderProvider;
} }

View File

@ -4,12 +4,12 @@ namespace MailPoet\Doctrine;
use MailPoet\Config\Env; use MailPoet\Config\Env;
use MailPoet\Doctrine\Types\BigIntType; use MailPoet\Doctrine\Types\BigIntType;
use MailPoet\Doctrine\Types\DateTimeTzToStringType;
use MailPoet\Doctrine\Types\JsonOrSerializedType; use MailPoet\Doctrine\Types\JsonOrSerializedType;
use MailPoet\Doctrine\Types\JsonType; use MailPoet\Doctrine\Types\JsonType;
use MailPoet\Doctrine\Types\SerializedArrayType; 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\Driver\PDO\MySQL\Driver;
use MailPoetVendor\Doctrine\DBAL\DriverManager;
use MailPoetVendor\Doctrine\DBAL\Platforms\MySqlPlatform; use MailPoetVendor\Doctrine\DBAL\Platforms\MySqlPlatform;
use MailPoetVendor\Doctrine\DBAL\Types\Type; use MailPoetVendor\Doctrine\DBAL\Types\Type;
use PDO; use PDO;

View File

@ -10,7 +10,9 @@ class EmojiEncodingListener {
/** @var Emoji */ /** @var Emoji */
private $emoji; private $emoji;
public function __construct(Emoji $emoji) { public function __construct(
Emoji $emoji
) {
$this->emoji = $emoji; $this->emoji = $emoji;
} }

View File

@ -11,7 +11,9 @@ class LastSubscribedAtListener {
/** @var Carbon */ /** @var Carbon */
private $now; private $now;
public function __construct(WPFunctions $wp) { public function __construct(
WPFunctions $wp
) {
$this->now = Carbon::createFromTimestamp($wp->currentTime('timestamp')); $this->now = Carbon::createFromTimestamp($wp->currentTime('timestamp'));
} }

View File

@ -13,7 +13,9 @@ class TimestampListener {
/** @var Carbon */ /** @var Carbon */
private $now; private $now;
public function __construct(WPFunctions $wp) { public function __construct(
WPFunctions $wp
) {
$this->now = Carbon::createFromTimestamp($wp->currentTime('timestamp')); $this->now = Carbon::createFromTimestamp($wp->currentTime('timestamp'));
} }

View File

@ -10,7 +10,9 @@ class ValidationListener {
/** @var ValidatorInterface */ /** @var ValidatorInterface */
private $validator; private $validator;
public function __construct(ValidatorInterface $validator) { public function __construct(
ValidatorInterface $validator
) {
$this->validator = $validator; $this->validator = $validator;
} }

View File

@ -19,7 +19,10 @@ class MetadataCache extends CacheProvider {
/** @var string */ /** @var string */
private $directory; private $directory;
public function __construct($dir, $isReadOnly) { public function __construct(
$dir,
$isReadOnly
) {
$this->isDevMode = defined('WP_DEBUG') && WP_DEBUG && !$isReadOnly; $this->isDevMode = defined('WP_DEBUG') && WP_DEBUG && !$isReadOnly;
$this->directory = rtrim($dir, '/\\'); $this->directory = rtrim($dir, '/\\');
if (!file_exists($this->directory)) { if (!file_exists($this->directory)) {

View File

@ -15,7 +15,10 @@ class PSRCacheItem implements CacheItemInterface {
/** @var bool */ /** @var bool */
private $isHit; private $isHit;
public function __construct(string $key, bool $isHit) { public function __construct(
string $key,
bool $isHit
) {
$this->key = $key; $this->key = $key;
$this->isHit = $isHit; $this->isHit = $isHit;
} }

View File

@ -9,7 +9,10 @@ class PSRMetadataCache implements CacheItemPoolInterface {
/** @var MetadataCache */ /** @var MetadataCache */
private $metadataCache; private $metadataCache;
public function __construct(string $dir, bool $isReadOnly) { public function __construct(
string $dir,
bool $isReadOnly
) {
$this->metadataCache = new MetadataCache($dir, $isReadOnly); $this->metadataCache = new MetadataCache($dir, $isReadOnly);
} }

View File

@ -10,12 +10,11 @@ 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 * @see https://github.com/doctrine/persistence/blob/2.2.x/lib/Doctrine/Persistence/Mapping/AbstractClassMetadataFactory.php#L516-L536
*/ */
class ProxyClassNameResolver implements IProxyClassNameResolver { class ProxyClassNameResolver implements IProxyClassNameResolver {
/** /**
* @template T * @template T
* @return class-string<T> * @return class-string<T>
*/ */
public function resolveClassName(string $className) : string { public function resolveClassName(string $className): string {
$pos = \strrpos($className, '\\' . \MailPoetVendor\Doctrine\Persistence\Proxy::MARKER . '\\'); $pos = \strrpos($className, '\\' . \MailPoetVendor\Doctrine\Persistence\Proxy::MARKER . '\\');
if ($pos === \false) { if ($pos === \false) {
/** @var class-string<T> */ /** @var class-string<T> */

View File

@ -26,7 +26,9 @@ abstract class Repository {
'created_at', 'created_at',
]; ];
public function __construct(EntityManager $entityManager) { public function __construct(
EntityManager $entityManager
) {
$this->entityManager = $entityManager; $this->entityManager = $entityManager;
$this->classMetadata = $entityManager->getClassMetadata($this->getEntityClassName()); $this->classMetadata = $entityManager->getClassMetadata($this->getEntityClassName());
$this->doctrineRepository = new DoctrineEntityRepository($this->entityManager, $this->classMetadata); $this->doctrineRepository = new DoctrineEntityRepository($this->entityManager, $this->classMetadata);

View File

@ -13,7 +13,12 @@ class SerializableConnection extends Connection {
private $config; private $config;
private $eventManager; 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->params = $params;
$this->driver = $driver; $this->driver = $driver;
$this->config = $config; $this->config = $config;

View File

@ -3,8 +3,8 @@
namespace MailPoet\Doctrine\Types; namespace MailPoet\Doctrine\Types;
use MailPoetVendor\Carbon\Carbon; use MailPoetVendor\Carbon\Carbon;
use MailPoetVendor\Doctrine\DBAL\Types\DateTimeTzType;
use MailPoetVendor\Doctrine\DBAL\Platforms\AbstractPlatform; use MailPoetVendor\Doctrine\DBAL\Platforms\AbstractPlatform;
use MailPoetVendor\Doctrine\DBAL\Types\DateTimeTzType;
class DateTimeTzToStringType extends DateTimeTzType { class DateTimeTzToStringType extends DateTimeTzType {
const NAME = 'datetimetz_to_string'; const NAME = 'datetimetz_to_string';

View File

@ -12,7 +12,10 @@ class ValidationException extends \RuntimeException {
/** @var ConstraintViolationListInterface|ConstraintViolationInterface[] */ /** @var ConstraintViolationListInterface|ConstraintViolationInterface[] */
private $violations; private $violations;
public function __construct($resourceName, ConstraintViolationListInterface $violations) { public function __construct(
$resourceName,
ConstraintViolationListInterface $violations
) {
$this->resourceName = $resourceName; $this->resourceName = $resourceName;
$this->violations = $violations; $this->violations = $violations;

View File

@ -12,7 +12,9 @@ class ValidatorFactory {
/** @var AnnotationReaderProvider */ /** @var AnnotationReaderProvider */
private $annotationReaderProvider; private $annotationReaderProvider;
public function __construct(AnnotationReaderProvider $annotationReaderProvider) { public function __construct(
AnnotationReaderProvider $annotationReaderProvider
) {
$this->annotationReaderProvider = $annotationReaderProvider; $this->annotationReaderProvider = $annotationReaderProvider;
} }

View File

@ -20,7 +20,11 @@ class AssetsController {
const RECAPTCHA_API_URL = 'https://www.google.com/recaptcha/api.js?render=explicit'; 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->wp = $wp;
$this->renderer = $renderer; $this->renderer = $renderer;
$this->settings = $settings; $this->settings = $settings;

View File

@ -16,7 +16,9 @@ class DoctrinePanel implements IBarPanel {
/** @var DebugStack */ /** @var DebugStack */
private $sqlLogger; private $sqlLogger;
public function __construct(Configuration $doctrineConfiguration) { public function __construct(
Configuration $doctrineConfiguration
) {
$this->sqlLogger = new DebugStack(); $this->sqlLogger = new DebugStack();
$doctrineConfiguration->setSQLLogger($this->sqlLogger); $doctrineConfiguration->setSQLLogger($this->sqlLogger);
} }

View File

@ -14,7 +14,10 @@ class Assets extends AbstractExtension {
/** @var CdnAssetUrl|null */ /** @var CdnAssetUrl|null */
private $cdnAssetsUrl; private $cdnAssetsUrl;
public function __construct(array $globals, CdnAssetUrl $cdnAssetsUrl = null) { public function __construct(
array $globals,
CdnAssetUrl $cdnAssetsUrl = null
) {
$this->globals = $globals; $this->globals = $globals;
$this->cdnAssetsUrl = $cdnAssetsUrl; $this->cdnAssetsUrl = $cdnAssetsUrl;
} }

View File

@ -7,7 +7,7 @@ use MailPoet\Config\Env;
class Template { class Template {
public function create($wcEmailSettings) { public function create($wcEmailSettings) {
$socialIconUrl = Env::$assetsUrl . '/img/newsletter_editor/social-icons'; $socialIconUrl = Env::$assetsUrl . '/img/newsletter_editor/social-icons';
return [ return [
'content' => 'content' =>
[ [
'type' => 'container', 'type' => 'container',