Skip to content

Commit 3e93c78

Browse files
f3l1xMilan Felix Šulc
authored andcommitted
Refactoring to support Nette v3
1 parent b5c46ef commit 3e93c78

File tree

13 files changed

+200
-133
lines changed

13 files changed

+200
-133
lines changed

.docs/README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
# Application
1+
# Contributte Application
22

33
## Content
44

5+
- [Setup](#setup)
56
- [UI](#ui)
67
- [Presenter](#presenter)
78
- [StructuredTemplates](#structured-templates)
@@ -16,6 +17,12 @@
1617
- [XmlResponse](#xmlresponse)
1718
- [StringResponse](#stringresponse)
1819

20+
## Setup
21+
22+
```bash
23+
composer require contributte/application
24+
```
25+
1926
## UI
2027

2128
### Presenter
@@ -163,7 +170,6 @@ $this->sendResponse($response);
163170

164171
```php
165172
use Contributte\Application\Response\Fly\Adapter\CallbackAdapter;
166-
use Contributte\Application\Response\Fly\Buffer\Buffer;
167173
use Contributte\Application\Response\Fly\FlyFileResponse;
168174
use Nette\Http\IRequest;
169175
use Nette\Http\IResponse;

.gitattributes

Lines changed: 1 addition & 0 deletions
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

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,55 @@
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
15+
- make tests # Tests
1816

1917
after_failure:
20-
# Print *.actual content
21-
- for i in $(find tests -name \*.actual); do echo "--- $i"; cat $i; echo; echo; done
18+
- for i in $(find tests -name \*.actual); do echo "--- $i"; cat $i; echo; echo; done # Print *.actual content
2219

2320
jobs:
2421
include:
25-
- env: title="Lowest Dependencies 7.1"
26-
php: 7.1
22+
- env: title="Lowest Dependencies 7.2"
23+
php: 7.2
2724
install:
28-
- travis_retry composer update --no-progress --prefer-dist --prefer-lowest
25+
- travis_retry composer update --no-progress --prefer-dist --prefer-lowest --prefer-stable
2926
script:
30-
- composer run-script tests
27+
- make tests
3128

3229
- stage: Quality Assurance
33-
php: 7.1
30+
php: 7.3
3431
script:
35-
- composer run-script qa
36-
37-
- stage: Phpstan
38-
php: 7.1
39-
script:
40-
- composer run-script phpstan
32+
- make qa
4133

4234
- stage: Test Coverage
4335
if: branch = master AND type = push
44-
php: 7.1
36+
php: 7.3
4537
script:
46-
- composer run-script coverage
38+
- make coverage
4739
after_script:
48-
- wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.1.0/php-coveralls.phar
49-
- php php-coveralls.phar --verbose --config tests/.coveralls.yml
40+
- composer global require php-coveralls/php-coveralls ^2.1.0
41+
- ~/.composer/vendor/bin/php-coveralls --verbose --config tests/.coveralls.yml
5042

5143
- stage: Outdated Dependencies
5244
if: branch = master AND type = cron
53-
php: 7.1
45+
php: 7.3
5446
script:
55-
- composer outdated --direct --strict
47+
- composer outdated --direct
5648

5749
allow_failures:
5850
- stage: Test Coverage
51+
- php: 7.4snapshot
52+
- php: nightly
5953

6054
sudo: false
6155

Makefile

Lines changed: 27 additions & 0 deletions
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/tester -s -p php --colors 1 -C tests/cases
25+
26+
coverage: vendor
27+
vendor/bin/tester -s -p phpdbg --colors 1 -C --coverage ./coverage.xml --coverage-src ./src tests/cases

README.md

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,43 @@
1-
# Contributte > Application
1+
# Contributte Application
22

3-
:sparkles: Extra contribution to [`nette/application`](https://github.com/nette/application).
4-
5-
-----
3+
Extra contribution to [`nette/application`](https://github.com/nette/application).
64

75
[![Build Status](https://img.shields.io/travis/contributte/application.svg?style=flat-square)](https://travis-ci.org/contributte/application)
86
[![Code coverage](https://img.shields.io/coveralls/contributte/application.svg?style=flat-square)](https://coveralls.io/r/contributte/application)
97
[![Licence](https://img.shields.io/packagist/l/contributte/application.svg?style=flat-square)](https://packagist.org/packages/contributte/application)
108
[![Downloads this Month](https://img.shields.io/packagist/dm/contributte/application.svg?style=flat-square)](https://packagist.org/packages/contributte/application)
119
[![Downloads total](https://img.shields.io/packagist/dt/contributte/application.svg?style=flat-square)](https://packagist.org/packages/contributte/application)
1210
[![Latest stable](https://img.shields.io/packagist/v/contributte/application.svg?style=flat-square)](https://packagist.org/packages/contributte/application)
13-
[![PHPStan](https://img.shields.io/badge/PHPStan-enabled-brightgreen.svg?style=flat)](https://github.com/phpstan/phpstan)
11+
[![PHPStan](https://img.shields.io/badge/PHPStan-enabled-brightgreen.svg?style=flat-square)](https://github.com/phpstan/phpstan)
1412

1513
## Discussion / Help
1614

1715
[![Join the chat](https://img.shields.io/gitter/room/contributte/contributte.svg?style=flat-square)](http://bit.ly/ctteg)
1816

19-
## Install
17+
## Documentation
2018

21-
```
22-
composer require contributte/application
23-
```
19+
- [Setup](.docs/README.md#setup)
20+
- [UI](.docs/README.md#ui)
21+
- [Presenter](.docs/README.md#presenter)
22+
- [StructuredTemplates](.docs/README.md#structured-templates)
23+
- [Control](.docs/README.md#control)
24+
- [Component](.docs/README.md#component)
25+
- [Responses](.docs/README.md#responses)
26+
- [CSVResponse](.docs/README.md#csvresponse)
27+
- [ImageResponse](.docs/README.md#imageresponse)
28+
- [JsonPrettyResponse](.docs/README.md#psr7streamresponse)
29+
- [PSR7StreamResponse](.docs/README.md#flyresponse)
30+
- [FlyResponse - send file/buffer on-the-fly](.docs/README.md#flyresponse)
31+
- [XmlResponse](.docs/README.md#xmlresponse)
2432

2533
## Versions
2634

27-
| State | Version | Branch | PHP |
28-
|-------------|---------|----------|----------|
29-
| development | `^0.4` | `master` | `>= 7.1` |
30-
| stable | `^0.3` | `master` | `>= 7.1` |
31-
| stable | `^0.2` | `master` | `>= 5.6` |
32-
33-
## Overview
34-
35-
- [UI](https://github.com/contributte/application/blob/master/.docs/README.md#ui)
36-
- [Presenter](https://github.com/contributte/application/blob/master/.docs/README.md#presenter)
37-
- [StructuredTemplates](https://github.com/contributte/application/blob/master/.docs/README.md#structured-templates)
38-
- [Control](https://github.com/contributte/application/blob/master/.docs/README.md#control)
39-
- [Component](https://github.com/contributte/application/blob/master/.docs/README.md#component)
40-
- [Responses](https://github.com/contributte/application/blob/master/.docs/README.md#responses)
41-
- [CSVResponse](https://github.com/contributte/application/blob/master/.docs/README.md#csvresponse)
42-
- [ImageResponse](https://github.com/contributte/application/blob/master/.docs/README.md#imageresponse)
43-
- [JsonPrettyResponse](https://github.com/contributte/application/blob/master/.docs/README.md#psr7streamresponse)
44-
- [PSR7StreamResponse](https://github.com/contributte/application/blob/master/.docs/README.md#flyresponse)
45-
- [FlyResponse - send file/buffer on-the-fly](https://github.com/contributte/application/blob/master/.docs/README.md#flyresponse)
46-
- [XmlResponse](https://github.com/contributte/application/blob/master/.docs/README.md#xmlresponse)
35+
| State | Version | Branch | Nette | PHP |
36+
|-------------|---------|----------|-------|---------|
37+
| dev | `^0.5` | `master` | 3.0+ | `^7.2` |
38+
| stable | `^0.4` | `master` | 3.0+ | `^7.2` |
39+
| stable | `^0.3` | `master` | 2.4 | `>=7.1` |
40+
| stable | `^0.2` | `master` | 2.4 | `>=5.6` |
4741

4842
## Maintainers
4943

composer.json

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,45 +12,39 @@
1212
}
1313
],
1414
"require": {
15-
"php": ">= 7.1",
16-
"nette/application": "~2.4.11 || ~3.0.0"
15+
"php": "^7.2",
16+
"nette/application": "~3.0.0"
1717
},
1818
"require-dev": {
19-
"ninjify/qa": "^0.9.0",
20-
"ninjify/nunjuck": "^0.2.0",
2119
"nette/http": "~2.4.8 || ~3.0.0",
22-
"psr/http-message": "~1.0.1",
23-
"tracy/tracy": "~2.6.1",
24-
"phpstan/phpstan-shim": "^0.11.2",
20+
"ninjify/nunjuck": "^0.2.0",
21+
"ninjify/qa": "^0.9.0",
22+
"phpstan/extension-installer": "^1.0",
2523
"phpstan/phpstan-deprecation-rules": "^0.11.0",
2624
"phpstan/phpstan-nette": "^0.11.1",
27-
"phpstan/phpstan-strict-rules": "^0.11.0"
25+
"phpstan/phpstan-shim": "^0.11.2",
26+
"phpstan/phpstan-strict-rules": "^0.11.0",
27+
"psr/http-message": "~1.0.1",
28+
"tracy/tracy": "~2.6.1"
2829
},
2930
"autoload": {
3031
"psr-4": {
3132
"Contributte\\Application\\": "src"
3233
}
3334
},
35+
"autoload-dev": {
36+
"psr-4": {
37+
"Tests\\Cases\\": "tests/cases"
38+
}
39+
},
3440
"minimum-stability": "dev",
3541
"prefer-stable": true,
36-
"scripts": {
37-
"qa": [
38-
"linter src tests",
39-
"codesniffer src tests"
40-
],
41-
"tests": [
42-
"tester -s -p php --colors 1 -C tests/cases"
43-
],
44-
"coverage": [
45-
"tester -s -p phpdbg --colors 1 -C --coverage ./coverage.xml --coverage-src ./src tests/cases"
46-
],
47-
"phpstan": [
48-
"vendor/bin/phpstan analyse -l max -c phpstan.neon src"
49-
]
42+
"config": {
43+
"sort-packages": true
5044
},
5145
"extra": {
5246
"branch-alias": {
53-
"dev-master": "0.4.x-dev"
47+
"dev-next": "0.5.x-dev"
5448
}
5549
}
5650
}

phpstan.neon

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
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:
82
ignoreErrors:
93
- '#^Property Contributte\\Application\\Response\\Fly\\Buffer\\(FileBuffer|ProcessBuffer)\:\:\$pointer \(resource\) does not accept resource\|false\.$#'

ruleset.xml

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
<?xml version="1.0"?>
2-
<ruleset name="Contributte">
3-
<!-- Contributte Coding Standard -->
4-
<rule ref="./vendor/ninjify/coding-standard/contributte.xml">
5-
<exclude name="SlevomatCodingStandard.ControlStructures.RequireTernaryOperator.TernaryOperatorNotUsed" />
6-
<exclude name="SlevomatCodingStandard.PHP.TypeCast" />
7-
</rule>
2+
<ruleset>
3+
<!-- Contributte Coding Standard -->
4+
<rule ref="./vendor/ninjify/coding-standard/contributte.xml">
5+
<exclude name="SlevomatCodingStandard.ControlStructures.RequireTernaryOperator.TernaryOperatorNotUsed" />
6+
<exclude name="SlevomatCodingStandard.PHP.TypeCast" />
7+
</rule>
88

9-
<!-- Specific rules -->
10-
<rule ref="SlevomatCodingStandard.Files.TypeNameMatchesFileName">
11-
<properties>
12-
<property name="rootNamespaces" type="array" value="
13-
src=>Contributte\Application,
14-
tests/fixtures=>Tests\Fixtures
15-
"/>
16-
</properties>
17-
</rule>
9+
<!-- Specific rules -->
10+
<rule ref="SlevomatCodingStandard.Files.TypeNameMatchesFileName">
11+
<properties>
12+
<property name="rootNamespaces" type="array" value="
13+
src=>Contributte\Application,
14+
tests/cases=>Tests\Cases,
15+
tests/fixtures=>Tests\Fixtures
16+
"/>
17+
</properties>
18+
</rule>
1819

19-
<!--Exclude folders -->
20-
<exclude-pattern>/tests/tmp</exclude-pattern>
20+
<!--Exclude folders -->
21+
<exclude-pattern>/tests/tmp</exclude-pattern>
2122
</ruleset>

0 commit comments

Comments
 (0)