Skip to content

Commit 9621812

Browse files
Merge pull request #5 from Felynx3/feat/upgrade-php-8
[CP-1111] feat: upgrade to php 8.1
2 parents f655b77 + ff91c32 commit 9621812

37 files changed

+356
-230
lines changed

.coveralls.yml

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
name: Continuous Integration
2+
on:
3+
push:
4+
branches: [master]
5+
pull_request: ~
6+
env:
7+
PHP_VERSION: 8.1
8+
jobs:
9+
code-style-lint:
10+
name: Code style lint
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v2
15+
- name: Set up PHP
16+
uses: shivammathur/setup-php@v2
17+
with:
18+
php-version: ${{ env.PHP_VERSION }}
19+
coverage: none
20+
tools: composer:v2
21+
- name: Get Composer cache directory
22+
id: composer-cache
23+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
24+
- name: Cache Composer cache
25+
uses: actions/cache@v1
26+
with:
27+
path: ${{ steps.composer-cache.outputs.dir }}
28+
key: ${{ runner.os }}-composer
29+
- name: Store vendor
30+
uses: actions/cache@v1
31+
with:
32+
path: vendor
33+
key: ${{ runner.os }}-vendor
34+
- name: Install Composer dependencies
35+
run: composer install --prefer-dist --no-interaction
36+
37+
- name: Cache PHP-CS-Fixer
38+
uses: actions/cache@v1
39+
with:
40+
path: .php_cs.cache
41+
key: ${{ runner.os }}-php-cs-fixer
42+
- name: Run code style check
43+
run: composer lint:check
44+
security-check:
45+
name: Security check
46+
runs-on: ubuntu-latest
47+
steps:
48+
- name: Checkout
49+
uses: actions/checkout@v2
50+
- name: Set up PHP
51+
uses: shivammathur/setup-php@v2
52+
with:
53+
php-version: ${{ env.PHP_VERSION }}
54+
coverage: none
55+
tools: composer:v2
56+
- name: Get Composer cache directory
57+
id: composer-cache
58+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
59+
- name: Cache Composer cache
60+
uses: actions/cache@v1
61+
with:
62+
path: ${{ steps.composer-cache.outputs.dir }}
63+
key: ${{ runner.os }}-composer
64+
- name: Store vendor
65+
uses: actions/cache@v1
66+
with:
67+
path: vendor
68+
key: ${{ runner.os }}-vendor
69+
- name: Install Composer dependencies
70+
run: composer install --prefer-dist --no-interaction
71+
72+
- name: Run security check
73+
run: composer security-check
74+
test-unit-coverage:
75+
name: Unit tests and coverage
76+
runs-on: ubuntu-latest
77+
steps:
78+
- name: Checkout
79+
uses: actions/checkout@v2
80+
- name: Set up PHP
81+
uses: shivammathur/setup-php@v2
82+
with:
83+
php-version: ${{ env.PHP_VERSION }}
84+
coverage: pcov
85+
tools: composer:v2
86+
- name: Get Composer cache directory
87+
id: composer-cache
88+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
89+
- name: Cache Composer cache
90+
uses: actions/cache@v1
91+
with:
92+
path: ${{ steps.composer-cache.outputs.dir }}
93+
key: ${{ runner.os }}-composer
94+
- name: Store vendor
95+
uses: actions/cache@v1
96+
with:
97+
path: vendor
98+
key: ${{ runner.os }}-vendor
99+
- name: Install Composer dependencies
100+
run: composer install --prefer-dist --no-interaction
101+
- name: Run unit tests check
102+
run: composer test:unit:check
103+
static-analysis:
104+
name: Static analysis
105+
runs-on: ubuntu-latest
106+
steps:
107+
- name: Checkout
108+
uses: actions/checkout@v2
109+
- name: Set up PHP
110+
uses: shivammathur/setup-php@v2
111+
with:
112+
php-version: ${{ env.PHP_VERSION }}
113+
coverage: none
114+
tools: composer:v2
115+
- name: Get Composer cache directory
116+
id: composer-cache
117+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
118+
- name: Cache Composer cache
119+
uses: actions/cache@v1
120+
with:
121+
path: ${{ steps.composer-cache.outputs.dir }}
122+
key: ${{ runner.os }}-composer
123+
- name: Store vendor
124+
uses: actions/cache@v1
125+
with:
126+
path: vendor
127+
key: ${{ runner.os }}-vendor
128+
- name: Install Composer dependencies
129+
run: composer install --prefer-dist --no-interaction
130+
131+
- name: Cache PHPStan
132+
uses: actions/cache@v1
133+
with:
134+
path: data/cache/phpstan
135+
key: ${{ runner.os }}-phpstan
136+
- name: Run code static analysis
137+
run: composer static-analysis

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@
44
/phpunit.xml
55
/vendor
66
/.idea
7+
/data
8+
/build

.travis.yml

Lines changed: 0 additions & 37 deletions
This file was deleted.

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1-
Monolog Cascade [![Build Status](https://travis-ci.org/theorchard/monolog-cascade.svg?branch=master)](https://travis-ci.org/theorchard/monolog-cascade) [![Coverage Status](https://coveralls.io/repos/theorchard/monolog-cascade/badge.svg?branch=master)](https://coveralls.io/r/theorchard/monolog-cascade?branch=master)
1+
Monolog Cascade
22
===============
33

4+
Compatibility
5+
-------------
6+
7+
| PHP | Tag | Branch |
8+
|------|-----|--------|
9+
| ^8.1 | 1.X | master |
10+
| ^7.0 | 0.X | 7.2 |
11+
412
What is Monolog Cascade?
513
------------------------
614

composer.json

Lines changed: 54 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,61 @@
33
"license": "MIT",
44
"type": "library",
55
"description": "Monolog extension to configure multiple loggers in the blink of an eye and access them from anywhere",
6-
"keywords": ["monolog", "cascade", "monolog extension", "monolog plugin", "monolog utils", "logger", "log"],
7-
"authors": [
8-
{
9-
"name": "Raphaël Antonmattei",
10-
"email": "rantonmattei@theorchard.com",
11-
"homepage": "https://github.com/rantonmattei"
12-
}
6+
"keywords": [
7+
"monolog",
8+
"cascade",
9+
"monolog extension",
10+
"monolog plugin",
11+
"monolog utils",
12+
"logger",
13+
"log"
1314
],
14-
"homepage": "https://github.com/theorchard/monolog-cascade",
1515
"require": {
16-
"php": "^7.0",
17-
"symfony/config": "^2.7 || ^3.0 || ^4.0 || ^5.0",
18-
"symfony/options-resolver": "^2.7 || ^3.0 || ^4.0 || ^5.0",
19-
"symfony/serializer": "^2.7 || ^3.0 || ^4.0 || ^5.0",
20-
"symfony/yaml": "^2.7 || ^3.0 || ^4.0 || ^5.0",
21-
"monolog/monolog": "^1.13 || ^2.0"
16+
"php": "^8.1",
17+
"symfony/config": "^6.1",
18+
"symfony/options-resolver": "^6.1",
19+
"symfony/serializer": "^6.1",
20+
"symfony/yaml": "^6.1",
21+
"monolog/monolog": "^3.2"
22+
},
23+
"require-dev": {
24+
"mikey179/vfsstream": "^1.6",
25+
"phpunit/phpcov": "^8.2",
26+
"phpunit/phpunit": "^9.5",
27+
"php-coveralls/php-coveralls": "^2.5",
28+
"squizlabs/php_codesniffer": "^3.7",
29+
"phpstan/phpstan": "^1.8",
30+
"friendsofphp/php-cs-fixer": "^3.12",
31+
"michaelmoussa/php-coverage-checker": "^1.1"
32+
},
33+
"scripts": {
34+
"security-check": [
35+
"curl -sS https://get.symfony.com/cli/installer | bash -s -- --install-dir=/usr/local/bin",
36+
"symfony check:security"
37+
],
38+
"test:unit:base": [
39+
"php -d pcov.enabled=1 vendor/bin/phpunit --color=always"
40+
],
41+
"test:unit": [
42+
"@test:unit:base --log-junit build/junit.xml --coverage-xml build/coverage-xml --coverage-clover build/coverage-clover.xml"
43+
],
44+
"test:unit:with-html-coverage": [
45+
"@test:unit:base --coverage-html build/coverage-html"
46+
],
47+
"test:unit:no-coverage": [
48+
"@test:unit:base --no-coverage"
49+
],
50+
"test:unit:coverage-checker": [
51+
"php-coverage-checker build/coverage-clover.xml 100; # comment trick to allow composer params :D"
52+
],
53+
"test:unit:check": [
54+
"if [ -f build/coverage-clover.xml ]; then rm build/coverage-clover.xml; echo '>>> REMOVED OLD CLOVER.XML BUILD FILE!'; fi;",
55+
"@test:unit",
56+
"@test:unit:coverage-checker"
57+
],
58+
"static-analysis": [
59+
"phpstan analyse --ansi --memory-limit=-1"
60+
]
2261
},
2362
"autoload": {
2463
"psr-4": {
@@ -30,17 +69,5 @@
3069
"Cascade\\Tests\\": "tests/"
3170
}
3271
},
33-
"require-dev": {
34-
"mikey179/vfsstream": "^1.6",
35-
"phpunit/phpcov": "~4.0.5",
36-
"phpunit/phpunit": "~6.5.14",
37-
"satooshi/php-coveralls": "~2.2",
38-
"squizlabs/php_codesniffer": "~3.0"
39-
},
40-
"prefer-stable": true,
41-
"extra": {
42-
"branch-alias": {
43-
"dev-master": "0.5.x-dev"
44-
}
45-
}
72+
"prefer-stable": true
4673
}

phpstan.neon.dist

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
parameters:
2+
level: 6
3+
paths:
4+
- src
5+
tmpDir: data/cache/phpstan
6+
checkGenericClassInNonGenericObjectType: false
7+
treatPhpDocTypesAsCertain: false

phpunit.xml.dist

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
3-
<phpunit bootstrap="vendor/autoload.php" colors="true">
4-
<testsuites>
5-
<testsuite name="Monolog-Cascade Test Suite">
6-
<directory>tests/</directory>
7-
</testsuite>
8-
</testsuites>
9-
10-
<filter>
11-
<whitelist>
12-
<directory suffix=".php">src/</directory>
13-
</whitelist>
14-
</filter>
15-
16-
<php>
17-
<ini name="date.timezone" value="UTC"/>
18-
</php>
19-
</phpunit>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3+
<coverage>
4+
<include>
5+
<directory suffix=".php">src/</directory>
6+
</include>
7+
</coverage>
8+
<testsuites>
9+
<testsuite name="Monolog-Cascade Test Suite">
10+
<directory>tests/</directory>
11+
</testsuite>
12+
</testsuites>
13+
<php>
14+
<ini name="date.timezone" value="UTC"/>
15+
</php>
16+
</phpunit>

src/Cascade.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ public static function getConfig()
100100
/**
101101
* Load configuration options from a file, a JSON or Yaml string or an array.
102102
*
103-
* @param string|array $resource Path to config file or configuration as string or array
103+
* @param string|array<mixed> $resource Path to config file or configuration as string or array
104104
*/
105-
public static function fileConfig($resource)
105+
public static function fileConfig($resource): void
106106
{
107107
self::$config = new Config($resource, new ConfigLoader());
108108
self::$config->load();
@@ -115,7 +115,7 @@ public static function fileConfig($resource)
115115
*
116116
* @param string $configString Configuration in string form
117117
*/
118-
public static function loadConfigFromString($configString)
118+
public static function loadConfigFromString($configString): void
119119
{
120120
self::fileConfig($configString);
121121
}
@@ -124,9 +124,9 @@ public static function loadConfigFromString($configString)
124124
* Load configuration options from an array. Alias of fileConfig.
125125
* @see fileConfig
126126
*
127-
* @param array $configArray Configuration in array form
127+
* @param array<mixed> $configArray Configuration in array form
128128
*/
129-
public static function loadConfigFromArray($configArray)
129+
public static function loadConfigFromArray($configArray): void
130130
{
131131
self::fileConfig($configArray);
132132
}

0 commit comments

Comments
 (0)