diff --git a/ErrorHandlerTrait.php b/ErrorHandlerTrait.php index f71ac57..07de383 100644 --- a/ErrorHandlerTrait.php +++ b/ErrorHandlerTrait.php @@ -24,6 +24,9 @@ trait ErrorHandlerTrait */ public $payloadDataCallback; + /** + * @return void + */ public function logException($exception) { $this->logExceptionRollbar($exception); @@ -51,7 +54,7 @@ private function getPayloadData($exception) return $payloadData; } - private function payloadCallback() + private function payloadCallback(): array|null { if (!isset($this->payloadDataCallback)) { return null; @@ -70,6 +73,9 @@ private function payloadCallback() return $payloadData; } + /** + * @return void + */ protected function logExceptionRollbar($exception) { foreach (Yii::$app->get($this->rollbarComponentName)->ignoreExceptions as $ignoreRecord) { diff --git a/composer.json b/composer.json index 223c461..f102ab2 100644 --- a/composer.json +++ b/composer.json @@ -12,13 +12,23 @@ } ], "require": { - "php": ">=7.1", - "yiisoft/yii2": "^2.0.15", - "rollbar/rollbar": "^2.1" + "php": ">=8.0", + "yiisoft/yii2": "^2.0", + "rollbar/rollbar": "^3.1" }, + "minimum-stability": "dev", + "prefer-stable": true, "autoload": { "psr-4": { "baibaratsky\\yii\\rollbar\\": "" } + }, + "config": { + "allow-plugins": { + "yiisoft/yii2-composer": true + } + }, + "require-dev": { + "vimeo/psalm": "^5.1" } } diff --git a/log/Target.php b/log/Target.php index 88da865..4c0153c 100644 --- a/log/Target.php +++ b/log/Target.php @@ -10,12 +10,18 @@ class Target extends \yii\log\Target { protected $requestId; + /** + * @return void + */ public function init() { $this->requestId = uniqid(gethostname(), true); parent::init(); } + /** + * @return void + */ public function export() { foreach ($this->messages as $message) { @@ -28,7 +34,7 @@ public function export() } } - protected static function getLevelName($level) + protected static function getLevelName($level): string { if (in_array($level, [Logger::LEVEL_PROFILE, Logger::LEVEL_PROFILE_BEGIN, Logger::LEVEL_PROFILE_END, Logger::LEVEL_TRACE])) { diff --git a/psalm.xml b/psalm.xml new file mode 100644 index 0000000..36b3bc5 --- /dev/null +++ b/psalm.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + +