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;
}
/** @return array */
/** @return array|null */
function generateAnalytics() {
if ($this->shouldSend()) {
$data = $this->wp->applyFilters(self::ANALYTICS_FILTER, $this->reporter->getData());
$this->recordDataSent();
return $data;
}
return null;
}
/** @return boolean */

View File

@ -770,7 +770,7 @@ class MP2Migrator {
* Import a subscriber custom field
*
* @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
* @return SubscriberCustomField
*/

View File

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

View File

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

View File

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

View File

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

View File

@ -42,7 +42,7 @@ class ApiPanel implements IBarPanel {
}
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() {

View File

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

View File

@ -41,7 +41,7 @@ class DoctrinePanel implements IBarPanel {
}
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) {