Fix PHPStan warnings in lib
[MAILPOET-5751]
This commit is contained in:
@ -202,6 +202,7 @@ class Subscribers {
|
||||
}
|
||||
|
||||
// when global status changes to subscribed, fire subscribed hook for all subscribed segments
|
||||
/** @var SubscriberEntity $subscriber - From some reason PHPStan evaluates $subscriber->getStatus() as mixed */
|
||||
if ($subscriber->getStatus() === SubscriberEntity::STATUS_SUBSCRIBED) {
|
||||
$subscriberSegments = $subscriber->getSubscriberSegments();
|
||||
foreach ($subscriberSegments as $subscriberSegment) {
|
||||
|
@ -20,6 +20,7 @@ class AutomationTemplatesGetEndpoint extends Endpoint {
|
||||
}
|
||||
|
||||
public function handle(Request $request): Response {
|
||||
/** @var string|null $category */
|
||||
$category = $request->getParam('category');
|
||||
$templates = array_values($this->registry->getTemplates($category ? strval($category) : null));
|
||||
return new Response(array_map(function (AutomationTemplate $automation) {
|
||||
|
@ -19,7 +19,9 @@ class AutomationsDeleteEndpoint extends Endpoint {
|
||||
}
|
||||
|
||||
public function handle(Request $request): Response {
|
||||
$automationId = intval($request->getParam('id'));
|
||||
/** @var int $automationId */
|
||||
$automationId = $request->getParam('id');
|
||||
$automationId = intval($automationId);
|
||||
$this->deleteController->deleteAutomation($automationId);
|
||||
return new Response(null);
|
||||
}
|
||||
|
@ -25,7 +25,9 @@ class AutomationsDuplicateEndpoint extends Endpoint {
|
||||
}
|
||||
|
||||
public function handle(Request $request): Response {
|
||||
$automationId = intval($request->getParam('id'));
|
||||
/** @var int $automationId */
|
||||
$automationId = $request->getParam('id');
|
||||
$automationId = intval($automationId);
|
||||
$duplicate = $this->duplicateController->duplicateAutomation($automationId);
|
||||
return new Response($this->automationMapper->buildAutomation($duplicate));
|
||||
}
|
||||
|
@ -27,7 +27,9 @@ class AutomationsPutEndpoint extends Endpoint {
|
||||
|
||||
public function handle(Request $request): Response {
|
||||
$data = $request->getParams();
|
||||
$automation = $this->updateController->updateAutomation(intval($request->getParam('id')), $data);
|
||||
/** @var int $automationId */
|
||||
$automationId = $request->getParam('id');
|
||||
$automation = $this->updateController->updateAutomation(intval($automationId), $data);
|
||||
return new Response($this->automationMapper->buildAutomation($automation));
|
||||
}
|
||||
|
||||
|
@ -45,6 +45,7 @@ class AutomationRunLogStorage {
|
||||
if ($versionId !== null) {
|
||||
$whereCondition .= ' AND run.version_id = %d';
|
||||
}
|
||||
/** @var literal-string $sql */
|
||||
$sql = "SELECT count(log.id) as `count`, log.step_id FROM $logTable AS log
|
||||
JOIN $runTable AS run ON log.automation_run_id = run.id
|
||||
WHERE $whereCondition
|
||||
@ -60,7 +61,9 @@ class AutomationRunLogStorage {
|
||||
|
||||
public function getAutomationRunLog(int $id): ?AutomationRunLog {
|
||||
$table = esc_sql($this->table);
|
||||
$query = $this->wpdb->prepare("SELECT * FROM $table WHERE id = %d", $id);
|
||||
/** @var literal-string $sql */
|
||||
$sql = "SELECT * FROM $table WHERE id = %d";
|
||||
$query = $this->wpdb->prepare($sql, $id);
|
||||
|
||||
if (!is_string($query)) {
|
||||
throw InvalidStateException::create();
|
||||
@ -77,7 +80,9 @@ class AutomationRunLogStorage {
|
||||
|
||||
public function getAutomationRunLogByRunAndStepId(int $runId, string $stepId): ?AutomationRunLog {
|
||||
$table = esc_sql($this->table);
|
||||
$query = $this->wpdb->prepare("SELECT * FROM $table WHERE automation_run_id = %d AND step_id = %s", $runId, $stepId);
|
||||
/** @var literal-string $sql */
|
||||
$sql = "SELECT * FROM $table WHERE automation_run_id = %d AND step_id = %s";
|
||||
$query = $this->wpdb->prepare($sql, $runId, $stepId);
|
||||
if (!is_string($query)) {
|
||||
throw InvalidStateException::create();
|
||||
}
|
||||
@ -92,12 +97,14 @@ class AutomationRunLogStorage {
|
||||
*/
|
||||
public function getLogsForAutomationRun(int $automationRunId): array {
|
||||
$table = esc_sql($this->table);
|
||||
$query = $this->wpdb->prepare("
|
||||
/** @var literal-string $sql */
|
||||
$sql = "
|
||||
SELECT *
|
||||
FROM $table
|
||||
WHERE automation_run_id = %d
|
||||
ORDER BY id ASC
|
||||
", $automationRunId);
|
||||
";
|
||||
$query = $this->wpdb->prepare($sql, $automationRunId);
|
||||
|
||||
if (!is_string($query)) {
|
||||
throw InvalidStateException::create();
|
||||
@ -111,6 +118,7 @@ class AutomationRunLogStorage {
|
||||
|
||||
if ($results) {
|
||||
return array_map(function($data) {
|
||||
/** @var array $data - for PHPStan because it conflicts with expected callable(mixed): mixed)|null */
|
||||
return AutomationRunLog::fromArray($data);
|
||||
}, $results);
|
||||
}
|
||||
|
@ -57,12 +57,16 @@ class AutomationRunStorage {
|
||||
public function getAutomationRun(int $id): ?AutomationRun {
|
||||
$table = esc_sql($this->table);
|
||||
$subjectTable = esc_sql($this->subjectTable);
|
||||
$query = (string)$this->wpdb->prepare("SELECT * FROM $table WHERE id = %d", $id);
|
||||
/** @var literal-string $sql */
|
||||
$sql = "SELECT * FROM $table WHERE id = %d";
|
||||
$query = (string)$this->wpdb->prepare($sql, $id);
|
||||
$data = $this->wpdb->get_row($query, ARRAY_A);
|
||||
if (!is_array($data) || !$data) {
|
||||
return null;
|
||||
}
|
||||
$query = (string)$this->wpdb->prepare("SELECT * FROM $subjectTable WHERE automation_run_id = %d", $id);
|
||||
/** @var literal-string $sql */
|
||||
$sql = "SELECT * FROM $subjectTable WHERE automation_run_id = %d";
|
||||
$query = (string)$this->wpdb->prepare($sql, $id);
|
||||
$subjects = $this->wpdb->get_results($query, ARRAY_A);
|
||||
$data['subjects'] = is_array($subjects) ? $subjects : [];
|
||||
return AutomationRun::fromArray((array)$data);
|
||||
@ -75,7 +79,9 @@ class AutomationRunStorage {
|
||||
public function getAutomationRunsForAutomation(Automation $automation): array {
|
||||
$table = esc_sql($this->table);
|
||||
$subjectTable = esc_sql($this->subjectTable);
|
||||
$query = (string)$this->wpdb->prepare("SELECT * FROM $table WHERE automation_id = %d order by id", $automation->getId());
|
||||
/** @var literal-string $sql */
|
||||
$sql = "SELECT * FROM $table WHERE automation_id = %d order by id";
|
||||
$query = (string)$this->wpdb->prepare($sql, $automation->getId());
|
||||
$automationRuns = $this->wpdb->get_results($query, ARRAY_A);
|
||||
if (!is_array($automationRuns) || !$automationRuns) {
|
||||
return [];
|
||||
@ -83,6 +89,7 @@ class AutomationRunStorage {
|
||||
|
||||
$automationRunIds = array_column($automationRuns, 'id');
|
||||
|
||||
/** @var literal-string $sql */
|
||||
$sql = sprintf(
|
||||
"SELECT * FROM $subjectTable WHERE automation_run_id in (%s) order by automation_run_id, id",
|
||||
implode(
|
||||
@ -100,10 +107,12 @@ class AutomationRunStorage {
|
||||
$subjects = $this->wpdb->get_results($query, ARRAY_A);
|
||||
|
||||
return array_map(
|
||||
function(array $runData) use ($subjects): AutomationRun {
|
||||
function($runData) use ($subjects): AutomationRun {
|
||||
/** @var array $runData - PHPStan expects as array_map first parameter (callable(mixed): mixed)|null */
|
||||
$runData['subjects'] = array_values(array_filter(
|
||||
is_array($subjects) ? $subjects : [],
|
||||
function(array $subjectData) use ($runData): bool {
|
||||
function($subjectData) use ($runData): bool {
|
||||
/** @var array $subjectData - PHPStan expects as array_map first parameter (callable(mixed): mixed)|null */
|
||||
return (int)$subjectData['automation_run_id'] === (int)$runData['id'];
|
||||
}
|
||||
));
|
||||
@ -120,7 +129,7 @@ class AutomationRunStorage {
|
||||
public function getCountByAutomationAndSubject(Automation $automation, Subject $subject): int {
|
||||
$table = esc_sql($this->table);
|
||||
$subjectTable = esc_sql($this->subjectTable);
|
||||
|
||||
/** @var literal-string $sql */
|
||||
$sql = "SELECT count(DISTINCT runs.id) as count from $table as runs
|
||||
JOIN $subjectTable as subjects on runs.id = subjects.automation_run_id
|
||||
WHERE runs.automation_id = %d
|
||||
@ -137,33 +146,39 @@ class AutomationRunStorage {
|
||||
$table = esc_sql($this->table);
|
||||
|
||||
if (!count($status)) {
|
||||
$query = (string)$this->wpdb->prepare("
|
||||
/** @var literal-string $sql */
|
||||
$sql = "
|
||||
SELECT COUNT(id) as count
|
||||
FROM $table
|
||||
WHERE automation_id = %d
|
||||
", $automation->getId());
|
||||
";
|
||||
$query = (string)$this->wpdb->prepare($sql, $automation->getId());
|
||||
$result = $this->wpdb->get_col($query);
|
||||
return $result ? (int)current($result) : 0;
|
||||
}
|
||||
|
||||
$statusSql = (string)$this->wpdb->prepare(implode(',', array_fill(0, count($status), '%s')), ...$status);
|
||||
$query = (string)$this->wpdb->prepare("
|
||||
/** @var literal-string $sql */
|
||||
$sql = "
|
||||
SELECT COUNT(id) as count
|
||||
FROM $table
|
||||
WHERE automation_id = %d
|
||||
AND status IN ($statusSql)
|
||||
", $automation->getId());
|
||||
";
|
||||
$query = (string)$this->wpdb->prepare($sql, $automation->getId());
|
||||
$result = $this->wpdb->get_col($query);
|
||||
return $result ? (int)current($result) : 0;
|
||||
}
|
||||
|
||||
public function updateStatus(int $id, string $status): void {
|
||||
$table = esc_sql($this->table);
|
||||
$query = (string)$this->wpdb->prepare("
|
||||
/** @var literal-string $sql */
|
||||
$sql = "
|
||||
UPDATE $table
|
||||
SET status = %s, updated_at = current_timestamp()
|
||||
WHERE id = %d
|
||||
", $status, $id);
|
||||
";
|
||||
$query = (string)$this->wpdb->prepare($sql, $status, $id);
|
||||
$result = $this->wpdb->query($query);
|
||||
if ($result === false) {
|
||||
throw Exceptions::databaseError($this->wpdb->last_error);
|
||||
@ -172,11 +187,13 @@ class AutomationRunStorage {
|
||||
|
||||
public function updateNextStep(int $id, ?string $nextStepId): void {
|
||||
$table = esc_sql($this->table);
|
||||
$query = (string)$this->wpdb->prepare("
|
||||
/** @var literal-string $sql */
|
||||
$sql = "
|
||||
UPDATE $table
|
||||
SET next_step_id = %s, updated_at = current_timestamp()
|
||||
WHERE id = %d
|
||||
", $nextStepId, $id);
|
||||
";
|
||||
$query = (string)$this->wpdb->prepare($sql, $nextStepId, $id);
|
||||
$result = $this->wpdb->query($query);
|
||||
if ($result === false) {
|
||||
throw Exceptions::databaseError($this->wpdb->last_error);
|
||||
@ -192,6 +209,7 @@ class AutomationRunStorage {
|
||||
if ($versionId) {
|
||||
$where .= " AND version_id = %d";
|
||||
}
|
||||
/** @var literal-string $sql */
|
||||
$sql = "
|
||||
SELECT
|
||||
COUNT(id) AS `count`,
|
||||
|
@ -73,16 +73,24 @@ class AutomationStatisticsStorage {
|
||||
LEFT JOIN ($runningSubquery) r ON t.id = r.id
|
||||
", ARRAY_A);
|
||||
|
||||
/** @var array{id: int, total: int, running: int} $results */
|
||||
return array_combine(array_column($results, 'id'), $results) ?: [];
|
||||
}
|
||||
|
||||
private function getStatsQuery(array $automationIds, int $versionId = null, \DateTimeImmutable $after = null, \DateTimeImmutable $before = null, string $status = null): string {
|
||||
$table = esc_sql($this->table);
|
||||
$placeholders = implode(',', array_fill(0, count($automationIds), '%d'));
|
||||
$versionCondition = strval($versionId ? $this->wpdb->prepare('AND version_id = %d', $versionId) : '');
|
||||
$statusCondition = strval($status ? $this->wpdb->prepare('AND status = %s', $status) : '');
|
||||
$dateCondition = $after !== null && $before !== null ? strval($this->wpdb->prepare('AND created_at BETWEEN %s AND %s', $after->format('Y-m-d H:i:s'), $before->format('Y-m-d H:i:s'))) : '';
|
||||
$query = $this->wpdb->prepare("
|
||||
/** @var string $versionCondition */
|
||||
$versionCondition = $versionId ? $this->wpdb->prepare('AND version_id = %d', $versionId) : '';
|
||||
$versionCondition = strval($versionCondition);
|
||||
/** @var string $statusCondition */
|
||||
$statusCondition = $status ? $this->wpdb->prepare('AND status = %s', $status) : '';
|
||||
$statusCondition = strval($statusCondition);
|
||||
/** @var string $dateCondition */
|
||||
$dateCondition = $after !== null && $before !== null ? $this->wpdb->prepare('AND created_at BETWEEN %s AND %s', $after->format('Y-m-d H:i:s'), $before->format('Y-m-d H:i:s')) : '';
|
||||
$dateCondition = strval($dateCondition);
|
||||
/** @var literal-string $sql */
|
||||
$sql = "
|
||||
SELECT automation_id AS id, COUNT(*) AS count
|
||||
FROM $table
|
||||
WHERE automation_id IN ($placeholders)
|
||||
@ -90,7 +98,9 @@ class AutomationStatisticsStorage {
|
||||
$statusCondition
|
||||
$dateCondition
|
||||
GROUP BY automation_id
|
||||
", $automationIds);
|
||||
";
|
||||
/** @var string $query */
|
||||
$query = $this->wpdb->prepare($sql, $automationIds);
|
||||
return strval($query);
|
||||
}
|
||||
}
|
||||
|
@ -75,18 +75,18 @@ class AutomationStorage {
|
||||
*/
|
||||
public function getAutomationVersionDates(int $automationId): array {
|
||||
$versionsTable = esc_sql($this->versionsTable);
|
||||
$query = (string)$this->wpdb->prepare(
|
||||
"
|
||||
/** @var literal-string $sql */
|
||||
$sql = "
|
||||
SELECT id, created_at
|
||||
FROM $versionsTable
|
||||
WHERE automation_id = %d
|
||||
ORDER BY id DESC
|
||||
",
|
||||
$automationId
|
||||
);
|
||||
";
|
||||
$query = (string)$this->wpdb->prepare($sql, $automationId);
|
||||
$data = $this->wpdb->get_results($query, ARRAY_A);
|
||||
return is_array($data) ? array_map(
|
||||
function($row): array {
|
||||
/** @var array{id: string, created_at: string} $row */
|
||||
return [
|
||||
'id' => absint($row['id']),
|
||||
'created_at' => new \DateTimeImmutable($row['created_at']),
|
||||
@ -107,15 +107,14 @@ class AutomationStorage {
|
||||
}
|
||||
$automationsTable = esc_sql($this->automationsTable);
|
||||
$versionsTable = esc_sql($this->versionsTable);
|
||||
$query = (string)$this->wpdb->prepare(
|
||||
"
|
||||
/** @var literal-string $sql */
|
||||
$sql = "
|
||||
SELECT a.*, v.id AS version_id, v.steps
|
||||
FROM $automationsTable as a, $versionsTable as v
|
||||
WHERE v.automation_id = a.id AND v.id IN (" . implode(',', array_fill(0, count($versionIds), '%d')) . ")
|
||||
ORDER BY v.id DESC
|
||||
",
|
||||
...$versionIds
|
||||
);
|
||||
";
|
||||
$query = (string)$this->wpdb->prepare($sql, ...$versionIds);
|
||||
$data = $this->wpdb->get_results($query, ARRAY_A);
|
||||
return is_array($data) ? array_map(
|
||||
function($row): Automation {
|
||||
@ -133,17 +132,15 @@ class AutomationStorage {
|
||||
$automations = $this->getAutomationWithDifferentVersions([$versionId]);
|
||||
return $automations ? $automations[0] : null;
|
||||
}
|
||||
|
||||
$query = (string)$this->wpdb->prepare(
|
||||
"
|
||||
/** @var literal-string $sql */
|
||||
$sql = "
|
||||
SELECT a.*, v.id AS version_id, v.steps
|
||||
FROM $automationsTable as a, $versionsTable as v
|
||||
WHERE v.automation_id = a.id AND a.id = %d
|
||||
ORDER BY v.id DESC
|
||||
LIMIT 1
|
||||
",
|
||||
$automationId
|
||||
);
|
||||
";
|
||||
$query = (string)$this->wpdb->prepare($sql, $automationId);
|
||||
$data = $this->wpdb->get_row($query, ARRAY_A);
|
||||
return $data ? Automation::fromArray((array)$data) : null;
|
||||
}
|
||||
@ -154,6 +151,7 @@ class AutomationStorage {
|
||||
$versionsTable = esc_sql($this->versionsTable);
|
||||
|
||||
$statusFilter = $status ? 'AND a.status IN(' . implode(',', array_fill(0, count($status), '%s')) . ')' : '';
|
||||
/** @var literal-string $sql */
|
||||
$sql = "
|
||||
SELECT a.*, v.id AS version_id, v.steps
|
||||
FROM $automationsTable AS a
|
||||
@ -167,7 +165,8 @@ class AutomationStorage {
|
||||
|
||||
$query = $status ? (string)$this->wpdb->prepare($sql, ...$status) : $sql;
|
||||
$data = $this->wpdb->get_results($query, ARRAY_A);
|
||||
return array_map(function (array $automationData) {
|
||||
return array_map(function ($automationData) {
|
||||
/** @var array $automationData - for PHPStan because it conflicts with expected callable(mixed): mixed)|null */
|
||||
return Automation::fromArray($automationData);
|
||||
}, (array)$data);
|
||||
}
|
||||
@ -180,7 +179,8 @@ class AutomationStorage {
|
||||
$subjectTable = esc_sql($this->subjectsTable);
|
||||
|
||||
$statusFilter = $runStatus ? 'AND r.status IN(' . implode(',', array_fill(0, count($runStatus), '%s')) . ')' : '';
|
||||
$query = (string)$this->wpdb->prepare("
|
||||
/** @var literal-string $sql */
|
||||
$sql = "
|
||||
SELECT DISTINCT a.*, v.id AS version_id, v.steps
|
||||
FROM $automationsTable a
|
||||
INNER JOIN $versionsTable v ON v.automation_id = a.id
|
||||
@ -192,10 +192,12 @@ class AutomationStorage {
|
||||
AND s.hash = %s
|
||||
$statusFilter
|
||||
ORDER BY a.id DESC
|
||||
", ...array_merge([$subject->getHash()], $runStatus ?? []));
|
||||
";
|
||||
$query = (string)$this->wpdb->prepare($sql, ...array_merge([$subject->getHash()], $runStatus ?? []));
|
||||
|
||||
$data = $this->wpdb->get_results($query, ARRAY_A);
|
||||
return array_map(function (array $automationData) {
|
||||
return array_map(function ($automationData) {
|
||||
/** @var array $automationData - for PHPStan because it conflicts with expected callable(mixed): mixed)|null */
|
||||
return Automation::fromArray($automationData);
|
||||
}, (array)$data);
|
||||
}
|
||||
@ -210,16 +212,15 @@ class AutomationStorage {
|
||||
$automationsTable = esc_sql($this->automationsTable);
|
||||
$triggersTable = esc_sql($this->triggersTable);
|
||||
|
||||
$query = (string)$this->wpdb->prepare(
|
||||
"
|
||||
/** @var literal-string $sql */
|
||||
$sql = "
|
||||
SELECT DISTINCT t.trigger_key
|
||||
FROM {$automationsTable} AS a
|
||||
JOIN $triggersTable as t
|
||||
WHERE a.status = %s AND a.id = t.automation_id
|
||||
ORDER BY trigger_key DESC
|
||||
",
|
||||
Automation::STATUS_ACTIVE
|
||||
);
|
||||
";
|
||||
$query = (string)$this->wpdb->prepare($sql, Automation::STATUS_ACTIVE);
|
||||
return $this->wpdb->get_col($query);
|
||||
}
|
||||
|
||||
@ -234,8 +235,8 @@ class AutomationStorage {
|
||||
$versionsTable = esc_sql($this->versionsTable);
|
||||
$triggersTable = esc_sql($this->triggersTable);
|
||||
|
||||
$query = (string)$this->wpdb->prepare(
|
||||
"
|
||||
/** @var literal-string $sql */
|
||||
$sql = "
|
||||
SELECT a.*, v.id AS version_id, v.steps
|
||||
FROM $automationsTable AS a
|
||||
INNER JOIN $triggersTable as t ON (t.automation_id = a.id)
|
||||
@ -245,13 +246,12 @@ class AutomationStorage {
|
||||
AND v.id = (
|
||||
SELECT MAX(id) FROM $versionsTable WHERE automation_id = v.automation_id
|
||||
)
|
||||
",
|
||||
Automation::STATUS_ACTIVE,
|
||||
$triggerKey
|
||||
);
|
||||
";
|
||||
$query = (string)$this->wpdb->prepare($sql, Automation::STATUS_ACTIVE, $triggerKey);
|
||||
|
||||
$data = $this->wpdb->get_results($query, ARRAY_A);
|
||||
return array_map(function (array $automationData) {
|
||||
return array_map(function ($automationData) {
|
||||
/** @var array $automationData - for PHPStan because it conflicts with expected callable(mixed): mixed)|null */
|
||||
return Automation::fromArray($automationData);
|
||||
}, (array)$data);
|
||||
}
|
||||
@ -270,17 +270,16 @@ class AutomationStorage {
|
||||
]
|
||||
);
|
||||
// Using the phpcs:ignore because the query arguments count is dynamic and passed via an array but the code sniffer sees only one argument
|
||||
$query = (string)$this->wpdb->prepare( // phpcs:ignore WordPress.DB.PreparedSQLPlaceholders.ReplacementsWrongNumber
|
||||
"
|
||||
/** @var literal-string $sql */
|
||||
$sql = "
|
||||
SELECT count(*)
|
||||
FROM $automationsTable AS a
|
||||
INNER JOIN $triggersTable as t ON (t.automation_id = a.id) AND t.trigger_key IN ({$triggerKeysPlaceholders})
|
||||
INNER JOIN $versionsTable as v ON v.id = (SELECT MAX(id) FROM $versionsTable WHERE automation_id = a.id)
|
||||
WHERE a.status = %s
|
||||
AND v.steps LIKE %s
|
||||
",
|
||||
$queryArgs
|
||||
);
|
||||
";
|
||||
$query = (string)$this->wpdb->prepare($sql, $queryArgs);
|
||||
|
||||
return (int)$this->wpdb->get_var($query);
|
||||
}
|
||||
@ -289,17 +288,16 @@ class AutomationStorage {
|
||||
$automationRunsTable = esc_sql($this->runsTable);
|
||||
$automationRunLogsTable = esc_sql($this->wpdb->prefix . 'mailpoet_automation_run_logs');
|
||||
$automationId = $automation->getId();
|
||||
$runLogsQuery = (string)$this->wpdb->prepare(
|
||||
"
|
||||
/** @var literal-string $sql */
|
||||
$sql = "
|
||||
DELETE FROM $automationRunLogsTable
|
||||
WHERE automation_run_id IN (
|
||||
SELECT id
|
||||
FROM $automationRunsTable
|
||||
WHERE automation_id = %d
|
||||
)
|
||||
",
|
||||
$automationId
|
||||
);
|
||||
";
|
||||
$runLogsQuery = (string)$this->wpdb->prepare($sql, $automationId);
|
||||
|
||||
$logsDeleted = $this->wpdb->query($runLogsQuery);
|
||||
if ($logsDeleted === false) {
|
||||
@ -387,8 +385,10 @@ class AutomationStorage {
|
||||
// insert/update
|
||||
if ($triggerKeys) {
|
||||
$placeholders = implode(',', array_fill(0, count($triggerKeys), '(%d, %s)'));
|
||||
/** @var literal-string $sql */
|
||||
$sql = "INSERT IGNORE INTO {$triggersTable} (automation_id, trigger_key) VALUES {$placeholders}";
|
||||
$query = (string)$this->wpdb->prepare(
|
||||
"INSERT IGNORE INTO {$triggersTable} (automation_id, trigger_key) VALUES {$placeholders}",
|
||||
$sql,
|
||||
array_merge(
|
||||
...array_map(function (string $key) use ($automationId) {
|
||||
return [$automationId, $key];
|
||||
@ -404,12 +404,15 @@ class AutomationStorage {
|
||||
|
||||
// delete
|
||||
$placeholders = implode(',', array_fill(0, count($triggerKeys), '%s'));
|
||||
$query = $triggerKeys
|
||||
? (string)$this->wpdb->prepare(
|
||||
"DELETE FROM {$triggersTable} WHERE automation_id = %d AND trigger_key NOT IN ({$placeholders})",
|
||||
array_merge([$automationId], $triggerKeys)
|
||||
)
|
||||
: (string)$this->wpdb->prepare("DELETE FROM {$triggersTable} WHERE automation_id = %d", $automationId);
|
||||
if ($triggerKeys) {
|
||||
/** @var literal-string $sql */
|
||||
$sql = "DELETE FROM {$triggersTable} WHERE automation_id = %d AND trigger_key NOT IN ({$placeholders})";
|
||||
$query = (string)$this->wpdb->prepare($sql, array_merge([$automationId], $triggerKeys));
|
||||
} else {
|
||||
/** @var literal-string $sql */
|
||||
$sql = "DELETE FROM {$triggersTable} WHERE automation_id = %d";
|
||||
$query = (string)$this->wpdb->prepare($sql, $automationId);
|
||||
}
|
||||
|
||||
$result = $this->wpdb->query($query);
|
||||
if ($result === false) {
|
||||
|
@ -57,6 +57,7 @@ class ValidStepRule implements AutomationNodeVisitor {
|
||||
}
|
||||
|
||||
$key = $rule instanceof ValidStepFiltersRule ? 'filters' : 'fields';
|
||||
/** @phpstan-ignore-next-line - PHPStan detects inconsistency in merged array */
|
||||
$this->errors[$stepId][$key] = array_merge(
|
||||
$this->mapErrorCodesToErrorMessages($e->getErrors()),
|
||||
$this->errors[$stepId][$key]
|
||||
|
@ -62,6 +62,7 @@ class WordPress {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param 'ARRAY_A'|'ARRAY_N'|'OBJECT' $object
|
||||
* @return array|WP_Post|null
|
||||
*/
|
||||
public function getPost(int $id, string $object = OBJECT) {
|
||||
@ -90,6 +91,7 @@ class WordPress {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param 'ARRAY_A'|'ARRAY_N'|'OBJECT' $output
|
||||
* @return WP_Comment|array|null
|
||||
*/
|
||||
public function getComment(int $id, string $output = OBJECT) {
|
||||
@ -161,9 +163,10 @@ class WordPress {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param 'and'|'or' $operator
|
||||
* @return string[]|\WP_Taxonomy[]
|
||||
*/
|
||||
public function getTaxonomies(array $args = [], string $output = 'names', string $operator = 'AND'): array {
|
||||
public function getTaxonomies(array $args = [], string $output = 'names', string $operator = 'and'): array {
|
||||
return get_taxonomies($args, $output, $operator);
|
||||
}
|
||||
|
||||
@ -177,7 +180,7 @@ class WordPress {
|
||||
/**
|
||||
* @param int|WP_Term|object $term
|
||||
* @param string $taxonomy
|
||||
* @param string $output
|
||||
* @param 'ARRAY_A'|'ARRAY_N'|'OBJECT' $output
|
||||
* @param string $filter
|
||||
* @return WP_Term|array|WP_Error|null
|
||||
*/
|
||||
|
@ -54,6 +54,9 @@ class NumberFilter implements Filter {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float $value
|
||||
*/
|
||||
public function matches(FilterData $data, $value): bool {
|
||||
$filterValue = $data->getArgs()['value'] ?? null;
|
||||
$condition = $data->getCondition();
|
||||
@ -94,7 +97,7 @@ class NumberFilter implements Filter {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @param float|null $value
|
||||
* @param mixed $filterValue
|
||||
*/
|
||||
private function matchesBetween(string $condition, $value, $filterValue): bool {
|
||||
@ -110,6 +113,7 @@ class NumberFilter implements Filter {
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @var float $value */
|
||||
$value = floatval($value);
|
||||
$from = floatval($filterValue[0]);
|
||||
$to = floatval($filterValue[1]);
|
||||
|
@ -141,8 +141,8 @@ class SubscriberCustomFieldsFactory {
|
||||
|
||||
private function getCustomFieldValue(SubscriberPayload $payload, CustomFieldEntity $customField): ?string {
|
||||
$subscriberCustomField = $payload->getSubscriber()->getSubscriberCustomFields()->filter(
|
||||
function (SubscriberCustomFieldEntity $subscriberCustomField) use ($customField) {
|
||||
return $subscriberCustomField->getCustomField() === $customField;
|
||||
function (SubscriberCustomFieldEntity $subscriberCustomField = null) use ($customField) {
|
||||
return $subscriberCustomField && $subscriberCustomField->getCustomField() === $customField;
|
||||
}
|
||||
)->first() ?: null;
|
||||
return $subscriberCustomField ? $subscriberCustomField->getValue() : null;
|
||||
|
@ -131,7 +131,8 @@ class CustomerOrderFieldsFactory {
|
||||
$statusesPlaceholder = implode(',', array_fill(0, count($statuses), '%s'));
|
||||
|
||||
if ($this->wooCommerce->isWooCommerceCustomOrdersTableEnabled()) {
|
||||
$statement = (string)$wpdb->prepare("
|
||||
/** @var literal-string $query */
|
||||
$query = "
|
||||
SELECT o.date_created_gmt
|
||||
FROM {$wpdb->prefix}wc_orders o
|
||||
WHERE o.customer_id = %d
|
||||
@ -139,9 +140,11 @@ class CustomerOrderFieldsFactory {
|
||||
AND o.total_amount > 0
|
||||
ORDER BY o.date_created_gmt {$sorting}
|
||||
LIMIT 1
|
||||
", array_merge([$customer->get_id()], $statuses));
|
||||
";
|
||||
$statement = (string)$wpdb->prepare($query, array_merge([$customer->get_id()], $statuses));
|
||||
} else {
|
||||
$statement = (string)$wpdb->prepare("
|
||||
/** @var literal-string $query */
|
||||
$query = "
|
||||
SELECT p.post_date_gmt
|
||||
FROM {$wpdb->prefix}posts p
|
||||
LEFT JOIN {$wpdb->prefix}postmeta pm_total ON p.ID = pm_total.post_id AND pm_total.meta_key = '_order_total'
|
||||
@ -152,7 +155,8 @@ class CustomerOrderFieldsFactory {
|
||||
AND pm_total.meta_value > 0
|
||||
ORDER BY p.post_date_gmt {$sorting}
|
||||
LIMIT 1
|
||||
", array_merge($statuses, [$customer->get_id()]));
|
||||
";
|
||||
$statement = (string)$wpdb->prepare($query, array_merge($statuses, [$customer->get_id()]));
|
||||
}
|
||||
|
||||
$date = $wpdb->get_var($statement);
|
||||
@ -186,7 +190,8 @@ class CustomerOrderFieldsFactory {
|
||||
";
|
||||
}
|
||||
|
||||
$statement = (string)$wpdb->prepare("
|
||||
/** @var literal-string $query */
|
||||
$query = "
|
||||
SELECT DISTINCT tt.term_id
|
||||
FROM {$wpdb->prefix}term_taxonomy tt
|
||||
JOIN {$wpdb->prefix}woocommerce_order_items AS oi ON oi.order_id IN ($orderIdsSubquery) AND oi.order_item_type = 'line_item'
|
||||
@ -195,7 +200,8 @@ class CustomerOrderFieldsFactory {
|
||||
JOIN {$wpdb->prefix}term_relationships tr ON IF(p.post_type = 'product_variation', p.post_parent, p.ID) = tr.object_id AND tr.term_taxonomy_id = tt.term_taxonomy_id
|
||||
WHERE tt.taxonomy = %s
|
||||
ORDER BY tt.term_id ASC
|
||||
", array_merge($statuses, [$customer->get_id(), $taxonomy]));
|
||||
";
|
||||
$statement = (string)$wpdb->prepare($query, array_merge($statuses, [$customer->get_id(), $taxonomy]));
|
||||
|
||||
return array_map('intval', $wpdb->get_col($statement));
|
||||
}
|
||||
|
@ -48,6 +48,7 @@ class CustomerReviewFieldsFactory {
|
||||
*/
|
||||
private function getUniqueProductReviewCount(WC_Customer $customer): int {
|
||||
$wpdb = $this->wordPress->getWpdb();
|
||||
/** @var literal-string $sql */
|
||||
$sql = "
|
||||
SELECT COUNT(DISTINCT comment_post_ID) FROM {$wpdb->comments}
|
||||
WHERE comment_parent = 0
|
||||
@ -62,6 +63,7 @@ class CustomerReviewFieldsFactory {
|
||||
|
||||
private function getLastReviewDate(WC_Customer $customer): ?DateTimeImmutable {
|
||||
$wpdb = $this->wordPress->getWpdb();
|
||||
/** @var literal-string $sql */
|
||||
$sql = "
|
||||
SELECT comment_date FROM {$wpdb->comments}
|
||||
WHERE comment_parent = 0
|
||||
|
@ -387,6 +387,7 @@ class OrderFieldsFactory {
|
||||
);
|
||||
|
||||
return array_map(function ($product) {
|
||||
/** @var array{ID:int, post_title:string} $product */
|
||||
$id = $product['ID'];
|
||||
$title = $product['post_title'];
|
||||
return ['id' => (int)$id, 'name' => "$title (#$id)"];
|
||||
|
@ -22,12 +22,14 @@ class TermParentsLoader {
|
||||
$idsPlaceholder = implode(',', array_fill(0, count($termIds), '%s'));
|
||||
|
||||
$wpdb = $this->wordPress->getWpdb();
|
||||
$statement = (string)$wpdb->prepare("
|
||||
/** @var literal-string $query - PHPStan expects literal-string */
|
||||
$query = "
|
||||
SELECT DISTINCT tt.parent
|
||||
FROM {$wpdb->term_taxonomy} AS tt
|
||||
WHERE tt.parent != 0
|
||||
AND tt.term_id IN ($idsPlaceholder)
|
||||
", $termIds);
|
||||
";
|
||||
$statement = (string)$wpdb->prepare($query, $termIds);
|
||||
|
||||
$parentIds = array_map('intval', $wpdb->get_col($statement));
|
||||
if (count($parentIds) === 0) {
|
||||
|
@ -154,6 +154,7 @@ class Activator {
|
||||
$tablesSql = implode(
|
||||
',',
|
||||
array_map(function ($table): string {
|
||||
/** @var string $table */
|
||||
return $this->wp->escSql(strval($table));
|
||||
}, $tables)
|
||||
);
|
||||
|
@ -36,6 +36,7 @@ class Beamer extends SimpleWorker {
|
||||
$posts = $this->wp->wpRemoteRetrieveBody($response);
|
||||
if (empty($posts)) return false;
|
||||
$posts = json_decode($posts);
|
||||
/** @var \stdClass[] $posts */
|
||||
if (empty($posts) || empty($posts[0]->date)) return false;
|
||||
$this->settings->set('last_announcement_date', Carbon::createFromTimeString($posts[0]->date)->getTimestamp());
|
||||
return true;
|
||||
|
@ -49,7 +49,7 @@ class WooCommercePastOrders extends SimpleWorker {
|
||||
add_filter('posts_where', function ($where = '') use ($lastId) {
|
||||
global $wpdb;
|
||||
return $where . " AND {$wpdb->prefix}posts.ID > " . $lastId;
|
||||
}, 10, 2);
|
||||
}, 10, 1);
|
||||
|
||||
$orderIds = $this->woocommerceHelper->wcGetOrders([
|
||||
'date_completed' => '>=' . (($createdAt = $oldestClick->getCreatedAt()) ? $createdAt->format('Y-m-d H:i:s') : null),
|
||||
|
@ -648,20 +648,6 @@ class ContainerConfigurator implements IContainerConfigurator {
|
||||
return $container;
|
||||
}
|
||||
|
||||
/**
|
||||
* @phpcsSuppress SlevomatCodingStandard.Classes.UnusedPrivateElements
|
||||
*/
|
||||
private function registerPremiumService(ContainerBuilder $container, $id) {
|
||||
$container->register($id)
|
||||
->setPublic(true)
|
||||
->addArgument($id)
|
||||
->addArgument(new Reference('service_container'))
|
||||
->setFactory([
|
||||
self::class,
|
||||
'getPremiumService',
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getPremiumService($id, ContainerInterface $container = null) {
|
||||
if ($container === null) {
|
||||
return null;
|
||||
|
@ -41,6 +41,7 @@ class MetadataCache extends CacheProvider {
|
||||
|
||||
// in dev mode invalidate cache if source file has changed
|
||||
if ($fileExists && $this->isDevMode) {
|
||||
/** @var \stdClass $classMetadata */
|
||||
$classMetadata = unserialize((string)file_get_contents($filename));
|
||||
if (!isset($classMetadata->name) || (!class_exists($classMetadata->name) && !interface_exists($classMetadata->name))) {
|
||||
return false;
|
||||
|
@ -453,7 +453,8 @@ class NewsletterEntity {
|
||||
* @return int[]
|
||||
*/
|
||||
public function getSegmentIds() {
|
||||
return array_filter($this->newsletterSegments->map(function(NewsletterSegmentEntity $newsletterSegment) {
|
||||
return array_filter($this->newsletterSegments->map(function(NewsletterSegmentEntity $newsletterSegment = null) {
|
||||
if (!$newsletterSegment) return null;
|
||||
$segment = $newsletterSegment->getSegment();
|
||||
return $segment ? (int)$segment->getId() : null;
|
||||
})->toArray());
|
||||
@ -467,7 +468,8 @@ class NewsletterEntity {
|
||||
}
|
||||
|
||||
public function getOption(string $name): ?NewsletterOptionEntity {
|
||||
$option = $this->options->filter(function (NewsletterOptionEntity $option) use ($name): bool {
|
||||
$option = $this->options->filter(function (NewsletterOptionEntity $option = null) use ($name): bool {
|
||||
if (!$option) return false;
|
||||
return ($field = $option->getOptionField()) ? $field->getName() === $name : false;
|
||||
})->first();
|
||||
return $option ?: null;
|
||||
|
@ -226,7 +226,8 @@ class ScheduledTaskEntity {
|
||||
public function getSubscribersByProcessed(int $processed): array {
|
||||
$criteria = Criteria::create()
|
||||
->where(Criteria::expr()->eq('processed', $processed));
|
||||
$subscribers = $this->subscribers->matching($criteria)->map(function (ScheduledTaskSubscriberEntity $taskSubscriber): ?SubscriberEntity {
|
||||
$subscribers = $this->subscribers->matching($criteria)->map(function (ScheduledTaskSubscriberEntity $taskSubscriber = null): ?SubscriberEntity {
|
||||
if (!$taskSubscriber) return null;
|
||||
return $taskSubscriber->getSubscriber();
|
||||
});
|
||||
return array_filter($subscribers->toArray());
|
||||
|
@ -496,9 +496,10 @@ class SubscriberEntity {
|
||||
|
||||
/** * @return Collection<int, SegmentEntity> */
|
||||
public function getSegments() {
|
||||
return $this->subscriberSegments->map(function (SubscriberSegmentEntity $subscriberSegment) {
|
||||
return $this->subscriberSegments->map(function (SubscriberSegmentEntity $subscriberSegment = null) {
|
||||
if (!$subscriberSegment) return null;
|
||||
return $subscriberSegment->getSegment();
|
||||
})->filter(function ($segment) {
|
||||
})->filter(function (?SegmentEntity $segment = null) {
|
||||
return $segment !== null;
|
||||
});
|
||||
}
|
||||
@ -626,7 +627,8 @@ class SubscriberEntity {
|
||||
/** @ORM\PreFlush */
|
||||
public function cleanupSubscriberSegments(): void {
|
||||
// Delete old orphan SubscriberSegments to avoid errors on update
|
||||
$this->subscriberSegments->map(function (SubscriberSegmentEntity $subscriberSegment) {
|
||||
$this->subscriberSegments->map(function (SubscriberSegmentEntity $subscriberSegment = null) {
|
||||
if (!$subscriberSegment) return null;
|
||||
if ($subscriberSegment->getSegment() === null) {
|
||||
$this->subscriberSegments->removeElement($subscriberSegment);
|
||||
}
|
||||
|
@ -268,6 +268,7 @@ class Widget extends \WP_Widget {
|
||||
}
|
||||
|
||||
if ($formType === 'widget') {
|
||||
/** @var string $output */
|
||||
// We control the template and the data is sanitized
|
||||
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped, WordPressDotOrg.sniffs.OutputEscaping.UnescapedOutputParameter
|
||||
echo $output;
|
||||
|
@ -66,6 +66,9 @@ class Migration_20231128_120355_App extends AppMigration {
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param class-string $entityClassName
|
||||
*/
|
||||
private function getTableName(string $entityClassName): string {
|
||||
return $this->entityManager->getClassMetadata($entityClassName)->getTableName();
|
||||
}
|
||||
|
@ -85,6 +85,7 @@ class Migration_20230831_143755_Db extends DbMigration {
|
||||
}
|
||||
|
||||
$queries = [];
|
||||
/** @var array<int, array{id:int, automation_run_id:int, step_id:int, started_at:string, steps:string}> $data */
|
||||
foreach ($data as $item) {
|
||||
/** @var array $steps */
|
||||
$steps = json_decode(strval($item['steps']), true);
|
||||
|
@ -23,6 +23,9 @@ abstract class DbMigration {
|
||||
|
||||
abstract public function run(): void;
|
||||
|
||||
/**
|
||||
* @param class-string<object> $entityClass
|
||||
*/
|
||||
protected function getTableName(string $entityClass): string {
|
||||
return $this->entityManager->getClassMetadata($entityClass)->getTableName();
|
||||
}
|
||||
|
@ -467,6 +467,7 @@ class NewslettersRepository extends Repository {
|
||||
", ['ids' => $ids], ['ids' => Connection::PARAM_INT_ARRAY]);
|
||||
|
||||
// Fetch WP Posts IDs and delete them
|
||||
/** @var int[] $wpPostsIds */
|
||||
$wpPostsIds = $entityManager->createQueryBuilder()->select('n.wpPostId')
|
||||
->from(NewsletterEntity::class, 'n')
|
||||
->where('n.id IN (:ids)')
|
||||
|
@ -38,11 +38,13 @@ class AbandonedCartContent {
|
||||
// Do not display the block if not an automatic email
|
||||
return [];
|
||||
}
|
||||
$groupOption = $newsletter->getOptions()->filter(function (NewsletterOptionEntity $newsletterOption) {
|
||||
$groupOption = $newsletter->getOptions()->filter(function (NewsletterOptionEntity $newsletterOption = null) {
|
||||
if (!$newsletterOption) return false;
|
||||
$optionField = $newsletterOption->getOptionField();
|
||||
return $optionField && $optionField->getName() === 'group';
|
||||
})->first();
|
||||
$eventOption = $newsletter->getOptions()->filter(function (NewsletterOptionEntity $newsletterOption) {
|
||||
$eventOption = $newsletter->getOptions()->filter(function (NewsletterOptionEntity $newsletterOption = null) {
|
||||
if (!$newsletterOption) return false;
|
||||
$optionField = $newsletterOption->getOptionField();
|
||||
return $optionField && $optionField->getName() === 'event';
|
||||
})->first();
|
||||
|
@ -79,7 +79,7 @@ class WooCommerceBlocksIntegration {
|
||||
);
|
||||
$block = $this->wp->registerBlockTypeFromMetadata(Env::$assetsPath . '/dist/js/marketing-optin-block');
|
||||
// We need to force the script to load in the footer. register_block_type always adds the script to the header.
|
||||
if ($block instanceof \WP_Block_Type && $block->editor_script) { // phpcs:ignore Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps
|
||||
if ($block instanceof \WP_Block_Type && isset($block->editor_script) && $block->editor_script) { // phpcs:ignore Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps
|
||||
$wpScripts = $this->wp->getWpScripts();
|
||||
$wpScripts->add_data($block->editor_script, 'group', 1); // phpcs:ignore Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps
|
||||
}
|
||||
|
@ -36,6 +36,9 @@ class FilterHelper {
|
||||
return $this->getTableForEntity(SubscriberEntity::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param class-string<object> $entityClass
|
||||
*/
|
||||
public function getTableForEntity(string $entityClass): string {
|
||||
return $this->entityManager->getClassMetadata($entityClass)->getTableName();
|
||||
}
|
||||
|
@ -33,7 +33,9 @@ class WooCommerceAverageSpent implements Filter {
|
||||
$orderStatsAlias = $this->wooFilterHelper->applyOrderStatusFilter($queryBuilder);
|
||||
|
||||
if ($timeframe !== DynamicSegmentFilterData::TIMEFRAME_ALL_TIME) {
|
||||
$days = intval($filterData->getParam('days'));
|
||||
/** @var int $days */
|
||||
$days = $filterData->getParam('days');
|
||||
$days = intval($days);
|
||||
$date = Carbon::now()->subDays($days);
|
||||
$dateParam = $this->filterHelper->getUniqueParameterName('date');
|
||||
$queryBuilder
|
||||
|
@ -38,8 +38,12 @@ class WooCommerceNumberOfOrders implements Filter {
|
||||
global $wpdb;
|
||||
$subscribersTable = $this->entityManager->getClassMetadata(SubscriberEntity::class)->getTableName();
|
||||
$filterData = $filter->getFilterData();
|
||||
$type = strval($filterData->getParam('number_of_orders_type'));
|
||||
$count = intval($filterData->getParam('number_of_orders_count'));
|
||||
/** @var string $type - for PHPStan because strval() doesn't accept a value of mixed */
|
||||
$type = $filterData->getParam('number_of_orders_type');
|
||||
$type = strval($type);
|
||||
/** @var string $count - for PHPStan because intval() doesn't accept a value of mixed */
|
||||
$count = $filterData->getParam('number_of_orders_count');
|
||||
$count = intval($count);
|
||||
$isAllTime = $filterData->getParam('timeframe') === DynamicSegmentFilterData::TIMEFRAME_ALL_TIME;
|
||||
$parameterSuffix = $filter->getId() ?? Security::generateRandomString();
|
||||
$collation = $this->collationChecker->getCollateIfNeeded(
|
||||
|
@ -31,10 +31,18 @@ class WooCommerceNumberOfReviews implements Filter {
|
||||
$commentMetaTable = $this->filterHelper->getPrefixedTable('commentmeta');
|
||||
$filterData = $filter->getFilterData();
|
||||
$this->validateFilterData((array)$filterData->getData());
|
||||
$type = strval($filterData->getParam('count_type'));
|
||||
$rating = strval($filterData->getParam('rating'));
|
||||
$days = intval($filterData->getParam('days'));
|
||||
$count = intval($filterData->getParam('count'));
|
||||
/** @var string $type - for PHPStan because strval() doesn't accept a value of mixed */
|
||||
$type = $filterData->getParam('count_type');
|
||||
$type = strval($type);
|
||||
/** @var string $rating - for PHPStan because strval() doesn't accept a value of mixed */
|
||||
$rating = $filterData->getParam('rating');
|
||||
$rating = strval($rating);
|
||||
/** @var int $days - for PHPStan because intval() doesn't accept a value of mixed */
|
||||
$days = $filterData->getParam('days');
|
||||
$days = intval($days);
|
||||
/** @var int $count - for PHPStan because intval() doesn't accept a value of mixed */
|
||||
$count = $filterData->getParam('count');
|
||||
$count = intval($count);
|
||||
|
||||
$subscribersTable = $this->filterHelper->getSubscribersTable();
|
||||
$collation = $this->collationChecker->getCollateIfNeeded(
|
||||
|
@ -104,6 +104,7 @@ class SegmentSubscribersRepository {
|
||||
}
|
||||
|
||||
$statement = $this->executeQuery($queryBuilder);
|
||||
/** @var string $result */
|
||||
$result = $statement->fetchColumn();
|
||||
return (int)$result;
|
||||
}
|
||||
@ -121,6 +122,7 @@ class SegmentSubscribersRepository {
|
||||
$queryBuilder = $this->createDynamicStatisticsQueryBuilder();
|
||||
$queryBuilder = $this->filterSubscribersInDynamicSegment($queryBuilder, $segment, null);
|
||||
$statement = $this->executeQuery($queryBuilder);
|
||||
/** @var array{all:string} $result */
|
||||
$result = $statement->fetch();
|
||||
return (int)$result['all'];
|
||||
}
|
||||
|
@ -335,6 +335,7 @@ class SegmentsRepository extends Repository {
|
||||
->from($segmentFiltersTable, 'sf')
|
||||
->groupBy('sf.segment_id')
|
||||
->having('COUNT(sf.id) > 1');
|
||||
/** @var null|int $result */
|
||||
$result = $this->entityManager->getConnection()->createQueryBuilder()
|
||||
->select('count(*)')
|
||||
->from(sprintf('(%s) as subCounts', $qbInner->getSQL()))
|
||||
|
@ -329,7 +329,9 @@ class WooCommerce {
|
||||
$now = (Carbon::createFromTimestamp($this->wp->currentTime('timestamp')))->format('Y-m-d H:i:s');
|
||||
$source = Source::WOOCOMMERCE_USER;
|
||||
foreach ($emails as $email) {
|
||||
$email = strval($this->connection->quote($email));
|
||||
/** @var string $email */
|
||||
$email = $this->connection->quote($email);
|
||||
$email = strval($email);
|
||||
$subscribersValues[] = "(1, {$email}, '{$status}', '{$now}', '{$now}', '{$source}')";
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@ class API {
|
||||
|
||||
public function sendMessages($messageBody) {
|
||||
$this->curlHandle = null;
|
||||
add_action('requests-curl.before_request', [$this, 'setCurlHandle'], 10, 2);
|
||||
add_action('requests-curl.before_request', [$this, 'setCurlHandle'], 10, 1);
|
||||
add_action('requests-curl.after_request', [$this, 'logCurlInformation'], 10, 2);
|
||||
$result = $this->request(
|
||||
$this->urlMessages,
|
||||
|
@ -72,6 +72,7 @@ class StatisticsWooCommercePurchasesRepository extends Repository {
|
||||
|
||||
// The "SELECT MIN(click_id)..." sub-query is used to count each purchase only once.
|
||||
// In the data we track a purchase to multiple newsletters if clicks from multiple newsletters occurred.
|
||||
/** @var array<int, array{revenue: float|int, campaign_id:int, orders_count:int}> $data */
|
||||
$data = $this->entityManager->getConnection()->executeQuery('
|
||||
SELECT
|
||||
SUM(swp.order_price_total) AS revenue,
|
||||
|
@ -63,20 +63,30 @@ class ImportExportRepository {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param class-string<object> $className
|
||||
* @return ClassMetadata<object>
|
||||
*/
|
||||
protected function getClassMetadata(string $className): ClassMetadata {
|
||||
return $this->entityManager->getClassMetadata($className);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param class-string<object> $className
|
||||
*/
|
||||
protected function getTableName(string $className): string {
|
||||
return $this->getClassMetadata($className)->getTableName();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param class-string<object> $className
|
||||
*/
|
||||
protected function getTableColumns(string $className): array {
|
||||
return $this->getClassMetadata($className)->getColumnNames();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param class-string<object> $className
|
||||
*/
|
||||
public function insertMultiple(
|
||||
string $className,
|
||||
array $columns,
|
||||
@ -109,6 +119,9 @@ class ImportExportRepository {
|
||||
return $count;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param class-string<object> $className
|
||||
*/
|
||||
public function updateMultiple(
|
||||
string $className,
|
||||
array $columns,
|
||||
@ -218,7 +231,6 @@ class ImportExportRepository {
|
||||
private function createSubscribersQueryBuilder(int $limit, int $offset): QueryBuilder {
|
||||
$subscriberSegmentTable = $this->getTableName(SubscriberSegmentEntity::class);
|
||||
$subscriberTable = $this->getTableName(SubscriberEntity::class);
|
||||
$segmentTable = $this->getTableName(SegmentEntity::class);
|
||||
|
||||
return $this->entityManager->getConnection()->createQueryBuilder()
|
||||
->select("
|
||||
@ -278,6 +290,9 @@ class ImportExportRepository {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param class-string<object> $className
|
||||
*/
|
||||
private function getIdsByEmail(string $className, array $columns, array $data): array {
|
||||
$tableName = $this->getTableName($className);
|
||||
$emailIndex = array_search('email', $columns);
|
||||
|
@ -86,7 +86,7 @@ class SubscriberStatisticsRepository extends Repository {
|
||||
->andWhere('stats.sentAt >= :dateTime')
|
||||
->setParameter('dateTime', $startTime);
|
||||
}
|
||||
return $queryBuilder
|
||||
return (int)$queryBuilder
|
||||
->getQuery()
|
||||
->getSingleScalarResult();
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ class SubscriberIPsRepository extends Repository {
|
||||
}
|
||||
|
||||
public function getCountByIPAndCreatedAtAfterTimeInSeconds(string $ip, int $seconds): int {
|
||||
return $this->entityManager->createQueryBuilder()
|
||||
return (int)$this->entityManager->createQueryBuilder()
|
||||
->select('COUNT(sip)')
|
||||
->from(SubscriberIPEntity::class, 'sip')
|
||||
->where('sip.ip = :ip')
|
||||
|
@ -124,6 +124,7 @@ class SubscribersEmailCountsController {
|
||||
]
|
||||
);
|
||||
|
||||
/** @var array{0: array{count:int, max:int}} $subscribersInRange */
|
||||
$subscribersInRange = $result->fetchAllAssociative();
|
||||
|
||||
return [intval($subscribersInRange[0]['count']), intval($subscribersInRange[0]['max'])];
|
||||
|
@ -43,6 +43,7 @@ class RecaptchaValidator implements CaptchaValidator {
|
||||
if ($this->wp->isWpError($response)) {
|
||||
throw new ValidationError(__('Error while validating the CAPTCHA.', 'mailpoet'));
|
||||
}
|
||||
/** @var \stdClass $response */
|
||||
$response = json_decode($this->wp->wpRemoteRetrieveBody($response));
|
||||
if (empty($response->success)) {
|
||||
throw new ValidationError(__('Error while validating the CAPTCHA.', 'mailpoet'));
|
||||
|
@ -72,11 +72,13 @@ class Sending {
|
||||
SendingQueue $queue = null
|
||||
) {
|
||||
if (!$task instanceof ScheduledTask) {
|
||||
/** @var ScheduledTask $task */
|
||||
$task = ScheduledTask::create();
|
||||
$task->type = self::TASK_TYPE;
|
||||
$task->save();
|
||||
}
|
||||
if (!$queue instanceof SendingQueue) {
|
||||
/** @var SendingQueue $queue */
|
||||
$queue = SendingQueue::create();
|
||||
$queue->newsletterId = 0;
|
||||
$queue->taskId = $task->id;
|
||||
|
@ -221,6 +221,7 @@ class Functions extends AbstractExtension {
|
||||
}
|
||||
|
||||
public function getSendingFrequency() {
|
||||
/** @var string[] $args */
|
||||
$args = func_get_args();
|
||||
$value = (int)array_shift($args);
|
||||
|
||||
|
@ -25,6 +25,7 @@ class Handlebars extends AbstractExtension {
|
||||
|
||||
public function generatePartial($env, $context) {
|
||||
// get arguments (minus env & $context)
|
||||
/** @var array{0:string, 1:array|string, 2:string} $args */
|
||||
$args = array_slice(func_get_args(), 2);
|
||||
$argsCount = count($args);
|
||||
|
||||
|
@ -48,6 +48,7 @@ class I18n extends AbstractExtension {
|
||||
|
||||
public function localize() {
|
||||
$args = func_get_args();
|
||||
/** @var array $translations */
|
||||
$translations = array_shift($args);
|
||||
$output = [];
|
||||
foreach ($translations as $key => $translation) {
|
||||
@ -82,6 +83,7 @@ class I18n extends AbstractExtension {
|
||||
|
||||
public function date() {
|
||||
$args = func_get_args();
|
||||
/** @var int|null $date */
|
||||
$date = (isset($args[0])) ? $args[0] : null;
|
||||
$dateFormat = (isset($args[1])) ? $args[1] : WPFunctions::get()->getOption('date_format');
|
||||
|
||||
|
@ -24,7 +24,6 @@ class DOM {
|
||||
}
|
||||
|
||||
// Reattach cut_element and right siblings to grandparent
|
||||
/* @phpstan-ignore-next-line Because there is a wrong annotation in the library tburry/pquery */
|
||||
$grandparent = $parent->parent;
|
||||
$indexAfterParent = $parent->index() + 1;
|
||||
$right->move($grandparent, $indexAfterParent);
|
||||
|
@ -28,11 +28,11 @@ if (!class_exists('ProgressBar', false)) {
|
||||
$this->filename = Env::$tempPath . '/' . $filename;
|
||||
$this->url = Env::$tempUrl . '/' . $filename;
|
||||
$counters = $this->readProgress();
|
||||
if (isset($counters->total)) {
|
||||
$this->totalCount = $counters->total;
|
||||
if (isset($counters['total'])) {
|
||||
$this->totalCount = $counters['total'];
|
||||
}
|
||||
if (isset($counters->current)) {
|
||||
$this->currentCount = $counters->current;
|
||||
if (isset($counters['current'])) {
|
||||
$this->currentCount = $counters['current'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -56,7 +56,9 @@ if (!class_exists('ProgressBar', false)) {
|
||||
}
|
||||
$jsonContent = file_get_contents($this->filename);
|
||||
if (is_string($jsonContent)) {
|
||||
return json_decode($jsonContent);
|
||||
/** @var array $data */
|
||||
$data = json_decode($jsonContent, true);
|
||||
return $data;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ class Functions {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool|array $crop
|
||||
* @param bool|array{string, string} $crop
|
||||
*/
|
||||
public function addImageSize($name, $width = 0, $height = 0, $crop = false) {
|
||||
return add_image_size($name, $width, $height, $crop);
|
||||
@ -99,11 +99,11 @@ class Functions {
|
||||
}
|
||||
|
||||
public function addScreenOption($option, $args = []) {
|
||||
return add_screen_option($option, $args);
|
||||
add_screen_option($option, $args);
|
||||
}
|
||||
|
||||
public function addShortcode($tag, callable $callback) {
|
||||
return add_shortcode($tag, $callback);
|
||||
add_shortcode($tag, $callback);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -483,7 +483,7 @@ class Functions {
|
||||
}
|
||||
|
||||
public function statusHeader($code, $description = '') {
|
||||
return status_header($code, $description);
|
||||
status_header($code, $description);
|
||||
}
|
||||
|
||||
public function stripslashesDeep($value) {
|
||||
@ -519,7 +519,7 @@ class Functions {
|
||||
}
|
||||
|
||||
public function wpEnqueueMedia(array $args = []) {
|
||||
return wp_enqueue_media($args);
|
||||
wp_enqueue_media($args);
|
||||
}
|
||||
|
||||
public function wpEnqueueScript($handle, $src = '', array $deps = [], $ver = false, $inFooter = false) {
|
||||
@ -660,7 +660,7 @@ class Functions {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $action
|
||||
* @param 'hot_categories'|'hot_tags'|'plugin_information'|'query_plugins' $action
|
||||
* @param array|object $args
|
||||
* @return object|array|WP_Error
|
||||
*/
|
||||
@ -814,7 +814,7 @@ class Functions {
|
||||
return wp_register_script($handle, $src, $deps, $ver, $in_footer);
|
||||
}
|
||||
|
||||
public function wpSetScriptTranslations(string $handle, string $domain = 'default', string $path = null): bool {
|
||||
public function wpSetScriptTranslations(string $handle, string $domain = 'default', string $path = ''): bool {
|
||||
return wp_set_script_translations($handle, $domain, $path);
|
||||
}
|
||||
|
||||
|
@ -2,11 +2,9 @@
|
||||
|
||||
namespace MailPoet\WooCommerce;
|
||||
|
||||
use MailPoet\Entities\StatisticsUnsubscribeEntity;
|
||||
use MailPoet\Entities\SubscriberEntity;
|
||||
use MailPoet\Segments\SegmentsRepository;
|
||||
use MailPoet\Settings\SettingsController;
|
||||
use MailPoet\Statistics\Track\Unsubscribes;
|
||||
use MailPoet\Subscribers\ConfirmationEmailMailer;
|
||||
use MailPoet\Subscribers\Source;
|
||||
use MailPoet\Subscribers\SubscriberSegmentRepository;
|
||||
@ -61,9 +59,6 @@ class Subscription {
|
||||
/** @var SubscribersRepository */
|
||||
private $subscribersRepository;
|
||||
|
||||
/** @var Unsubscribes */
|
||||
private $unsubscribesTracker;
|
||||
|
||||
/** @var SegmentsRepository */
|
||||
private $segmentsRepository;
|
||||
|
||||
@ -76,7 +71,6 @@ class Subscription {
|
||||
WPFunctions $wp,
|
||||
Helper $wcHelper,
|
||||
SubscribersRepository $subscribersRepository,
|
||||
Unsubscribes $unsubscribesTracker,
|
||||
SegmentsRepository $segmentsRepository,
|
||||
SubscriberSegmentRepository $subscriberSegmentRepository
|
||||
) {
|
||||
@ -85,7 +79,6 @@ class Subscription {
|
||||
$this->wcHelper = $wcHelper;
|
||||
$this->confirmationEmailMailer = $confirmationEmailMailer;
|
||||
$this->subscribersRepository = $subscribersRepository;
|
||||
$this->unsubscribesTracker = $unsubscribesTracker;
|
||||
$this->segmentsRepository = $segmentsRepository;
|
||||
$this->subscriberSegmentRepository = $subscriberSegmentRepository;
|
||||
}
|
||||
@ -262,15 +255,4 @@ class Subscription {
|
||||
// ignore errors
|
||||
}
|
||||
}
|
||||
|
||||
private function updateSubscriberStatus(SubscriberEntity $subscriber) {
|
||||
$segmentsCount = $subscriber->getSubscriberSegments(SubscriberEntity::STATUS_SUBSCRIBED)->count();
|
||||
|
||||
if (!$segmentsCount) {
|
||||
$subscriber->setStatus(SubscriberEntity::STATUS_UNSUBSCRIBED);
|
||||
$this->subscribersRepository->persist($subscriber);
|
||||
$this->subscribersRepository->flush();
|
||||
$this->unsubscribesTracker->track((int)$subscriber->getId(), StatisticsUnsubscribeEntity::SOURCE_ORDER_CHECKOUT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ define('DB_HOST', 'localhost');
|
||||
define('DB_NAME', 'wordpress');
|
||||
define('DB_USER', 'wordpress');
|
||||
define('DB_PASSWORD', '12345');
|
||||
define('MAILPOET_PREMIUM_VERSION', '1.0.0');
|
||||
|
||||
// Define Database Tables constants
|
||||
$dbConfig = new \MailPoet\Config\Database();
|
||||
|
@ -1,17 +0,0 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
$config = [];
|
||||
$phpVersion = (int)getenv('ANALYSIS_PHP_VERSION') ?: PHP_VERSION_ID;
|
||||
$config['parameters']['phpVersion'] = $phpVersion;
|
||||
|
||||
# PHPStan gets smarter when runs on PHP8 and some type checks added because of PHP8 are reported as unnecessary when we run PHPStan on PHP7
|
||||
# see https://github.com/phpstan/phpstan/issues/4060
|
||||
if ($phpVersion < 80000) {
|
||||
$config['parameters']['ignoreErrors'][] = [
|
||||
'message' => '#^Cannot access offset \\(int\\|string\\) on array\\<string#',
|
||||
'path' => __DIR__ . '/../../lib/Features/FeatureFlagsController.php',
|
||||
'count' => 1,
|
||||
];
|
||||
}
|
||||
|
||||
return $config;
|
@ -145,6 +145,21 @@ parameters:
|
||||
count: 1
|
||||
path: ../../lib/Config/Populator.php
|
||||
|
||||
-
|
||||
message: "#^Binary operation \"\\.\" between non-falsy-string and array\\|string results in an error\\.$#"
|
||||
count: 2
|
||||
path: ../../lib/Config/Populator.php
|
||||
|
||||
-
|
||||
message: "#^Binary operation \"\\.\" between '`t1`\\.`' and array\\|string results in an error\\.$#"
|
||||
count: 2
|
||||
path: ../../lib/Config/Populator.php
|
||||
|
||||
-
|
||||
message: "#^Part \\$table \\(array\\|string\\) of encapsed string cannot be cast to string\\.$#"
|
||||
count: 2
|
||||
path: ../../lib/Config/Populator.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$args of method MailPoet\\\\WP\\\\Functions\\:\\:wpRemotePost\\(\\) expects array, mixed given\\.$#"
|
||||
count: 1
|
||||
@ -155,21 +170,11 @@ parameters:
|
||||
count: 1
|
||||
path: ../../lib/Cron/CronHelper.php
|
||||
|
||||
-
|
||||
message: "#^Expression in empty\\(\\) is not falsy\\.$#"
|
||||
count: 2
|
||||
path: ../../lib/Cron/CronWorkerRunner.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$str of function explode expects string, class\\-string\\|false given\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Cron/Daemon.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 0 on mixed\\.$#"
|
||||
count: 2
|
||||
path: ../../lib/Cron/Workers/Beamer.php
|
||||
|
||||
-
|
||||
message: "#^Method MailPoet\\\\Cron\\\\Workers\\\\SendingQueue\\\\SendingThrottlingHandler\\:\\:getMaxBatchSize\\(\\) should return int but returns mixed\\.$#"
|
||||
count: 1
|
||||
@ -270,26 +275,11 @@ parameters:
|
||||
count: 1
|
||||
path: ../../lib/Form/DisplayFormInWPContent.php
|
||||
|
||||
-
|
||||
message: "#^Cannot cast mixed to int\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Form/FormsRepository.php
|
||||
|
||||
-
|
||||
message: "#^Cannot cast mixed to int\\.$#"
|
||||
count: 2
|
||||
path: ../../lib/Form/Listing/FormListingRepository.php
|
||||
|
||||
-
|
||||
message: "#^Expression on left side of \\?\\? is not nullable\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Form/Renderer.php
|
||||
|
||||
-
|
||||
message: "#^Cannot cast mixed to int\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Listing/ListingRepository.php
|
||||
|
||||
-
|
||||
message: "#^Method MailPoet\\\\Listing\\\\ListingRepository\\:\\:getData\\(\\) should return array but returns mixed\\.$#"
|
||||
count: 1
|
||||
@ -300,16 +290,6 @@ parameters:
|
||||
count: 1
|
||||
path: ../../lib/Models/Subscriber.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#3 \\$priority of method MailPoet\\\\WP\\\\Functions\\:\\:addAction\\(\\) expects int, mixed given\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Newsletter/AutomatedLatestContent.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#3 \\$priority of method MailPoet\\\\WP\\\\Functions\\:\\:removeAction\\(\\) expects int, mixed given\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Newsletter/AutomatedLatestContent.php
|
||||
|
||||
-
|
||||
message: "#^Variable \\$terms in empty\\(\\) always exists and is not falsy\\.$#"
|
||||
count: 1
|
||||
@ -325,16 +305,6 @@ parameters:
|
||||
count: 1
|
||||
path: ../../lib/Newsletter/AutomaticEmailsRepository.php
|
||||
|
||||
-
|
||||
message: "#^Cannot cast mixed to int\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Newsletter/AutomaticEmailsRepository.php
|
||||
|
||||
-
|
||||
message: "#^Property MailPoet\\\\Newsletter\\\\Editor\\\\PostTransformer\\:\\:\\$withLayout is never read, only written\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Newsletter/Editor/PostTransformer.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$str of function strip_tags expects string, mixed given\\.$#"
|
||||
count: 1
|
||||
@ -367,7 +337,7 @@ parameters:
|
||||
|
||||
-
|
||||
message: "#^Cannot cast mixed to int\\.$#"
|
||||
count: 3
|
||||
count: 1
|
||||
path: ../../lib/Newsletter/Listing/NewsletterListingRepository.php
|
||||
|
||||
-
|
||||
@ -391,7 +361,12 @@ parameters:
|
||||
path: ../../lib/Newsletter/NewsletterSaveController.php
|
||||
|
||||
-
|
||||
message: "#^Cannot cast mixed to int\\.$#"
|
||||
message: "#^Cannot access offset string on non-empty-array\\<string, int\\>|int\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Newsletter/NewslettersRepository.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 $array of function array_sum expects array, array\\<string, int\\>|int given\\.$#"
|
||||
count: 2
|
||||
path: ../../lib/Newsletter/NewslettersRepository.php
|
||||
|
||||
@ -430,16 +405,6 @@ parameters:
|
||||
count: 1
|
||||
path: ../../lib/Newsletter/Shortcodes/Categories/Link.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#3 \\$priority of method MailPoet\\\\WP\\\\Functions\\:\\:addAction\\(\\) expects int, mixed given\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Newsletter/Shortcodes/Categories/Newsletter.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#3 \\$priority of method MailPoet\\\\WP\\\\Functions\\:\\:removeAction\\(\\) expects int, mixed given\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Newsletter/Shortcodes/Categories/Newsletter.php
|
||||
|
||||
-
|
||||
message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#"
|
||||
count: 1
|
||||
@ -457,7 +422,7 @@ parameters:
|
||||
|
||||
-
|
||||
message: "#^Cannot cast mixed to int\\.$#"
|
||||
count: 3
|
||||
count: 2
|
||||
path: ../../lib/Newsletter/Statistics/NewsletterStatisticsRepository.php
|
||||
|
||||
-
|
||||
@ -465,16 +430,6 @@ parameters:
|
||||
count: 1
|
||||
path: ../../lib/Newsletter/Statistics/NewsletterStatisticsRepository.php
|
||||
|
||||
-
|
||||
message: "#^Else branch is unreachable because previous condition is always true\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Newsletter/ViewInBrowser/ViewInBrowserRenderer.php
|
||||
|
||||
-
|
||||
message: "#^Cannot cast mixed to int\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/NewsletterTemplates/NewsletterTemplatesRepository.php
|
||||
|
||||
-
|
||||
message: "#^Method MailPoet\\\\NewsletterTemplates\\\\NewsletterTemplatesRepository\\:\\:findAllForListing\\(\\) should return array\\<MailPoet\\\\Entities\\\\NewsletterTemplateEntity\\> but returns mixed\\.$#"
|
||||
count: 1
|
||||
@ -580,21 +535,6 @@ parameters:
|
||||
count: 1
|
||||
path: ../../lib/Segments/DynamicSegments/Filters/WooCommerceTotalSpent.php
|
||||
|
||||
-
|
||||
message: "#^Cannot cast mixed to int\\.$#"
|
||||
count: 2
|
||||
path: ../../lib/Segments/SegmentListingRepository.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'all' on mixed\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Segments/SegmentSubscribersRepository.php
|
||||
|
||||
-
|
||||
message: "#^Cannot cast mixed to int\\.$#"
|
||||
count: 3
|
||||
path: ../../lib/Segments/SegmentSubscribersRepository.php
|
||||
|
||||
-
|
||||
message: "#^Method MailPoet\\\\Segments\\\\SegmentSubscribersRepository\\:\\:getSubscribersGlobalStatusStatisticsCount\\(\\) should return array but returns mixed\\.$#"
|
||||
count: 1
|
||||
@ -615,11 +555,6 @@ parameters:
|
||||
count: 1
|
||||
path: ../../lib/Segments/SegmentSubscribersRepository.php
|
||||
|
||||
-
|
||||
message: "#^Cannot cast mixed to int\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Segments/SegmentsRepository.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'id' on mixed\\.$#"
|
||||
count: 3
|
||||
@ -685,11 +620,6 @@ parameters:
|
||||
count: 1
|
||||
path: ../../lib/Settings/Hosts.php
|
||||
|
||||
-
|
||||
message: "#^Cannot cast mixed to float\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Statistics/StatisticsOpensRepository.php
|
||||
|
||||
-
|
||||
message: "#^Method MailPoet\\\\Subscribers\\\\ImportExport\\\\Import\\\\MailChimp\\:\\:getApiData\\(\\) should return array\\|null but returns mixed\\.$#"
|
||||
count: 1
|
||||
@ -710,26 +640,11 @@ parameters:
|
||||
count: 2
|
||||
path: ../../lib/Subscribers/InactiveSubscribersController.php
|
||||
|
||||
-
|
||||
message: "#^Cannot cast mixed to int\\.$#"
|
||||
count: 3
|
||||
path: ../../lib/Subscribers/Statistics/SubscriberStatisticsRepository.php
|
||||
|
||||
-
|
||||
message: "#^Method MailPoet\\\\Subscribers\\\\Statistics\\\\SubscriberStatisticsRepository\\:\\:getTotalSentCount\\(\\) should return int but returns mixed\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Subscribers/Statistics/SubscriberStatisticsRepository.php
|
||||
|
||||
-
|
||||
message: "#^Method MailPoet\\\\Subscribers\\\\SubscriberIPsRepository\\:\\:findOneByIPAndCreatedAtAfterTimeInSeconds\\(\\) should return MailPoet\\\\Entities\\\\SubscriberIPEntity\\|null but returns mixed\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Subscribers/SubscriberIPsRepository.php
|
||||
|
||||
-
|
||||
message: "#^Method MailPoet\\\\Subscribers\\\\SubscriberIPsRepository\\:\\:getCountByIPAndCreatedAtAfterTimeInSeconds\\(\\) should return int but returns mixed\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Subscribers/SubscriberIPsRepository.php
|
||||
|
||||
-
|
||||
message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#"
|
||||
count: 1
|
||||
@ -756,7 +671,7 @@ parameters:
|
||||
path: ../../lib/Subscribers/SubscribersRepository.php
|
||||
|
||||
-
|
||||
message: "#^Method MailPoet\\\\Subscribers\\\\SubscribersRepository\\:\\:findIdsOfDeletedByEmails\\(\\) should return array\\<int\\> but returns array\\<array\\<string, int\\>\\>\\.$#"
|
||||
message: "#^Method MailPoet\\\\Subscribers\\\\SubscribersRepository\\:\\:findIdsOfDeletedByEmails\\(\\) should return array\\<int\\> but returns array\\<int, array\\<string, int\\>\\>\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Subscribers/SubscribersRepository.php
|
||||
|
||||
@ -820,11 +735,6 @@ parameters:
|
||||
count: 1
|
||||
path: ../../lib/Tracy/DIPanel/DIPanel.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#3 \\$priority of method MailPoet\\\\WP\\\\Functions\\:\\:addAction\\(\\) expects int, mixed given\\.$#"
|
||||
count: 4
|
||||
path: ../../lib/Util/ConflictResolver.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$str of function explode expects string, mixed given\\.$#"
|
||||
count: 2
|
||||
@ -835,16 +745,6 @@ parameters:
|
||||
count: 1
|
||||
path: ../../lib/Util/DBCollationChecker.php
|
||||
|
||||
-
|
||||
message: "#^While loop condition is always true\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Util/DOM.php
|
||||
|
||||
-
|
||||
message: "#^Method MailPoet\\\\Util\\\\ProgressBar\\:\\:readProgress\\(\\) should return array\\|false but returns mixed\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Util/ProgressBar.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$length of function random_bytes expects int\\<1, max\\>, int given\\.$#"
|
||||
count: 1
|
||||
@ -865,11 +765,6 @@ parameters:
|
||||
count: 1
|
||||
path: ../../lib/WP/Functions.php
|
||||
|
||||
-
|
||||
message: "#^Expression on left side of \\?\\? is not nullable\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/WooCommerce/Helper.php
|
||||
|
||||
-
|
||||
message: "#^Property MailPoet\\\\Test\\\\Doctrine\\\\EventListeners\\\\TimestampEntity\\:\\:\\$id is never written, only read\\.$#"
|
||||
count: 1
|
||||
@ -900,3 +795,18 @@ parameters:
|
||||
message: "#^Function str_(\\w+) not found.$#"
|
||||
count: 4
|
||||
path: ../../lib/Automation/Integrations/Core/Filters/StringFilter.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$args of function get_comments expects array\\{author_email\\?\\: string, author_url\\?\\: string, author__in\\?\\: array\\<int\\>, author__not_in\\?\\: array\\<int\\>, comment__in\\?\\: array\\<int\\>, comment__not_in\\?\\: array\\<int\\>, count\\?\\: bool, date_query\\?\\: array, \\.\\.\\.\\}, array\\|string given\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Automation/Engine/WordPress.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$args of function get_terms expects array\\{taxonomy\\?\\: array\\<string\\>\\|string, object_ids\\?\\: array\\<int\\>\\|int, orderby\\?\\: string, order\\?\\: string, hide_empty\\?\\: bool\\|int, include\\?\\: array\\<int\\>\\|string, exclude\\?\\: array\\<int\\>\\|string, exclude_tree\\?\\: array\\<int\\>\\|string, \\.\\.\\.\\}, array\\|string given\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Automation/Engine/WordPress.php
|
||||
|
||||
-
|
||||
message: "#^Binary operation \"\\.\" between non-falsy-string and string\\|Stringable results in an error\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Doctrine/Validator/ValidationException.php
|
||||
|
@ -145,6 +145,21 @@ parameters:
|
||||
count: 1
|
||||
path: ../../lib/Config/Populator.php
|
||||
|
||||
-
|
||||
message: "#^Binary operation \"\\.\" between non-falsy-string and array\\|string results in an error\\.$#"
|
||||
count: 2
|
||||
path: ../../lib/Config/Populator.php
|
||||
|
||||
-
|
||||
message: "#^Binary operation \"\\.\" between '`t1`\\.`' and array\\|string results in an error\\.$#"
|
||||
count: 2
|
||||
path: ../../lib/Config/Populator.php
|
||||
|
||||
-
|
||||
message: "#^Part \\$table \\(array\\|string\\) of encapsed string cannot be cast to string\\.$#"
|
||||
count: 2
|
||||
path: ../../lib/Config/Populator.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$args of method MailPoet\\\\WP\\\\Functions\\:\\:wpRemotePost\\(\\) expects array, mixed given\\.$#"
|
||||
count: 1
|
||||
@ -155,21 +170,11 @@ parameters:
|
||||
count: 1
|
||||
path: ../../lib/Cron/CronHelper.php
|
||||
|
||||
-
|
||||
message: "#^Expression in empty\\(\\) is not falsy\\.$#"
|
||||
count: 2
|
||||
path: ../../lib/Cron/CronWorkerRunner.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$string of function explode expects string, class\\-string\\|false given\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Cron/Daemon.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 0 on mixed\\.$#"
|
||||
count: 2
|
||||
path: ../../lib/Cron/Workers/Beamer.php
|
||||
|
||||
-
|
||||
message: "#^Method MailPoet\\\\Cron\\\\Workers\\\\SendingQueue\\\\SendingThrottlingHandler\\:\\:getMaxBatchSize\\(\\) should return int but returns mixed\\.$#"
|
||||
count: 1
|
||||
@ -270,26 +275,11 @@ parameters:
|
||||
count: 1
|
||||
path: ../../lib/Form/DisplayFormInWPContent.php
|
||||
|
||||
-
|
||||
message: "#^Cannot cast mixed to int\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Form/FormsRepository.php
|
||||
|
||||
-
|
||||
message: "#^Cannot cast mixed to int\\.$#"
|
||||
count: 2
|
||||
path: ../../lib/Form/Listing/FormListingRepository.php
|
||||
|
||||
-
|
||||
message: "#^Expression on left side of \\?\\? is not nullable\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Form/Renderer.php
|
||||
|
||||
-
|
||||
message: "#^Cannot cast mixed to int\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Listing/ListingRepository.php
|
||||
|
||||
-
|
||||
message: "#^Method MailPoet\\\\Listing\\\\ListingRepository\\:\\:getData\\(\\) should return array but returns mixed\\.$#"
|
||||
count: 1
|
||||
@ -300,16 +290,6 @@ parameters:
|
||||
count: 1
|
||||
path: ../../lib/Models/Subscriber.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#3 \\$priority of method MailPoet\\\\WP\\\\Functions\\:\\:addAction\\(\\) expects int, mixed given\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Newsletter/AutomatedLatestContent.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#3 \\$priority of method MailPoet\\\\WP\\\\Functions\\:\\:removeAction\\(\\) expects int, mixed given\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Newsletter/AutomatedLatestContent.php
|
||||
|
||||
-
|
||||
message: "#^Variable \\$terms in empty\\(\\) always exists and is not falsy\\.$#"
|
||||
count: 1
|
||||
@ -325,16 +305,6 @@ parameters:
|
||||
count: 1
|
||||
path: ../../lib/Newsletter/AutomaticEmailsRepository.php
|
||||
|
||||
-
|
||||
message: "#^Cannot cast mixed to int\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Newsletter/AutomaticEmailsRepository.php
|
||||
|
||||
-
|
||||
message: "#^Property MailPoet\\\\Newsletter\\\\Editor\\\\PostTransformer\\:\\:\\$withLayout is never read, only written\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Newsletter/Editor/PostTransformer.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$string of function strip_tags expects string, mixed given\\.$#"
|
||||
count: 1
|
||||
@ -367,7 +337,7 @@ parameters:
|
||||
|
||||
-
|
||||
message: "#^Cannot cast mixed to int\\.$#"
|
||||
count: 3
|
||||
count: 1
|
||||
path: ../../lib/Newsletter/Listing/NewsletterListingRepository.php
|
||||
|
||||
-
|
||||
@ -390,11 +360,6 @@ parameters:
|
||||
count: 1
|
||||
path: ../../lib/Newsletter/NewsletterSaveController.php
|
||||
|
||||
-
|
||||
message: "#^Cannot cast mixed to int\\.$#"
|
||||
count: 2
|
||||
path: ../../lib/Newsletter/NewslettersRepository.php
|
||||
|
||||
-
|
||||
message: "#^Method MailPoet\\\\Newsletter\\\\Renderer\\\\Renderer\\:\\:postProcessTemplate\\(\\) should return string but returns mixed\\.$#"
|
||||
count: 1
|
||||
@ -430,16 +395,6 @@ parameters:
|
||||
count: 1
|
||||
path: ../../lib/Newsletter/Shortcodes/Categories/Link.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#3 \\$priority of method MailPoet\\\\WP\\\\Functions\\:\\:addAction\\(\\) expects int, mixed given\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Newsletter/Shortcodes/Categories/Newsletter.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#3 \\$priority of method MailPoet\\\\WP\\\\Functions\\:\\:removeAction\\(\\) expects int, mixed given\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Newsletter/Shortcodes/Categories/Newsletter.php
|
||||
|
||||
-
|
||||
message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#"
|
||||
count: 1
|
||||
@ -457,7 +412,7 @@ parameters:
|
||||
|
||||
-
|
||||
message: "#^Cannot cast mixed to int\\.$#"
|
||||
count: 3
|
||||
count: 2
|
||||
path: ../../lib/Newsletter/Statistics/NewsletterStatisticsRepository.php
|
||||
|
||||
-
|
||||
@ -465,16 +420,6 @@ parameters:
|
||||
count: 1
|
||||
path: ../../lib/Newsletter/Statistics/NewsletterStatisticsRepository.php
|
||||
|
||||
-
|
||||
message: "#^Else branch is unreachable because previous condition is always true\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Newsletter/ViewInBrowser/ViewInBrowserRenderer.php
|
||||
|
||||
-
|
||||
message: "#^Cannot cast mixed to int\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/NewsletterTemplates/NewsletterTemplatesRepository.php
|
||||
|
||||
-
|
||||
message: "#^Method MailPoet\\\\NewsletterTemplates\\\\NewsletterTemplatesRepository\\:\\:findAllForListing\\(\\) should return array\\<MailPoet\\\\Entities\\\\NewsletterTemplateEntity\\> but returns mixed\\.$#"
|
||||
count: 1
|
||||
@ -580,21 +525,6 @@ parameters:
|
||||
count: 1
|
||||
path: ../../lib/Segments/DynamicSegments/Filters/WooCommerceTotalSpent.php
|
||||
|
||||
-
|
||||
message: "#^Cannot cast mixed to int\\.$#"
|
||||
count: 2
|
||||
path: ../../lib/Segments/SegmentListingRepository.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'all' on mixed\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Segments/SegmentSubscribersRepository.php
|
||||
|
||||
-
|
||||
message: "#^Cannot cast mixed to int\\.$#"
|
||||
count: 3
|
||||
path: ../../lib/Segments/SegmentSubscribersRepository.php
|
||||
|
||||
-
|
||||
message: "#^Method MailPoet\\\\Segments\\\\SegmentSubscribersRepository\\:\\:getSubscribersGlobalStatusStatisticsCount\\(\\) should return array but returns mixed\\.$#"
|
||||
count: 1
|
||||
@ -615,11 +545,6 @@ parameters:
|
||||
count: 1
|
||||
path: ../../lib/Segments/SegmentSubscribersRepository.php
|
||||
|
||||
-
|
||||
message: "#^Cannot cast mixed to int\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Segments/SegmentsRepository.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'id' on mixed\\.$#"
|
||||
count: 3
|
||||
@ -685,11 +610,6 @@ parameters:
|
||||
count: 1
|
||||
path: ../../lib/Settings/Hosts.php
|
||||
|
||||
-
|
||||
message: "#^Cannot cast mixed to float\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Statistics/StatisticsOpensRepository.php
|
||||
|
||||
-
|
||||
message: "#^Method MailPoet\\\\Subscribers\\\\ImportExport\\\\Import\\\\MailChimp\\:\\:getApiData\\(\\) should return array\\|null but returns mixed\\.$#"
|
||||
count: 1
|
||||
@ -710,26 +630,11 @@ parameters:
|
||||
count: 2
|
||||
path: ../../lib/Subscribers/InactiveSubscribersController.php
|
||||
|
||||
-
|
||||
message: "#^Cannot cast mixed to int\\.$#"
|
||||
count: 3
|
||||
path: ../../lib/Subscribers/Statistics/SubscriberStatisticsRepository.php
|
||||
|
||||
-
|
||||
message: "#^Method MailPoet\\\\Subscribers\\\\Statistics\\\\SubscriberStatisticsRepository\\:\\:getTotalSentCount\\(\\) should return int but returns mixed\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Subscribers/Statistics/SubscriberStatisticsRepository.php
|
||||
|
||||
-
|
||||
message: "#^Method MailPoet\\\\Subscribers\\\\SubscriberIPsRepository\\:\\:findOneByIPAndCreatedAtAfterTimeInSeconds\\(\\) should return MailPoet\\\\Entities\\\\SubscriberIPEntity\\|null but returns mixed\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Subscribers/SubscriberIPsRepository.php
|
||||
|
||||
-
|
||||
message: "#^Method MailPoet\\\\Subscribers\\\\SubscriberIPsRepository\\:\\:getCountByIPAndCreatedAtAfterTimeInSeconds\\(\\) should return int but returns mixed\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Subscribers/SubscriberIPsRepository.php
|
||||
|
||||
-
|
||||
message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#"
|
||||
count: 1
|
||||
@ -756,7 +661,7 @@ parameters:
|
||||
path: ../../lib/Subscribers/SubscribersRepository.php
|
||||
|
||||
-
|
||||
message: "#^Method MailPoet\\\\Subscribers\\\\SubscribersRepository\\:\\:findIdsOfDeletedByEmails\\(\\) should return array\\<int\\> but returns array\\<array\\<string, int\\>\\>\\.$#"
|
||||
message: "#^Method MailPoet\\\\Subscribers\\\\SubscribersRepository\\:\\:findIdsOfDeletedByEmails\\(\\) should return array\\<int\\> but returns array\\<int, array\\<string, int\\>\\>\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Subscribers/SubscribersRepository.php
|
||||
|
||||
@ -825,11 +730,6 @@ parameters:
|
||||
count: 1
|
||||
path: ../../lib/Tracy/DIPanel/DIPanel.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#3 \\$priority of method MailPoet\\\\WP\\\\Functions\\:\\:addAction\\(\\) expects int, mixed given\\.$#"
|
||||
count: 4
|
||||
path: ../../lib/Util/ConflictResolver.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$string of function explode expects string, mixed given\\.$#"
|
||||
count: 2
|
||||
@ -840,16 +740,6 @@ parameters:
|
||||
count: 1
|
||||
path: ../../lib/Util/DBCollationChecker.php
|
||||
|
||||
-
|
||||
message: "#^While loop condition is always true\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Util/DOM.php
|
||||
|
||||
-
|
||||
message: "#^Method MailPoet\\\\Util\\\\ProgressBar\\:\\:readProgress\\(\\) should return array\\|false but returns mixed\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Util/ProgressBar.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$length of function random_bytes expects int\\<1, max\\>, int given\\.$#"
|
||||
count: 1
|
||||
@ -870,11 +760,6 @@ parameters:
|
||||
count: 1
|
||||
path: ../../lib/WP/Functions.php
|
||||
|
||||
-
|
||||
message: "#^Expression on left side of \\?\\? is not nullable\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/WooCommerce/Helper.php
|
||||
|
||||
-
|
||||
message: "#^Property MailPoet\\\\Test\\\\Doctrine\\\\EventListeners\\\\TimestampEntity\\:\\:\\$id is never written, only read\\.$#"
|
||||
count: 1
|
||||
@ -899,3 +784,23 @@ parameters:
|
||||
message: "#^Method MailPoet\\\\Newsletter\\\\NewslettersRepository\\:\\:getStandardNewsletterList\\(\\) should return array\\<MailPoet\\\\Entities\\\\NewsletterEntity\\> but returns mixed\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Newsletter/NewslettersRepository.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset string on non-empty-array\\<string, int\\>|int\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Newsletter/NewslettersRepository.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 $array of function array_sum expects array, array\\<string, int\\>|int given\\.$#"
|
||||
count: 2
|
||||
path: ../../lib/Newsletter/NewslettersRepository.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$args of function get_comments expects array\\{author_email\\?\\: string, author_url\\?\\: string, author__in\\?\\: array\\<int\\>, author__not_in\\?\\: array\\<int\\>, comment__in\\?\\: array\\<int\\>, comment__not_in\\?\\: array\\<int\\>, count\\?\\: bool, date_query\\?\\: array, \\.\\.\\.\\}, array\\|string given\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Automation/Engine/WordPress.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$args of function get_terms expects array\\{taxonomy\\?\\: array\\<string\\>\\|string, object_ids\\?\\: array\\<int\\>\\|int, orderby\\?\\: string, order\\?\\: string, hide_empty\\?\\: bool\\|int, include\\?\\: array\\<int\\>\\|string, exclude\\?\\: array\\<int\\>\\|string, exclude_tree\\?\\: array\\<int\\>\\|string, \\.\\.\\.\\}, array\\|string given\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/Automation/Engine/WordPress.php
|
||||
|
@ -28,7 +28,6 @@ parameters:
|
||||
maximumNumberOfProcesses: 4
|
||||
ignoreErrors:
|
||||
- '#Function members_register_.+ not found#'
|
||||
- '#Call to an undefined method MailPoetVendor\\Idiorm\\IdiormResultSet::set\(\)#'
|
||||
- '#Argument of an invalid type MailPoetVendor\\pQuery\\IQuery supplied for foreach, only iterables are supported#'
|
||||
|
||||
# exclude level 6 errors (but keep them for Automation)
|
||||
@ -92,11 +91,6 @@ parameters:
|
||||
message: '/function add_(sub)?menu_page expects callable\(\): mixed, ''''\|\(callable\(\): mixed\) given/'
|
||||
count: 2
|
||||
path: ../../lib/WP/Functions.php
|
||||
-
|
||||
# WP Stubs contain incorrect definition form apply_filters: apply_filters( string $tag, array $args )
|
||||
message: "#^Function apply_filters invoked with 3 parameters, 2 required\\.$#"
|
||||
count: 1
|
||||
path: ../../lib/EmailEditor/Engine/Renderer/Renderer.php
|
||||
|
||||
reportUnmatchedIgnoredErrors: true
|
||||
dynamicConstantNames:
|
||||
@ -104,6 +98,7 @@ parameters:
|
||||
- MAILPOET_PREMIUM_VERSION
|
||||
doctrine:
|
||||
objectManagerLoader: create-entity-manager.php
|
||||
allowNullablePropertyForRequiredField: false
|
||||
|
||||
# exclude level 6 errors
|
||||
checkMissingIterableValueType: false
|
||||
@ -112,6 +107,7 @@ parameters:
|
||||
excludePaths:
|
||||
analyseAndScan:
|
||||
- ../../lib/Config/PopulatorData/Templates # analysis of templates is extremely slow, let's skip them for now
|
||||
- ../../lib/Models # Old models are deprecated and will be removed soon
|
||||
- ../../tests/_support/_generated
|
||||
- ../../tests/integration/Models # Old models are deprecated and will be removed soon
|
||||
- ../../tests/unit/Entities/SubscriberEntityTest.php
|
||||
@ -122,5 +118,4 @@ includes:
|
||||
- vendor/phpstan/phpstan-phpunit/extension.neon
|
||||
- vendor/phpstan/phpstan-doctrine/rules.neon
|
||||
- vendor/szepeviktor/phpstan-wordpress/extension.neon
|
||||
- php-version-dependent-config.php # PHP version detection + configuraton dependent on PHP version
|
||||
- phpstan-baseline-fix-lib.php # include baseline files
|
||||
|
Reference in New Issue
Block a user