-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 457aeec
Showing
54 changed files
with
2,884 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
[*.yml] | ||
indent_size = 2 | ||
|
||
[Dockerfile] | ||
indent_style = tab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: code-style | ||
|
||
on: | ||
- push | ||
- pull_request | ||
|
||
jobs: | ||
phpstan: | ||
name: PHPCS | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Install PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: "7.2" | ||
ini-values: memory_limit=-1 | ||
tools: composer:v2, phpcs | ||
- name: Cache dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.composer/cache | ||
vendor | ||
key: vendor | ||
|
||
- name: Install dependencies | ||
run: composer install --no-interaction --no-progress | ||
|
||
- name: Run PHPCS | ||
run: phpcs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: static-analysis | ||
|
||
on: | ||
- push | ||
- pull_request | ||
|
||
jobs: | ||
phpstan: | ||
name: PHPStan | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Install PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: "7.2" | ||
ini-values: memory_limit=-1 | ||
tools: composer:v2 | ||
- name: Cache dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.composer/cache | ||
vendor | ||
key: phpstan-deps | ||
|
||
- name: Install dependencies | ||
run: composer install --no-interaction --no-progress | ||
|
||
- name: Run PHPStan | ||
run: vendor/bin/phpstan |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: test | ||
|
||
on: | ||
- push | ||
- pull_request | ||
|
||
jobs: | ||
phpunit: | ||
name: phpunit | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
matrix: | ||
php-version: | ||
- "7.2" | ||
- "7.4" | ||
- "8.0" | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Install PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
coverage: xdebug | ||
php-version: "${{ matrix.php-version }}" | ||
ini-values: memory_limit=-1 | ||
tools: composer:v2 | ||
- name: Cache dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.composer/cache | ||
vendor | ||
key: "php-${{ matrix.php-version }}" | ||
restore-keys: "php-${{ matrix.php-version }}" | ||
|
||
- name: Install dependencies | ||
run: composer install --no-interaction --no-progress | ||
|
||
- name: Run PHPUnit | ||
run: make test-coveralls | ||
|
||
- name: Upload code coverage | ||
if: ${{ matrix.php-version == '7.2' }} | ||
env: | ||
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
composer global require php-coveralls/php-coveralls | ||
php-coveralls --coverage_clover=build/logs/clover.xml -v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.phpunit.result.cache | ||
build | ||
composer.lock | ||
vendor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Contributing | ||
|
||
Contributions are **welcome** and will be fully **credited**. | ||
|
||
We accept contributions via Pull Requests on [Github](https://github.com/olvlvl/event-dispatcher). | ||
|
||
## Pull Requests | ||
|
||
- **Code style** — We're following [PSR-12 Coding Standard][]. Check the code style with `make lint`. | ||
- **Code health** — We're using [PHPStan][] to analyse the code, with maximum scrutiny. Check the code with `make lint`. | ||
- **Add tests!** — Your contribution won't be accepted if it doesn't have tests. | ||
- **Document any change in behaviour** — Make sure the `README.md` and any other relevant documentation are kept | ||
up-to-date. | ||
- **Consider our release cycle** — We follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not | ||
an option. | ||
- **Create feature branches** — We won't pull from your main branch. | ||
- **One pull request per feature** — If you want to do more than one thing, send multiple pull requests. | ||
- **Send coherent history** — Make sure each individual commit in your pull request is meaningful. If you had to make | ||
multiple intermediate commits while developing, please [squash them][git-squash] before submitting. | ||
|
||
## Running Tests | ||
|
||
We provide a Docker container for local development. Run `make test-container` to create a new session. Inside the | ||
container run `make test` to run the test suite. Alternatively, run `make test-coverage` for a breakdown of the code | ||
coverage. The coverage report is available in `build/coverage/index.html`. | ||
|
||
**Thanks for your contribution**! | ||
|
||
|
||
[PSR-12 Coding Standard]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-12-coding-style-guide.md | ||
[git-squash]: http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages | ||
[PHPStan]: https://phpstan.org/user-guide/getting-started |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
FROM php:7.2-cli-buster | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y autoconf pkg-config && \ | ||
pecl channel-update pecl.php.net && \ | ||
pecl install xdebug && \ | ||
docker-php-ext-enable opcache xdebug | ||
|
||
RUN echo '\ | ||
xdebug.client_host=host.docker.internal\n\ | ||
xdebug.mode=develop\n\ | ||
xdebug.start_with_request=yes\n\ | ||
' >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini | ||
|
||
RUN echo '\ | ||
display_errors=On\n\ | ||
error_reporting=E_ALL\n\ | ||
date.timezone=UTC\n\ | ||
' >> /usr/local/etc/php/conf.d/php.ini | ||
|
||
ENV COMPOSER_ALLOW_SUPERUSER 1 | ||
|
||
RUN apt-get update && \ | ||
apt-get install unzip && \ | ||
curl -s https://raw.githubusercontent.com/composer/getcomposer.org/76a7060ccb93902cd7576b67264ad91c8a2700e2/web/installer | php -- --quiet && \ | ||
mv composer.phar /usr/local/bin/composer && \ | ||
echo 'export PATH="$HOME/.composer/vendor/bin:$PATH"\n' >> /root/.bashrc | ||
|
||
RUN composer global require squizlabs/php_codesniffer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
The olvlvl/event-dispatcher package is free software. | ||
It is released under the terms of the following BSD License. | ||
|
||
Copyright (c) 2021 by Olivier Laviale | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, | ||
are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, | ||
this list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
* Neither the name of Olivier Laviale nor the names of its | ||
contributors may be used to endorse or promote products derived from this | ||
software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | ||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
PHPUNIT = vendor/bin/phpunit | ||
|
||
vendor: | ||
composer install | ||
|
||
.PHONY: test-dependencies | ||
test-dependencies: vendor | ||
|
||
.PHONY: test | ||
test: test-dependencies | ||
@$(PHPUNIT) | ||
|
||
.PHONY: test-coverage | ||
test-coverage: test-dependencies | ||
@mkdir -p build/coverage | ||
@XDEBUG_MODE=coverage $(PHPUNIT) --coverage-html build/coverage | ||
|
||
.PHONY: test-coveralls | ||
test-coveralls: test-dependencies | ||
@mkdir -p build/logs | ||
@XDEBUG_MODE=coverage $(PHPUNIT) --coverage-clover build/logs/clover.xml | ||
|
||
.PHONY: test-container | ||
test-container: | ||
@-docker-compose run --rm app bash | ||
@docker-compose down -v | ||
|
||
.PHONY: lint | ||
lint: | ||
@phpcs | ||
@vendor/bin/phpstan |
Oops, something went wrong.