Upgrade PHPStan level to 5

[MAILPOET-1915]
This commit is contained in:
Pavel Dohnal
2019-03-20 16:16:59 +01:00
committed by M. Shull
parent 21766421d5
commit f3f769316a
9 changed files with 16 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 4 '.
'--level 5 '.
"$dir/lib"
)
->dir(__DIR__ . '/tasks/phpstan')

View File

@ -116,7 +116,7 @@ abstract class SimpleWorker {
$wp = new WPFunctions();
$date = Carbon::createFromTimestamp($wp->currentTime('timestamp'));
// Random day of the next week
$date->setISODate($date->format('o'), ((int)$date->format('W')) + 1, mt_rand(1, 7));
$date->setISODate((int)$date->format('o'), ((int)$date->format('W')) + 1, mt_rand(1, 7));
$date->startOfDay();
return $date;
}

View File

@ -8,16 +8,16 @@ use MailPoetVendor\Symfony\Component\DependencyInjection\Container;
class ContainerWrapper implements ContainerInterface {
/** @var ContainerInterface */
/** @var Container */
private $free_container;
/** @var ContainerInterface|null */
/** @var Container|null */
private $premium_container;
/** @var ContainerWrapper|null */
private static $instance;
public function __construct(ContainerInterface $free_container, ContainerInterface $premium_container = null) {
public function __construct(Container $free_container, Container $premium_container = null) {
$this->free_container = $free_container;
$this->premium_container = $premium_container;
}

View File

@ -41,12 +41,12 @@ if (!defined('ABSPATH')) exit;
* @method $this selectMany(...$values)
* @method static static selectMany(...$values)
* @method static selectManyExpr($values)
* @method $this rawJoin($table, $constraint, $table_alias, $parameters = array())
* @method $this innerJoin($table, $constraint, $table_alias=null)
* @method $this join(string $table, string $constraint, $table_alias=null)
* @method $this leftOuterJoin($table, $constraint, $table_alias=null)
* @method $this rightOuterJoin($table, $constraint, $table_alias=null)
* @method $this fullOuterJoin($table, $constraint, $table_alias=null)
* @method $this rawJoin(string $table, string|array $constraint, string $table_alias, array $parameters = array())
* @method $this innerJoin(string $table, string|array $constraint, string $table_alias=null)
* @method $this join(string $table, string|array $constraint, string $table_alias=null)
* @method $this leftOuterJoin(string $table, string|array $constraint, string $table_alias=null)
* @method $this rightOuterJoin(string $table, string|array $constraint, string $table_alias=null)
* @method $this fullOuterJoin(string $table, string|array $constraint, string $table_alias=null)
* @method $this where($column_name, $value=null)
* @method static $this where($column_name, $value=null)
* @method $this whereEqual($column_name, $value=null)

View File

@ -154,7 +154,7 @@ class Renderer {
/**
* @param string $template
* @param string $content
* @param string[] $content
* @return string|string[]|null
*/
private function injectContentIntoTemplate($template, $content) {

View File

@ -87,7 +87,7 @@ class MailChimp {
}
if (!isset($header_hash)) {
$header_hash = md5(implode(',', $header));
} elseif (md5(implode(',', $header) !== $header_hash)) {
} elseif (md5(implode(',', $header)) !== $header_hash) {
return $this->throwException('headers');
}
} else {

View File

@ -15,7 +15,7 @@ class Security {
static function generateRandomString($length = 5) {
// non-cryptographically strong random generator
return substr(
md5(uniqid(mt_rand(), true)),
md5(uniqid((string)mt_rand(), true)),
0,
min(max(5, (int)$length), 32)
);

View File

@ -10,7 +10,7 @@ class Url {
// Remove WPFunctions::get()->homeUrl() path from add_query_arg
if (isset($home_url['path'])) {
$query_args = str_replace($home_url['path'], null, $query_args);
$query_args = str_replace($home_url['path'], '', $query_args);
}
return WPFunctions::get()->homeUrl($query_args);

View File

@ -6,6 +6,7 @@ parameters:
- '#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#'
- '#Parameter \#2 \$prefix of function http_build_query expects string, null given.#'
reportUnmatchedIgnoredErrors: false
dynamicConstantNames:
- WP_DEBUG