Skip to content

Commit 2e35077

Browse files
f3l1xMilan Felix Šulc
authored and
Milan Felix Šulc
committed
Refactoring to support Nette v3
1 parent 8b2c0fb commit 2e35077

19 files changed

+283
-230
lines changed

.docs/README.md

+14-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
1-
# Annotations
1+
# Nettrine Annotations
2+
3+
[Doctrine\Annotations](http://docs.doctrine-project.org/projects/doctrine-common/en/latest/reference/annotations.html) for Nette Framework.
24

35
## Content
46

5-
- [Usage - how to register](#usage)
6-
- [Extension - how to configure](#configuration)
7-
- [Example - how to create annotation](#example)
7+
- [Setup](#setup)
8+
- [Configuration](#configuration)
9+
- [Example - create own annotation](#example)
10+
11+
## Setup
812

9-
## Usage
13+
Install package
14+
15+
```bash
16+
composer require nettrine/annotations
17+
```
1018

11-
At first you should register `AnnotationsExtension` at your config file.
19+
Register extension
1220

1321
```yaml
1422
extensions:

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ tests export-ignore
55
.gitattributes export-ignore
66
.gitignore export-ignore
77
.travis.yml export-ignore
8+
Makefile export-ignore
89
phpstan.neon export-ignore
910
README.md export-ignore
1011
ruleset.xml export-ignore

.travis.yml

+17-26
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,52 @@
11
language: php
22
php:
3-
- 7.1
43
- 7.2
54
- 7.3
5+
- 7.4snapshot
6+
- nightly
67

78
before_install:
8-
# Turn off XDebug
9-
- phpenv config-rm xdebug.ini || return 0
9+
- phpenv config-rm xdebug.ini || return 0 # Turn off XDebug
1010

1111
install:
12-
# Composer
13-
- travis_retry composer install --no-progress --prefer-dist
12+
- travis_retry composer install --no-progress --prefer-dist # Install dependencies
1413

1514
script:
16-
# Tests
17-
- composer run-script tests
18-
19-
after_failure:
20-
# Print *.actual content
21-
- for i in $(find tests -name \*.actual); do echo "--- $i"; cat $i; echo; echo; done
15+
- make tests # Tests
2216

2317
jobs:
2418
include:
25-
- env: title="Lowest Dependencies 7.1"
26-
php: 7.1
19+
- env: title="Lowest Dependencies 7.3"
20+
php: 7.3
2721
install:
28-
- travis_retry composer update --no-progress --prefer-dist --prefer-lowest
22+
- travis_retry composer update --no-progress --prefer-dist --prefer-lowest --prefer-stable
2923
script:
30-
- composer run-script tests
24+
- make tests
3125

3226
- stage: Quality Assurance
33-
php: 7.1
34-
script:
35-
- composer run-script qa
36-
37-
- stage: Phpstan
38-
php: 7.1
27+
php: 7.3
3928
script:
40-
- composer run-script phpstan
29+
- make qa
4130

4231
- stage: Test Coverage
4332
if: branch = master AND type = push
44-
php: 7.1
33+
php: 7.3
4534
script:
46-
- composer run-script coverage
35+
- make coverage
4736
after_script:
4837
- composer global require php-coveralls/php-coveralls ^2.1.0
4938
- ~/.composer/vendor/bin/php-coveralls --verbose --config tests/.coveralls.yml
5039

5140
- stage: Outdated Dependencies
5241
if: branch = master AND type = cron
53-
php: 7.1
42+
php: 7.3
5443
script:
55-
- composer outdated --direct --strict
44+
- composer outdated --direct
5645

5746
allow_failures:
5847
- stage: Test Coverage
48+
- php: 7.4snapshot
49+
- php: nightly
5950

6051
sudo: false
6152

Makefile

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
.PHONY: qa lint cs csf phpstan tests coverage
2+
3+
all:
4+
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | xargs
5+
6+
vendor: composer.json composer.lock
7+
composer install
8+
9+
qa: lint phpstan cs
10+
11+
lint: vendor
12+
vendor/bin/linter src tests
13+
14+
cs: vendor
15+
vendor/bin/codesniffer src tests
16+
17+
csf: vendor
18+
vendor/bin/codefixer src tests
19+
20+
phpstan: vendor
21+
vendor/bin/phpstan analyse -l max -c phpstan.neon src
22+
23+
tests: vendor
24+
vendor/bin/phpunit tests --cache-result-file=tests/tmp/phpunit.cache --colors=always
25+
26+
coverage: vendor
27+
vendor/bin/phpdbg -qrr vendor/bin/phpunit tests --cache-result-file=tests/tmp/phpunit.cache --colors=always -c tests/coverage.xml

README.md

+10-20
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
# Annotations
1+
# Nettrine Annotations
22

3-
[Doctrine\Annotations](http://docs.doctrine-project.org/projects/doctrine-common/en/latest/reference/annotations.html) to Nette Framework.
4-
5-
-----
3+
[Doctrine\Annotations](http://docs.doctrine-project.org/projects/doctrine-common/en/latest/reference/annotations.html) for Nette Framework.
64

75
[![Build Status](https://img.shields.io/travis/nettrine/annotations.svg?style=flat-square)](https://travis-ci.org/nettrine/annotations)
86
[![Code coverage](https://img.shields.io/coveralls/nettrine/annotations.svg?style=flat-square)](https://coveralls.io/r/nettrine/annotations)
@@ -16,24 +14,18 @@
1614

1715
[![Join the chat](https://img.shields.io/gitter/room/nettrine/nettrine.svg?style=flat-square)](https://gitter.im/nettrine/nettrine)
1816

19-
## Install
17+
## Documentation
2018

21-
```sh
22-
composer require nettrine/annotations
23-
```
19+
- [Setup](.docs/README.md#setup)
20+
- [Configuration](.docs/README.md#configuration)
21+
- [Example - create own annotation](.docs/README.md#example)
2422

2523
## Versions
2624

27-
| State | Version | Branch | PHP |
28-
|-------------|---------|----------|----------|
29-
| development | `^0.5` | `master` | `>= 7.1` |
30-
| stable | `^0.4` | `master` | `>= 7.1` |
31-
32-
## Overview
33-
34-
- [Usage - how to register](https://github.com/nettrine/annotations/blob/master/.docs/README.md#usage)
35-
- [Extension - how to configure](https://github.com/nettrine/annotations/blob/master/.docs/README.md#configuration)
36-
- [Example - how to create annotation](https://github.com/nettrine/annotations/blob/master/.docs/README.md#example)
25+
| State | Version | Branch | Nette | PHP |
26+
|-------------|---------|----------|--------|--------|
27+
| development | `^0.5` | `master` | `3.0+` | `^7.2` |
28+
| stable | `^0.4` | `master` | `2.4` | `^7.1` |
3729

3830
## Maintainers
3931

@@ -58,6 +50,4 @@ composer require nettrine/annotations
5850
</tbody>
5951
</table>
6052

61-
-----
62-
6353
Thank you for testing, reporting and contributing.

composer.json

+17-26
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,20 @@
1212
}
1313
],
1414
"require": {
15-
"php": ">=7.1",
16-
"doctrine/annotations": "^1.6.0",
15+
"php": "^7.2",
16+
"doctrine/annotations": "^1.6.1",
1717
"doctrine/cache": "^1.8.0",
18-
"nette/di": "^2.4.14"
18+
"nette/di": "~3.0.0"
1919
},
2020
"require-dev": {
21-
"ninjify/qa": "^0.8.0",
22-
"ninjify/nunjuck": "^0.2.0",
23-
"phpstan/phpstan-shim": "^0.10.6",
24-
"phpstan/phpstan-deprecation-rules": "^0.10.2",
25-
"phpstan/phpstan-nette": "^0.10.1",
26-
"phpstan/phpstan-strict-rules": "^0.10.1"
21+
"mockery/mockery": "^1.2.2",
22+
"ninjify/qa": "^0.9.0",
23+
"phpstan/extension-installer": "^1.0",
24+
"phpstan/phpstan-deprecation-rules": "^0.11.0",
25+
"phpstan/phpstan-nette": "^0.11.0",
26+
"phpstan/phpstan-shim": "^0.11.5",
27+
"phpstan/phpstan-strict-rules": "^0.11.0",
28+
"phpunit/phpunit": "^8.1.0"
2729
},
2830
"autoload": {
2931
"psr-4": {
@@ -32,30 +34,19 @@
3234
},
3335
"autoload-dev": {
3436
"psr-4": {
35-
"Tests\\Nettrine\\Annotations\\Cases\\": "tests/cases/",
36-
"Tests\\Nettrine\\Annotations\\Fixtures\\": "tests/fixtures/"
37+
"Tests\\Cases\\": "tests/cases",
38+
"Tests\\Fixtures\\": "tests/fixtures",
39+
"Tests\\Toolkit\\": "tests/toolkit"
3740
}
3841
},
3942
"minimum-stability": "dev",
4043
"prefer-stable": true,
41-
"scripts": {
42-
"qa": [
43-
"linter src tests",
44-
"codesniffer src tests"
45-
],
46-
"tests": [
47-
"tester -s -p php --colors 1 -C tests/cases"
48-
],
49-
"coverage": [
50-
"tester -s -p phpdbg --colors 1 -C --coverage ./coverage.xml --coverage-src ./src tests/cases"
51-
],
52-
"phpstan": [
53-
"vendor/bin/phpstan analyse -l max -c phpstan.neon src"
54-
]
44+
"config": {
45+
"sort-packages": true
5546
},
5647
"extra": {
5748
"branch-alias": {
58-
"dev-master": "0.5.x-dev"
49+
"dev-next": "0.5.x-dev"
5950
}
6051
}
6152
}

phpstan.neon

+3-9
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
includes:
2-
- vendor/phpstan/phpstan-deprecation-rules/rules.neon
3-
- vendor/phpstan/phpstan-nette/extension.neon
4-
- vendor/phpstan/phpstan-nette/rules.neon
5-
- vendor/phpstan/phpstan-strict-rules/rules.neon
6-
71
parameters:
8-
ignoreErrors:
9-
# No replacement available
10-
- '#Call to deprecated method registerUniqueLoader\(\) of class Doctrine\\Common\\Annotations\\AnnotationRegistry.#'
2+
ignoreErrors:
3+
# No replacement available
4+
- '#Call to deprecated method registerUniqueLoader\(\) of class Doctrine\\Common\\Annotations\\AnnotationRegistry.#'

ruleset.xml

+13-16
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11
<?xml version="1.0"?>
2-
<ruleset name="Nettrine">
3-
<!-- Contributte Coding Standard -->
4-
<rule ref="./vendor/ninjify/coding-standard/contributte.xml"/>
2+
<ruleset>
3+
<!-- Contributte Coding Standard -->
4+
<rule ref="./vendor/ninjify/coding-standard/contributte.xml"/>
55

6-
<!-- Specific -->
7-
<rule ref="SlevomatCodingStandard.Files.TypeNameMatchesFileName">
8-
<properties>
9-
<property name="rootNamespaces" type="array" value="
10-
src=>Nettrine\Annotations,
11-
tests/cases=>Tests\Nettrine\Annotations\Cases,
12-
tests/fixtures=>Tests\Nettrine\Annotations\Fixtures
13-
"/>
14-
<property name="extensions" type="array" value="php,phpt"/>
15-
</properties>
16-
</rule>
6+
<rule ref="SlevomatCodingStandard.Files.TypeNameMatchesFileName">
7+
<properties>
8+
<property name="rootNamespaces" type="array" value="
9+
src=>Nettrine\Annotations,
10+
tests/cases=>Tests\Cases,
11+
tests/fixtures=>Tests\Fixtures,
12+
tests/toolkit=>Tests\Toolkit
13+
"/>
14+
</properties>
15+
</rule>
1716

18-
<!--Exclude folders -->
19-
<exclude-pattern>/tests/tmp</exclude-pattern>
2017
</ruleset>

0 commit comments

Comments
 (0)