Upgrade PHPStan level to 3

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

View File

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

View File

@ -486,7 +486,7 @@ class MP2Migrator {
*
* @param string $name Parameter name
* @param array $params MP2 parameters
* @return string serialized MP3 custom field params
* @return array serialized MP3 custom field params
*/
private function mapCustomFieldParams($name, $params) {
if (!isset($params['label'])) {

View File

@ -102,7 +102,7 @@ if (!defined('ABSPATH')) exit;
* @method static static filter(...$args)
* @method $this hasMany($associated_class_name, $foreign_key_name=null, $foreign_key_name_in_current_models_table=null, $connection_name=null)
* @method $this hasManyThrough($associated_class_name, $join_class_name=null, $key_to_base_table=null, $key_to_associated_table=null, $key_in_base_table=null, $key_in_associated_table=null, $connection_name=null)
* @method $this hasOne($associated_class_name, $foreign_key_name=null, $foreign_key_name_in_current_models_table=null, $connection_name=null)
* @method mixed hasOne($associated_class_name, $foreign_key_name=null, $foreign_key_name_in_current_models_table=null, $connection_name=null)
* @method $this|bool create($data=null)
* @method static $this|bool create($data=null)
* @method int count()
@ -139,7 +139,7 @@ class Model extends \Sudzy\ValidModel {
* given, it's used to transform `$data` before creating the new row.
*
* @param array $data
* @param boolean $keys
* @param array|boolean $keys
* @param callable|bool $onCreate
* @return self
*/

View File

@ -15,7 +15,7 @@ if (!defined('ABSPATH')) exit;
/**
* @property int $id
* @property string $type
* @property object $queue
* @property object|boolean $queue
* @property string $hash
* @property string $status
* @property string|object $meta

View File

@ -8,13 +8,14 @@ if (!defined('ABSPATH')) exit;
* @property int $queue_id
* @property string $url
* @property string $hash
* @property int|null $clicksCount
*/
class NewsletterLink extends Model {
public static $_table = MP_NEWSLETTER_LINKS_TABLE;
/**
* @param Newsletter $newsletter
* @return \stdClass|null
* @return NewsletterLink|null
*/
static function findTopLinkForNewsletter(Newsletter $newsletter) {
$link = self::selectExpr('links.*')

View File

@ -11,7 +11,7 @@ if (!defined('ABSPATH')) exit;
* @property string|null $status
* @property string|null $type
* @property int $priority
* @property string $scheduled_at
* @property string|null $scheduled_at
*/
class ScheduledTask extends Model {
public static $_table = MP_SCHEDULED_TASKS_TABLE;
@ -41,11 +41,12 @@ class ScheduledTask extends Model {
/** @return StatsNotification */
function statsNotification() {
return $this->hasOne(
$model = $this->hasOne(
StatsNotification::class,
'task_id',
'id'
);
return $model;
}
function pause() {

View File

@ -76,9 +76,7 @@ class Subscriber extends Model {
function delete() {
// WP Users cannot be deleted
if ($this->isWPUser() || $this->isWooCommerceUser()) {
return false;
} else {
if (!$this->isWPUser() && !$this->isWooCommerceUser()) {
// delete all relations to segments
SubscriberSegment::deleteSubscriptions($this);
// delete all relations to custom fields

View File

@ -13,7 +13,7 @@ if (!defined('ABSPATH')) exit;
/**
* A facade class containing all necessary models to work with a sending queue
* @property string $status
* @property string|null $status
* @property int $task_id
* @property int $id
*/

View File

@ -62,7 +62,7 @@ class Engine
}
/**
* @return string The list of usable validator methods
* @return array<int, int|string> The list of usable validator methods
*/
public function getValidators()
{

View File

@ -11,11 +11,12 @@ class pQuery extends \pQuery {
}
class Html5Parser extends \pQuery\HtmlParser {
var $root = 'MailPoet\Util\pQuery\DomNode';
/** @var string|\pQuery\DomNode */
public $root = 'MailPoet\Util\pQuery\DomNode';
}
class DomNode extends \pQuery\DomNode {
var $childClass = 'MailPoet\Util\pQuery\DomNode';
public $childClass = 'MailPoet\Util\pQuery\DomNode';
function getInnerText() {
return html_entity_decode($this->toString(true, true, 1), ENT_NOQUOTES, 'UTF-8');

View File

@ -5,4 +5,5 @@ parameters:
- '#Function members_register_.+ not found#'
- '#MailPoet\\Premium\\DI\\ContainerConfigurator not found#' # this class is not available when premium is not active
- '#Call to an undefined method IdiormResultSet::set()#'
- '#Argument of an invalid type pQuery\\IQuery supplied for foreach, only iterables are supported#'
reportUnmatchedIgnoredErrors: false