1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-07 21:56:31 +02:00

Merge branch '1.x' into main

This commit is contained in:
Jordi Boggiano
2020-12-09 14:19:00 +01:00
9 changed files with 161 additions and 46 deletions

View File

@@ -0,0 +1,52 @@
name: "Continuous Integration"
on:
- push
- pull_request
env:
COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --prefer-dist"
jobs:
tests:
name: "CI"
runs-on: ubuntu-latest
strategy:
matrix:
php-version:
- "7.2"
- "7.3"
- "7.4"
- "8.0"
# disabled for now as phpspec/prophecy does not allow 8.1
# - "8.1"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- name: "Install PHP 7+"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
- name: Get composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: "Install latest dependencies"
run: |
composer update ${{ env.COMPOSER_FLAGS }}
- name: "Run tests"
run: "composer test"

32
.github/workflows/lint.yml vendored Normal file
View File

@@ -0,0 +1,32 @@
name: "PHP Lint"
on:
push:
pull_request:
jobs:
tests:
name: "Lint"
runs-on: ubuntu-latest
strategy:
matrix:
php-version:
- "7.2"
- "8.0"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
extensions: "intl"
ini-values: "memory_limit=-1"
php-version: "${{ matrix.php-version }}"
- name: "Lint PHP files"
run: "find src/ -type f -name '*.php' -print0 | xargs -0 -L1 -P4 -- php -l -f"

46
.github/workflows/phpstan.yml vendored Normal file
View File

@@ -0,0 +1,46 @@
name: "PHPStan"
on:
- push
- pull_request
env:
COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --prefer-dist"
jobs:
tests:
name: "PHPStan"
runs-on: ubuntu-latest
strategy:
matrix:
php-version:
- "8.0"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
- name: Get composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: "Install latest dependencies"
run: "composer update ${{ env.COMPOSER_FLAGS }}"
- name: Run PHPStan
run: composer phpstan

View File

@@ -1,36 +0,0 @@
language: php
cache:
directories:
- $HOME/.composer/cache
env:
global:
- COMPOSER_ARGS=
matrix:
fast_finish: true
include:
- php: 7.2
dist: bionic
env: deps=low
- php: 7.2
dist: bionic
- php: 7.3
dist: bionic
- php: 7.4
dist: bionic
- php: nightly
dist: bionic
env: COMPOSER_ARGS=--ignore-platform-reqs
before_script:
- echo "extension = redis.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
- echo "extension = mongodb.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
- composer self-update --snapshot
- if [ "$deps" == "low" ]; then composer update -n --prefer-dist --prefer-lowest --prefer-stable $COMPOSER_ARGS; fi
- if [ "$deps" != "low" ]; then composer update -n --prefer-dist $COMPOSER_ARGS; fi
script:
- if [ "`phpenv version-name`" != "nightly" ]; then composer lint; fi
- composer test

View File

@@ -23,13 +23,13 @@
"graylog2/gelf-php": "^1.4.2", "graylog2/gelf-php": "^1.4.2",
"php-amqplib/php-amqplib": "~2.4", "php-amqplib/php-amqplib": "~2.4",
"php-console/php-console": "^3.1.3", "php-console/php-console": "^3.1.3",
"php-parallel-lint/php-parallel-lint": "^1.0",
"phpspec/prophecy": "^1.6.1", "phpspec/prophecy": "^1.6.1",
"phpunit/phpunit": "^8.5", "phpunit/phpunit": "^8.5",
"predis/predis": "^1.1", "predis/predis": "^1.1",
"rollbar/rollbar": "^1.3", "rollbar/rollbar": "^1.3",
"ruflin/elastica": ">=0.90 <3.0", "ruflin/elastica": ">=0.90 <3.0",
"swiftmailer/swiftmailer": "^5.3|^6.0" "swiftmailer/swiftmailer": "^5.3|^6.0",
"phpstan/phpstan": "^0.12.59"
}, },
"suggest": { "suggest": {
"graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
@@ -56,16 +56,12 @@
}, },
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "2.x-dev" "dev-main": "2.x-dev"
} }
}, },
"scripts": { "scripts": {
"lint": [ "test": "vendor/bin/phpunit",
"parallel-lint . --exclude vendor" "phpstan": "vendor/bin/phpstan analyse"
],
"test": [
"phpunit"
]
}, },
"config": { "config": {
"sort-packages": true, "sort-packages": true,

16
phpstan.neon.dist Normal file
View File

@@ -0,0 +1,16 @@
parameters:
level: 3
paths:
- src/
# - tests/
ignoreErrors:
- '#zend_monitor_|ZEND_MONITOR_#'
- '#RollbarNotifier#'
- '#Predis\\Client#'
- '#^Cannot call method ltrim\(\) on int\|false.$#'
- '#^Access to an undefined property Raven_Client::\$context.$#'
- '#MongoDB\\(Client|Collection)#'
- '#Gelf\\IMessagePublisher#'

View File

@@ -75,6 +75,7 @@ class DynamoDbHandler extends AbstractProcessingHandler
if ($this->version === 3) { if ($this->version === 3) {
$formatted = $this->marshaler->marshalItem($filtered); $formatted = $this->marshaler->marshalItem($filtered);
} else { } else {
/** @phpstan-ignore-next-line */
$formatted = $this->client->formatAttributes($filtered); $formatted = $this->client->formatAttributes($filtered);
} }

View File

@@ -177,7 +177,7 @@ final class Utils
* Function converts the input in place in the passed variable so that it * Function converts the input in place in the passed variable so that it
* can be used as a callback for array_walk_recursive. * can be used as a callback for array_walk_recursive.
* *
* @param mixed &$data Input to check and convert if needed * @param mixed $data Input to check and convert if needed, passed by ref
*/ */
private static function detectAndCleanUtf8(&$data) private static function detectAndCleanUtf8(&$data)
{ {

View File

@@ -36,9 +36,17 @@ class PHPConsoleHandlerTest extends TestCase
protected function setUp(): void protected function setUp(): void
{ {
// suppress warnings until https://github.com/barbushin/php-console/pull/173 is merged
$previous = error_reporting(0);
if (!class_exists('PhpConsole\Connector')) { if (!class_exists('PhpConsole\Connector')) {
error_reporting($previous);
$this->markTestSkipped('PHP Console library not found. See https://github.com/barbushin/php-console#installation'); $this->markTestSkipped('PHP Console library not found. See https://github.com/barbushin/php-console#installation');
} }
if (!class_exists('PhpConsole\Handler')) {
error_reporting($previous);
$this->markTestSkipped('PHP Console library not found. See https://github.com/barbushin/php-console#installation');
}
error_reporting($previous);
$this->connector = $this->initConnectorMock(); $this->connector = $this->initConnectorMock();
$this->debugDispatcher = $this->initDebugDispatcherMock($this->connector); $this->debugDispatcher = $this->initDebugDispatcherMock($this->connector);