Fix easy errors found by PHPStan

[MAILPOET-2588]
This commit is contained in:
Jan Jakeš
2019-12-19 14:19:09 +01:00
committed by amine-mp
parent 27a842b037
commit 25fe3aba54
9 changed files with 12 additions and 6 deletions

View File

@ -27,13 +27,14 @@ class Analytics {
$this->wp = new WPFunctions; $this->wp = new WPFunctions;
} }
/** @return array */ /** @return array|null */
function generateAnalytics() { function generateAnalytics() {
if ($this->shouldSend()) { if ($this->shouldSend()) {
$data = $this->wp->applyFilters(self::ANALYTICS_FILTER, $this->reporter->getData()); $data = $this->wp->applyFilters(self::ANALYTICS_FILTER, $this->reporter->getData());
$this->recordDataSent(); $this->recordDataSent();
return $data; return $data;
} }
return null;
} }
/** @return boolean */ /** @return boolean */

View File

@ -770,7 +770,7 @@ class MP2Migrator {
* Import a subscriber custom field * Import a subscriber custom field
* *
* @param int $subscriber_id Subscriber ID * @param int $subscriber_id Subscriber ID
* @param int $custom_field Custom field * @param array $custom_field Custom field
* @param string $custom_field_value Custom field value * @param string $custom_field_value Custom field value
* @return SubscriberCustomField * @return SubscriberCustomField
*/ */

View File

@ -60,10 +60,12 @@ class MetadataCache extends CacheProvider {
if ($result === false) { if ($result === false) {
throw new \RuntimeException("Error while writing to '$filename'"); throw new \RuntimeException("Error while writing to '$filename'");
} }
return true;
} }
protected function doDelete($id) { protected function doDelete($id) {
@unlink($this->getFilename($id)); @unlink($this->getFilename($id));
return true;
} }
protected function doFlush() { protected function doFlush() {
@ -72,6 +74,7 @@ class MetadataCache extends CacheProvider {
@unlink($filename); @unlink($filename);
} }
} }
return true;
} }
protected function doGetStats() { protected function doGetStats() {

View File

@ -342,8 +342,8 @@ class NewsletterEntity {
} }
} catch (EntityNotFoundException $enf) { } catch (EntityNotFoundException $enf) {
$this->setParent(null); $this->setParent(null);
return null;
} }
return null;
} }
/** /**

View File

@ -126,6 +126,7 @@ class ScheduledTask extends Model {
ORM::get_db()->rollBack(); ORM::get_db()->rollBack();
throw $error; throw $error;
} }
return null;
} }
function rescheduleProgressively() { function rescheduleProgressively() {

View File

@ -89,6 +89,7 @@ class Subscriber extends Model {
SubscriberCustomField::deleteSubscriberRelations($this); SubscriberCustomField::deleteSubscriberRelations($this);
return parent::delete(); return parent::delete();
} }
return null;
} }
function trash() { function trash() {

View File

@ -42,7 +42,7 @@ class ApiPanel implements IBarPanel {
} }
static function init($endpoint, $request_method, $request_data) { static function init($endpoint, $request_method, $request_data) {
Debugger::getBar()->addPanel(new static($endpoint, $request_method, $request_data)); Debugger::getBar()->addPanel(new ApiPanel($endpoint, $request_method, $request_data));
} }
private function getEndpointName() { private function getEndpointName() {

View File

@ -38,7 +38,7 @@ class DIPanel implements IBarPanel {
} }
static function init() { static function init() {
Debugger::getBar()->addPanel(new static()); Debugger::getBar()->addPanel(new DIPanel());
} }
private function loadServices() { private function loadServices() {

View File

@ -41,7 +41,7 @@ class DoctrinePanel implements IBarPanel {
} }
static function init(EntityManagerInterface $entity_manager) { static function init(EntityManagerInterface $entity_manager) {
Debugger::getBar()->addPanel(new static($entity_manager->getConnection()->getConfiguration())); Debugger::getBar()->addPanel(new DoctrinePanel($entity_manager->getConnection()->getConfiguration()));
} }
protected function formatSql($sql) { protected function formatSql($sql) {