Upgrade PHPStan level to 4

I had to add some ignore errors until phpstan/phpstan#1482 is resolved

[MAILPOET-1915]
This commit is contained in:
Pavel Dohnal
2019-03-20 15:04:45 +01:00
committed by M. Shull
parent 7d6f69ec1d
commit 21766421d5
11 changed files with 20 additions and 20 deletions

View File

@ -378,7 +378,7 @@ class RoboFile extends \Robo\Tasks {
'php -d memory_limit=2G '. 'php -d memory_limit=2G '.
"$dir/phpstan.phar analyse ". "$dir/phpstan.phar analyse ".
"--configuration $dir/tasks/phpstan/phpstan.neon ". "--configuration $dir/tasks/phpstan/phpstan.neon ".
'--level 3 '. '--level 4 '.
"$dir/lib" "$dir/lib"
) )
->dir(__DIR__ . '/tasks/phpstan') ->dir(__DIR__ . '/tasks/phpstan')

View File

@ -6,7 +6,7 @@ if (!defined('ABSPATH')) exit;
class RendererFactory { class RendererFactory {
/** @var Renderer */ /** @var Renderer|null */
private $renderer; private $renderer;
function getRenderer() { function getRenderer() {

View File

@ -14,7 +14,7 @@ class ContainerWrapper implements ContainerInterface {
/** @var ContainerInterface|null */ /** @var ContainerInterface|null */
private $premium_container; private $premium_container;
/** @var ContainerWrapper */ /** @var ContainerWrapper|null */
private static $instance; private static $instance;
public function __construct(ContainerInterface $free_container, ContainerInterface $premium_container = null) { public function __construct(ContainerInterface $free_container, ContainerInterface $premium_container = null) {

View File

@ -8,7 +8,7 @@ if (!defined('ABSPATH')) exit;
/** /**
* @property string $type * @property string $type
* @property string|array $params * @property string|array|null $params
*/ */
class CustomField extends Model { class CustomField extends Model {

View File

@ -148,7 +148,7 @@ class Subscriber extends Model {
} }
static function search($orm, $search = '') { static function search($orm, $search = '') {
if (strlen(trim($search) === 0)) { if (strlen(trim($search)) === 0) {
return $orm; return $orm;
} }

View File

@ -9,7 +9,7 @@ if (!defined('ABSPATH')) exit;
class Subscriber { class Subscriber {
/** /**
* @param \MailPoet\Models\Subscriber|false $subscriber * @param \MailPoet\Models\Subscriber|false|mixed $subscriber
*/ */
static function process( static function process(
$shortcode_details, $shortcode_details,

View File

@ -10,7 +10,7 @@ if (!defined('ABSPATH')) exit;
class Clicks { class Clicks {
/** /**
* @param \stdClass $data * @param \stdClass|null $data
*/ */
function track($data) { function track($data) {
if (!$data || empty($data->link)) { if (!$data || empty($data->link)) {

View File

@ -13,7 +13,7 @@ class ConfirmationEmailMailer {
const MAX_CONFIRMATION_EMAILS = 3; const MAX_CONFIRMATION_EMAILS = 3;
/** @var Mailer */ /** @var Mailer|null */
private $mailer; private $mailer;
/** @var WPFunctions */ /** @var WPFunctions */

View File

@ -16,7 +16,7 @@ class NewSubscriberNotificationMailer {
/** @var Renderer */ /** @var Renderer */
private $renderer; private $renderer;
/** @var \MailPoet\Mailer\Mailer */ /** @var \MailPoet\Mailer\Mailer|null */
private $mailer; private $mailer;
/** @var Functions */ /** @var Functions */

View File

@ -80,9 +80,7 @@ abstract class ValidModel extends \Model {
$params = explode('|', $check); $params = explode('|', $check);
$check = array_shift($params); $check = array_shift($params);
if ($this->_validator->executeOne($check, $value, $params)) { if (!$this->_validator->executeOne($check, $value, $params)) {
$success = $success && true;
} else {
$this->addValidationError($v['message'], $field); $this->addValidationError($v['message'], $field);
$success = false; $success = false;
} }

View File

@ -1,9 +1,11 @@
parameters: parameters:
tmpDir: ../../temp/phpstan tmpDir: ../../temp/phpstan
bootstrap: bootstrap.php bootstrap: bootstrap.php
ignoreErrors: ignoreErrors:
- '#Function members_register_.+ not found#' - '#Function members_register_.+ not found#'
- '#MailPoet\\Premium\\DI\\ContainerConfigurator not found#' # this class is not available when premium is not active - '#MailPoet\\Premium\\DI\\ContainerConfigurator not found#' # this class is not available when premium is not active
- '#Call to an undefined method IdiormResultSet::set()#' - '#Call to an undefined method IdiormResultSet::set()#'
- '#Argument of an invalid type pQuery\\IQuery supplied for foreach, only iterables are supported#' - '#Argument of an invalid type pQuery\\IQuery supplied for foreach, only iterables are supported#'
reportUnmatchedIgnoredErrors: false reportUnmatchedIgnoredErrors: false
dynamicConstantNames:
- WP_DEBUG