Skip to content

Commit

Permalink
Pslam level 1 + minor refactoring + fix BC checker (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
vjik committed Feb 8, 2023
1 parent 0c68641 commit a65566b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 23 deletions.
20 changes: 9 additions & 11 deletions .github/workflows/bc.yml
@@ -1,15 +1,13 @@
on:
pull_request:
push:
- pull_request
- push

name: backwards compatibility
jobs:
roave_bc_check:
name: Roave BC Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: fetch tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Roave BC Check
uses: docker://nyholm/roave-bc-check-ga
roave_bc_check:
uses: yiisoft/actions/.github/workflows/bc.yml@master
with:
os: >-
['ubuntu-latest']
php: >-
['8.0']
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -31,7 +31,7 @@
"rector/rector": "^0.15.1",
"roave/infection-static-analysis-plugin": "^1.25",
"spatie/phpunit-watcher": "^1.23",
"vimeo/psalm": "^4.30|^5.2"
"vimeo/psalm": "^4.30|^5.6"
},
"autoload": {
"psr-4": {
Expand Down
10 changes: 4 additions & 6 deletions psalm.xml
@@ -1,15 +1,13 @@
<?xml version="1.0"?>
<psalm
errorLevel="2"
resolveFromConfigFile="true"
errorLevel="1"
findUnusedBaselineEntry="true"
findUnusedCode="false"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
>
<projectFiles>
<directory name="src" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
<directory name="src"/>
</projectFiles>
</psalm>
7 changes: 2 additions & 5 deletions src/SyslogTarget.php
Expand Up @@ -26,10 +26,7 @@
*/
final class SyslogTarget extends Target
{
/**
* @var array Syslog levels.
*/
private array $syslogLevels = [
private const SYSLOG_LEVELS = [
LogLevel::EMERGENCY => LOG_EMERG,
LogLevel::ALERT => LOG_ALERT,
LogLevel::CRITICAL => LOG_CRIT,
Expand Down Expand Up @@ -75,7 +72,7 @@ protected function export(): void
openlog($this->identity, $this->options, $this->facility);

foreach ($this->getMessages() as $key => $message) {
if (syslog($this->syslogLevels[$message->level()], $formattedMessages[$key]) === false) {
if (syslog(self::SYSLOG_LEVELS[$message->level()], $formattedMessages[$key]) === false) {
throw new RuntimeException('Unable to export log through system log.');
}
}
Expand Down

0 comments on commit a65566b

Please sign in to comment.