Fix "Access to undefined property" rule violations
This commit is contained in:
@ -16,6 +16,8 @@ class MP2Migrator extends APIEndpoint {
|
||||
$this->MP2Migrator = new \MailPoet\Config\MP2Migrator();
|
||||
}
|
||||
|
||||
private $MP2Migrator;
|
||||
|
||||
/**
|
||||
* Import end point
|
||||
*
|
||||
|
@ -37,6 +37,8 @@ class Menu {
|
||||
const LAST_ANNOUNCEMENT_DATE = '2018-12-18 10:00:00';
|
||||
|
||||
public $renderer;
|
||||
public $mp_api_key_valid;
|
||||
public $premium_key_valid;
|
||||
private $access_control;
|
||||
private $subscribers_over_limit;
|
||||
private $wp;
|
||||
|
@ -10,6 +10,11 @@ if(!defined('ABSPATH')) exit;
|
||||
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
||||
|
||||
class Migrator {
|
||||
|
||||
public $prefix;
|
||||
private $charset_collate;
|
||||
private $models;
|
||||
|
||||
function __construct() {
|
||||
$this->prefix = Env::$db_prefix;
|
||||
$this->charset_collate = Env::$db_charset_collate;
|
||||
|
@ -5,6 +5,11 @@ if(!defined('ABSPATH')) exit;
|
||||
|
||||
class NewsletterBlank121Column {
|
||||
|
||||
private $assets_url;
|
||||
private $external_template_image_url;
|
||||
private $template_image_url;
|
||||
private $social_icon_url;
|
||||
|
||||
function __construct($assets_url) {
|
||||
$this->assets_url = $assets_url;
|
||||
$this->external_template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/newsletter-blank-1-2-1-column';
|
||||
|
@ -5,6 +5,11 @@ if(!defined('ABSPATH')) exit;
|
||||
|
||||
class NewsletterBlank12Column {
|
||||
|
||||
private $assets_url;
|
||||
private $external_template_image_url;
|
||||
private $template_image_url;
|
||||
private $social_icon_url;
|
||||
|
||||
function __construct($assets_url) {
|
||||
$this->assets_url = $assets_url;
|
||||
$this->external_template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/newsletter-blank-1-2-column';
|
||||
|
@ -5,6 +5,11 @@ if(!defined('ABSPATH')) exit;
|
||||
|
||||
class NewsletterBlank13Column {
|
||||
|
||||
private $assets_url;
|
||||
private $external_template_image_url;
|
||||
private $template_image_url;
|
||||
private $social_icon_url;
|
||||
|
||||
function __construct($assets_url) {
|
||||
$this->assets_url = $assets_url;
|
||||
$this->external_template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/newsletter-blank-1-3-column';
|
||||
|
@ -5,6 +5,11 @@ if(!defined('ABSPATH')) exit;
|
||||
|
||||
class NewsletterBlank1Column {
|
||||
|
||||
private $assets_url;
|
||||
private $external_template_image_url;
|
||||
private $template_image_url;
|
||||
private $social_icon_url;
|
||||
|
||||
function __construct($assets_url) {
|
||||
$this->assets_url = $assets_url;
|
||||
$this->external_template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/newsletter-blank-1-column';
|
||||
|
@ -5,6 +5,11 @@ if(!defined('ABSPATH')) exit;
|
||||
|
||||
class PostNotificationsBlank1Column {
|
||||
|
||||
private $assets_url;
|
||||
private $external_template_image_url;
|
||||
private $template_image_url;
|
||||
private $social_icon_url;
|
||||
|
||||
function __construct($assets_url) {
|
||||
$this->assets_url = $assets_url;
|
||||
$this->external_template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/post-notifications-blank-1-column';
|
||||
|
@ -5,6 +5,11 @@ if(!defined('ABSPATH')) exit;
|
||||
|
||||
class SimpleText {
|
||||
|
||||
private $assets_url;
|
||||
private $external_template_image_url;
|
||||
private $template_image_url;
|
||||
private $social_icon_url;
|
||||
|
||||
function __construct($assets_url) {
|
||||
$this->assets_url = $assets_url;
|
||||
$this->external_template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/simple-text';
|
||||
|
@ -5,6 +5,11 @@ if(!defined('ABSPATH')) exit;
|
||||
|
||||
class WelcomeBlank12Column {
|
||||
|
||||
private $assets_url;
|
||||
private $external_template_image_url;
|
||||
private $template_image_url;
|
||||
private $social_icon_url;
|
||||
|
||||
function __construct($assets_url) {
|
||||
$this->assets_url = $assets_url;
|
||||
$this->external_template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/welcome-email-blank-1-2-column';
|
||||
|
@ -5,6 +5,11 @@ if(!defined('ABSPATH')) exit;
|
||||
|
||||
class WelcomeBlank1Column {
|
||||
|
||||
private $assets_url;
|
||||
private $external_template_image_url;
|
||||
private $template_image_url;
|
||||
private $social_icon_url;
|
||||
|
||||
function __construct($assets_url) {
|
||||
$this->assets_url = $assets_url;
|
||||
$this->external_template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/welcome-email-blank-1-column';
|
||||
|
@ -22,6 +22,7 @@ class SendingQueue {
|
||||
public $mailer_task;
|
||||
public $newsletter_task;
|
||||
public $timer;
|
||||
public $batch_size;
|
||||
const BATCH_SIZE = 20;
|
||||
const TASK_BATCH_SIZE = 5;
|
||||
|
||||
|
@ -66,6 +66,7 @@ class Styles {
|
||||
color:#B94A48;
|
||||
}
|
||||
EOL;
|
||||
private $stylesheet;
|
||||
|
||||
function __construct($stylesheet = null) {
|
||||
$this->stylesheet = $stylesheet;
|
||||
|
@ -18,6 +18,7 @@ class SMTP {
|
||||
public $reply_to;
|
||||
public $return_path;
|
||||
public $mailer;
|
||||
private $mailer_logger;
|
||||
const SMTP_CONNECTION_TIMEOUT = 15; // seconds
|
||||
|
||||
/** @var SMTPMapper */
|
||||
|
@ -77,6 +77,7 @@ if(!defined('ABSPATH')) exit;
|
||||
class Model extends \Sudzy\ValidModel {
|
||||
const DUPLICATE_RECORD = 23000;
|
||||
|
||||
public static $_table;
|
||||
protected $_errors;
|
||||
protected $_new_record;
|
||||
|
||||
|
@ -7,6 +7,9 @@ if(!defined('ABSPATH')) exit;
|
||||
|
||||
class PostListTransformer {
|
||||
|
||||
private $args;
|
||||
private $transformer;
|
||||
|
||||
function __construct($args) {
|
||||
$this->args = $args;
|
||||
$this->transformer = new PostTransformer($args);
|
||||
|
@ -5,6 +5,8 @@ if(!defined('ABSPATH')) exit;
|
||||
|
||||
class TitleListTransformer {
|
||||
|
||||
private $args;
|
||||
|
||||
function __construct($args) {
|
||||
$this->args = $args;
|
||||
}
|
||||
|
@ -8,6 +8,8 @@ if(!defined('ABSPATH')) exit;
|
||||
|
||||
class Transformer {
|
||||
|
||||
private $transformer;
|
||||
|
||||
function __construct($args) {
|
||||
$title_list_only = $args['displayType'] === 'titleOnly' && $args['titleFormat'] === 'ul';
|
||||
|
||||
|
@ -15,6 +15,9 @@ class Renderer {
|
||||
public $CSS_inliner;
|
||||
public $newsletter;
|
||||
public $preview;
|
||||
public $premium_activated;
|
||||
public $mss_activated;
|
||||
private $template;
|
||||
const NEWSLETTER_TEMPLATE = 'Template.html';
|
||||
const FILTER_POST_PROCESS = 'mailpoet_rendering_post_process';
|
||||
|
||||
|
@ -18,6 +18,7 @@ class ViewInBrowser {
|
||||
public $permissions = array(
|
||||
'global' => AccessControl::NO_ACCESS_RESTRICTION
|
||||
);
|
||||
private $access_control;
|
||||
|
||||
function __construct(AccessControl $access_control) {
|
||||
$this->access_control = $access_control;
|
||||
|
@ -13,6 +13,8 @@ class Router {
|
||||
public $endpoint;
|
||||
public $action;
|
||||
public $data;
|
||||
public $endpoint_action;
|
||||
public $access_control;
|
||||
/** @var ContainerInterface */
|
||||
private $container;
|
||||
const NAME = 'mailpoet_router';
|
||||
|
@ -7,7 +7,8 @@ class MailChimp {
|
||||
public $api_key;
|
||||
public $max_post_size;
|
||||
public $data_center;
|
||||
public $export_url;
|
||||
private $export_url;
|
||||
private $lists_url;
|
||||
const API_KEY_REGEX = '/[a-zA-Z0-9]{32}-[a-zA-Z0-9]{2,4}$/';
|
||||
|
||||
function __construct($api_key) {
|
||||
|
@ -10,6 +10,8 @@ class Notice {
|
||||
|
||||
private $type;
|
||||
private $message;
|
||||
private $classes;
|
||||
private $data_notice_name;
|
||||
|
||||
function __construct($type, $message, $classes = '', $data_notice_name = '') {
|
||||
$this->type = $type;
|
||||
|
@ -2,8 +2,6 @@ parameters:
|
||||
tmpDir: ../../temp/phpstan
|
||||
bootstrap: bootstrap.php
|
||||
ignoreErrors:
|
||||
- '#Access to an undefined property#' # current code suffers from this, it should be fixed & this line removed
|
||||
- '#Static call to instance method MailPoet\\Models\\Model::#'
|
||||
- '#Access to an undefined static property MailPoet\\Models\\Model::#'
|
||||
- '#Function members_register_.+ not found#'
|
||||
- '#MailPoet\\Premium\\DI\\ContainerConfigurator not found#' # this class is not available when premium is not active
|
||||
|
@ -147,12 +147,12 @@ class ViewInBrowserTest extends \MailPoetTest {
|
||||
$wp_user = wp_set_current_user(0);
|
||||
// when WP user does not have 'manage options' permission, false should be returned
|
||||
$wp_user->remove_role('administrator');
|
||||
$view_in_browser->access_control = new AccessControl();
|
||||
$view_in_browser = new ViewInBrowser(new AccessControl());
|
||||
expect($this->view_in_browser->_validateBrowserPreviewData($data))->false();
|
||||
|
||||
// when WP has 'manage options' permission, data should be returned
|
||||
$wp_user->add_role('administrator');
|
||||
$view_in_browser->access_control = new AccessControl();
|
||||
$view_in_browser = new ViewInBrowser(new AccessControl());
|
||||
expect($view_in_browser->_validateBrowserPreviewData($data))->equals($data);
|
||||
}
|
||||
|
||||
@ -168,7 +168,7 @@ class ViewInBrowserTest extends \MailPoetTest {
|
||||
);
|
||||
$data->preview = true;
|
||||
wp_set_current_user(1);
|
||||
$view_in_browser->access_control = new AccessControl();
|
||||
$view_in_browser = new ViewInBrowser(new AccessControl());
|
||||
$result = $view_in_browser->_validateBrowserPreviewData($data);
|
||||
expect($result->subscriber->id)->equals(1);
|
||||
}
|
||||
|
Reference in New Issue
Block a user