Skip to content

Commit

Permalink
Merge pull request #3 from ngmy/update
Browse files Browse the repository at this point in the history
Update
  • Loading branch information
ngmy committed Mar 31, 2021
2 parents 4b56d33 + 6ce3fb3 commit 7c37d77
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 19 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,17 @@ jobs:
name: tools
path: tools

- name: Set tools as an executable
run: find tools -type f -print0 | xargs -0 chmod +x

- name: Run lint
env:
PSALM_SHEPHERD: 1
# TODO: Remove it when psalm no longer tries to create a cache directory
# https://github.com/vimeo/psalm/issues/4267
XDG_CACHE_HOME: /tmp
run: composer lint

- name: Run bug analysis
run: composer findbugs

- name: Run unit tests
env:
XDEBUG_MODE: coverage
Expand Down
7 changes: 4 additions & 3 deletions .phive/phars.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="php-coveralls" version="^2.4.3" installed="2.4.3" location="./tools/php-coveralls" copy="false"/>
<phar name="php-cs-fixer" version="^2.18.2" installed="2.18.2" location="./tools/php-cs-fixer" copy="false"/>
<phar name="php-cs-fixer" version="^2.18.2" installed="2.18.4" location="./tools/php-cs-fixer" copy="false"/>
<phar name="phpcbf" version="^3.5.8" installed="3.5.8" location="./tools/phpcbf" copy="false"/>
<phar name="phpcs" version="^3.5.8" installed="3.5.8" location="./tools/phpcs" copy="false"/>
<phar name="phpdocumentor" version="^3.0.0" installed="3.0.0" location="./tools/phpDocumentor" copy="false"/>
<phar name="phpstan" version="^0.12.64" installed="0.12.80" location="./tools/phpstan" copy="false"/>
<phar name="phpunit" version="^9.5.0" installed="9.5.2" location="./tools/phpunit" copy="false"/>
<phar name="phpstan" version="^0.12.64" installed="0.12.82" location="./tools/phpstan" copy="false"/>
<phar name="phpunit" version="^9.5.0" installed="9.5.4" location="./tools/phpunit" copy="false"/>
<phar name="psalm" version="^4.7.0" installed="4.7.0" location="./tools/psalm" copy="false"/>
</phive>
11 changes: 7 additions & 4 deletions .vim/coc-settings.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
{
"diagnostic-languageserver.linters": {
"ngmy.laradock.composer.lint": {
"args": ["exec", "-u", "laradock", "laradock-ngmy-php-observer_workspace_1", "composer", "lint", "--", "--report=emacs"]
"ngmy.laradock.phive.phpcs": {
"args": ["exec", "-u", "laradock", "laradock-ngmy-php-observer_workspace_1", "php", "tools/phpcs", "--report=emacs"]
},
"ngmy.laradock.composer.findbugs": {
"args": ["exec", "-u", "laradock", "laradock-ngmy-php-observer_workspace_1", "composer", "findbugs", "--", "--error-format", "raw", "--no-progress"]
"ngmy.laradock.phive.phpstan": {
"args": ["exec", "-u", "laradock", "laradock-ngmy-php-observer_workspace_1", "php", "tools/phpstan", "analyse", "--error-format", "raw", "--no-progress"]
},
"ngmy.laradock.phive.psalm": {
"args": ["exec", "-u", "laradock", "laradock-ngmy-php-observer_workspace_1", "php", "tools/psalm", "--output-format=emacs", "--no-progress", "--no-cache"]
}
}
}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
[![PHP CI](https://github.com/ngmy/php-observer/actions/workflows/php.yml/badge.svg)](https://github.com/ngmy/php-observer/actions/workflows/php.yml)
[![Coverage Status](https://coveralls.io/repos/github/ngmy/php-observer/badge.svg?branch=master)](https://coveralls.io/github/ngmy/php-observer?branch=master)
[![PHPStan](https://img.shields.io/badge/PHPStan-enabled-brightgreen.svg?style=flat)](https://github.com/phpstan/phpstan)
[![Psalm Coverage](https://shepherd.dev/github/ngmy/php-observer/coverage.svg?)](https://shepherd.dev/github/ngmy/php-observer)
[![Psalm Level](https://shepherd.dev/github/ngmy/php-observer/level.svg?)](https://shepherd.dev/github/ngmy/php-observer)

PHP Observer is a PHP library to implement the [observer pattern](https://en.wikipedia.org/wiki/Observer_pattern).

Expand Down
38 changes: 29 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,40 @@
"prefer-stable": true,
"scripts": {
"test": [
"@php tools/phpunit --colors=always"
"@phpunit"
],
"lint": [
"@php tools/phpcs"
],
"findbugs": [
"@php tools/phpstan analyse --ansi"
"@phpcs",
"@phpstan",
"@psalm"
],
"fmt": [
"@php tools/phpcbf | exit 0",
"@php tools/php-cs-fixer fix --ansi"
"@phpcbf",
"@php-cs-fixer"
],
"doc": [
"@phpdoc"
],
"php-cs-fixer": [
"tools/php-cs-fixer fix --ansi"
],
"phpcbf": [
"tools/phpcbf"
],
"phpcs": [
"tools/phpcs"
],
"phpdoc": [
"tools/phpDocumentor --force"
],
"phpstan": [
"tools/phpstan analyse --ansi"
],
"phpunit": [
"tools/phpunit --colors=always"
],
"docs": [
"@php tools/phpDocumentor --force"
"psalm": [
"[ \"${PSALM_SHEPHERD:-0}\" = '0' ] && tools/psalm --no-cache || tools/psalm --no-cache --shepherd"
]
}
}
15 changes: 15 additions & 0 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
@@ -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>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
</psalm>
1 change: 1 addition & 0 deletions src/Subject.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ abstract class Subject
/**
* @var array<int, Observer>
* @phpstan-var list<Observer>
* @psalm-var list<Observer>
*/
protected $observers = [];

Expand Down

0 comments on commit 7c37d77

Please sign in to comment.