Skip to content

Commit

Permalink
Merge pull request #12 from wmde/update-for-php-8
Browse files Browse the repository at this point in the history
Update for PHP 8
  • Loading branch information
gbirke committed May 2, 2022
2 parents f016618 + 741d594 commit bd8d677
Show file tree
Hide file tree
Showing 16 changed files with 404 additions and 217 deletions.
91 changes: 91 additions & 0 deletions .github/workflows/ci.yml
@@ -0,0 +1,91 @@
name: CI

on:
pull_request:
push:

jobs:
test:
name: "PHPUnit PHP ${{ matrix.php }}"

strategy:
matrix:
php: [ 8.0, 8.1, rc ]
include:
- php: '8.0'
coverage: true

runs-on: ubuntu-latest

steps:
- name: Setup PHP
if: matrix.coverage
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring
tools: composer, cs2pr
coverage: pcov

- uses: actions/checkout@v2

- name: Cache Composer cache
uses: actions/cache@v2
with:
path: ~/.composer/cache
key: composer-cache-php${{ matrix.php }}

- name: Composer install
run: composer install --no-progress --no-suggest --no-interaction --prefer-dist --optimize-autoloader

- name: Enable code coverage
if: matrix.coverage
run: echo "COVERAGE=1" >> $GITHUB_ENV

- name: PHPUnit
run: |
mkdir -p build/logs/phpunit
if [ "$COVERAGE" = '1' ]; then
vendor/bin/phpunit --coverage-clover build/logs/phpunit/clover.xml --log-junit build/logs/phpunit/junit.xml --colors=always
else
vendor/bin/phpunit --log-junit build/logs/phpunit/junit.xml --colors=always
fi
- name: Upload coverage results to Codecov
if: matrix.coverage
uses: codecov/codecov-action@v1
with:
name: phpunit-php${{ matrix.php }}
flags: phpunit
fail_ci_if_error: true
continue-on-error: true

static-analysis:
name: "Static Analysis"

runs-on: ubuntu-latest

steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
extensions: mbstring
tools: composer, cs2pr

- uses: actions/checkout@v2

- name: Cache Composer cache
uses: actions/cache@v2
with:
path: ~/.composer/cache
key: composer-cache-php8.0

- name: Composer install
run: composer install --no-progress --no-suggest --no-interaction --prefer-dist --optimize-autoloader

- name: Psalm
run: php vendor/bin/psalm --threads=2 --output-format=github --shepherd --stats

- name: PHPStan
run: php vendor/bin/phpstan analyse --error-format=checkstyle --no-progress src/ tests/ | cs2pr
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -2,6 +2,8 @@
!.*

composer.phar
composer.lock
.phpunit.result.cache

vendor/

Expand Down
17 changes: 0 additions & 17 deletions .scrutinizer.yml

This file was deleted.

22 changes: 0 additions & 22 deletions .travis.yml

This file was deleted.

20 changes: 20 additions & 0 deletions Makefile
@@ -0,0 +1,20 @@
.PHONY: ci cs test phpunit psalm phpstan stan

ci: phpstan phpunit psalm
cs: phpstan psalm
test: phpunit

phpunit:
php ./vendor/bin/phpunit -c phpunit.xml.dist

coverage-html:
php ./vendor/bin/phpunit -c phpunit.xml.dist --coverage-html=./build/coverage/html

psalm:
./vendor/bin/psalm

phpstan:
./vendor/bin/phpstan analyse -c phpstan.neon --no-progress

stan: phpstan

27 changes: 24 additions & 3 deletions README.md
@@ -1,8 +1,9 @@
# PSR Log Test Doubles

[![Build Status](https://secure.travis-ci.org/wmde/PsrLogTestDoubles.png?branch=master)](http://travis-ci.org/wmde/PsrLogTestDoubles)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/wmde/PsrLogTestDoubles/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/wmde/PsrLogTestDoubles/?branch=master)
[![Code Coverage](https://scrutinizer-ci.com/g/wmde/PsrLogTestDoubles/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/wmde/PsrLogTestDoubles/?branch=master)
[![Build Status](https://img.shields.io/github/workflow/status/wmde/PsrLogTestDoubles/CI)](https://github.com/wmde/PsrLogTestDoubles/actions?query=workflow%3ACI)
[![codecov](https://codecov.io/gh/wmde/PsrLogTestDoubles/branch/master/graph/badge.svg)](https://codecov.io/gh/wmde/PsrLogTestDoubles)
[![Type Coverage](https://shepherd.dev/github/wmde/PsrLogTestDoubles/coverage.svg)](https://shepherd.dev/github/wmde/PsrLogTestDoubles)
[![Psalm level](https://shepherd.dev/github/wmde/PsrLogTestDoubles/level.svg)](psalm.xml)
[![Latest Stable Version](https://poser.pugx.org/wmde/psr-log-test-doubles/version.png)](https://packagist.org/packages/wmde/psr-log-test-doubles)
[![Download count](https://poser.pugx.org/wmde/psr-log-test-doubles/d/total.png)](https://packagist.org/packages/wmde/psr-log-test-doubles)

Expand Down Expand Up @@ -59,6 +60,26 @@ $this->assertSame( LogLevel::ERROR, $firstLogCall->getLevel() );

## Release notes

### 3.2.0 (2022-03-28)

* Added `LogCall::isError`
* Added `LogCall::withoutContext`
* Added `LogCalls::filter`
* Added `LogCalls::getErrors`
* Added `LogCalls::map`
* Added `LogCalls::withoutContexts`

### 3.1.0 (2022-01-26)

* Added `LogCalls::getLastCall`

### 3.0.0 (2022-01-26)

* Added support for `psr/log` 2.x and 3.x
* Changed minimum PHP version from PHP 7.1 to 8.0
* Added several property, parameter and return types
* Added Psalm and PHPStan CI and compliance with level 1 checks

### 2.2.0 (2017-05-23)

* Added `LoggerSpy::getFirstLogCall` convenience method
Expand Down
41 changes: 15 additions & 26 deletions composer.json
Expand Up @@ -3,6 +3,13 @@
"description": "Test Doubles for the PSR-3 Logger Interface",
"homepage": "https://github.com/wmde/PsrLogTestDoubles",
"license": "GPL-2.0-or-later",
"authors": [
{
"name": "Jeroen De Dauw",
"email": "jeroendedauw@gmail.com",
"homepage": "https://www.EntropyWins.wtf"
}
],
"keywords": [
"log",
"psr",
Expand All @@ -20,40 +27,22 @@
"test"
],
"require": {
"php": ">=7.1",
"psr/log": "~1.0"
"php": ">=8.0",
"psr/log": "~3.0|~2.0"
},
"require-dev": {
"phpunit/phpunit": "~6.1",
"squizlabs/php_codesniffer": "~2.5",
"mediawiki/mediawiki-codesniffer": "~0.6.0",
"ockcyp/covers-validator": "~0.4"
"phpunit/phpunit": "~9.5",
"vimeo/psalm": "^4.18.1",
"phpstan/phpstan": "^1.4.2"
},
"autoload": {
"psr-4": {
"WMDE\\PsrLogTestDoubles\\": "src/"
}
},
"extra": {
"branch-alias": {
"dev-master": "2.1.x-dev"
"autoload-dev": {
"psr-4": {
"WMDE\\PsrLogTestDoubles\\Tests\\": "tests/"
}
},
"scripts": {
"ci": [
"@test",
"@cs"
],
"test": [
"composer validate --no-interaction",
"vendor/bin/covers-validator",
"vendor/bin/phpunit"
],
"cs": [
"@phpcs"
],
"phpcs": [
"vendor/bin/phpcs src/ tests/ --standard=phpcs.xml --extensions=php -sp"
]
}
}
109 changes: 0 additions & 109 deletions phpcs.xml

This file was deleted.

5 changes: 5 additions & 0 deletions phpstan.neon
@@ -0,0 +1,5 @@
parameters:
level: 1
paths:
- src
- tests
15 changes: 15 additions & 0 deletions psalm.xml
@@ -0,0 +1,15 @@
<?xml version="1.0"?>
<psalm
errorLevel="1"
resolveFromConfigFile="true"
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>
</ignoreFiles>
</projectFiles>
</psalm>

0 comments on commit bd8d677

Please sign in to comment.