Skip to content

Commit b9e33bc

Browse files
committed
refactor: upgrade for cake4
1 parent 6fb7673 commit b9e33bc

26 files changed

+401
-125
lines changed

.editorconfig

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
; This file is for unifying the coding style for different editors and IDEs.
22
; More information at http://editorconfig.org
33

4-
root = true
4+
root = false
55

66
[*]
77
indent_style = space
88
indent_size = 4
9+
charset = "utf-8"
910
end_of_line = lf
1011
insert_final_newline = true
1112
trim_trailing_whitespace = true
1213

13-
[*.bat]
14-
end_of_line = crlf
15-
1614
[*.yml]
1715
indent_style = space
18-
indent_size = 2
16+
indent_size = 2

.gitattributes

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
# Remove files for archives generated using `git archive`
2+
CONTRIBUTING.md export-ignore
23
.editorconfig export-ignore
34
.gitattributes export-ignore
45
.gitignore export-ignore
5-
.semver export-ignore
66
phpunit.xml.dist export-ignore
77
.travis.yml export-ignore
8+
.scrutinizer.yml export-ignore
89
tests export-ignore
10+
docs export-ignore
11+
.github export-ignore

.gitignore

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1-
/composer.lock
2-
/plugins
3-
/vendor
1+
*.pyc
2+
docs/_build
3+
phpunit.xml
4+
vendor/
5+
composer.lock
6+
tmp
7+
.phpunit.result.cache

.scrutinizer.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
imports:
2+
- php
3+
4+
filter:
5+
excluded_paths:
6+
- docs/
7+
- tests/
8+
tools:
9+
php_mess_detector: true
10+
php_cpd:
11+
excluded_dirs:
12+
- docs/
13+
- tests/
14+
php_loc:
15+
excluded_dirs:
16+
- docs/
17+
- tests/
18+
php_pdepend:
19+
excluded_dirs:
20+
1: docs/
21+
2: tests/

.travis.yml

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
language: php
22

33
php:
4-
- 5.6
5-
- 7.0
6-
- 7.1
74
- 7.2
5+
- 7.3
6+
- 7.4
87

98
env:
109
matrix:
@@ -15,40 +14,52 @@ env:
1514
global:
1615
- DEFAULT=1
1716

17+
services:
18+
- mysql
19+
- postgresql
20+
1821
matrix:
1922
fast_finish: true
2023

2124
include:
22-
- php: 7.1
25+
- php: 7.2
2326
env: PHPCS=1 DEFAULT=0
2427

25-
- php: 7.1
26-
env: PHPSTAN=1 DEFAULT=0
27-
28-
- php: 5.6
29-
env: PREFER_LOWEST=1
28+
- php: 7.2
29+
env: STATIC_ANALYSIS=1 DEFAULT=0
3030

3131
before_script:
32-
- if [[ $TRAVIS_PHP_VERSION != 7.0 ]]; then phpenv config-rm xdebug.ini; fi
32+
- if [[ $TRAVIS_PHP_VERSION != 7.2 ]]; then phpenv config-rm xdebug.ini; fi
3333

34-
- if [[ $PREFER_LOWEST != 1 ]]; then composer update --no-interaction ; fi
35-
- if [[ $PREFER_LOWEST == 1 ]]; then composer update --no-interaction --prefer-lowest ; fi
34+
- if [[ $PREFER_LOWEST != 1 ]]; then composer update --no-interaction; fi
35+
- if [[ $PREFER_LOWEST == 1 ]]; then composer update --no-interaction --prefer-lowest --prefer-stable; fi
3636

37-
- if [[ $DB = 'mysql' ]]; then mysql -e 'CREATE DATABASE cakephp_test;'; fi
37+
- if [[ $DB = 'mysql' ]]; then mysql -u root -e 'CREATE DATABASE cakephp_test;'; fi
3838
- if [[ $DB = 'pgsql' ]]; then psql -c 'CREATE DATABASE cakephp_test;' -U postgres; fi
3939

40-
- if [[ $PHPCS = 1 ]]; then composer require cakephp/cakephp-codesniffer; fi
41-
- if [[ $PHPSTAN = 1 ]]; then composer require phpstan/phpstan; fi
40+
- if [[ $PHPCS = 1 ]]; then composer require cakephp/cakephp-codesniffer:^4.0; fi
41+
- if [[ $STATIC_ANALYSIS = 1 ]]; then composer require --dev phpstan/phpstan:^0.12 psalm/phar:^3.7; fi
4242

4343
script:
44-
- if [[ $DEFAULT = 1 && $TRAVIS_PHP_VERSION != 7.0 ]]; then vendor/bin/phpunit; fi
45-
- if [[ $DEFAULT = 1 && $TRAVIS_PHP_VERSION = 7.0 ]]; then vendor/bin/phpunit --coverage-clover=clover.xml; fi
44+
- |
45+
if [[ $DEFAULT = 1 && $TRAVIS_PHP_VERSION = 7.2 ]]; then
46+
mkdir -p build/logs
47+
vendor/bin/phpunit --coverage-clover=build/logs/clover.xml
48+
fi
49+
50+
- if [[ $DEFAULT = 1 && $TRAVIS_PHP_VERSION != 7.2 ]]; then vendor/bin/phpunit; fi
4651

4752
- if [[ $PHPCS = 1 ]]; then vendor/bin/phpcs -p --standard=vendor/cakephp/cakephp-codesniffer/CakePHP ./src ./tests; fi
48-
- if [[ $PHPSTAN = 1 ]]; then vendor/bin/phpstan analyse -l 5 src; fi
53+
54+
- if [[ $STATIC_ANALYSIS = 1 ]]; then vendor/bin/phpstan.phar analyse src && vendor/bin/psalm.phar --show-info=false; fi
4955

5056
after_success:
51-
- if [[ $DEFAULT = 1 && $TRAVIS_PHP_VERSION = 7.0 ]]; then bash <(curl -s https://codecov.io/bash); fi
57+
- |
58+
if [[ $DEFAULT = 1 && $TRAVIS_PHP_VERSION = 7.2 ]]; then
59+
wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.1.0/php-coveralls.phar
60+
chmod +x php-coveralls.phar
61+
./php-coveralls.phar
62+
fi
5263
5364
notifications:
5465
email: false

CONTRIBUTING.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# How to contribute
2+
3+
Tags loves to welcome your contributions. There are several ways to help out:
4+
* Create a ticket in GitHub, if you have found a bug
5+
* Write testcases for open bug tickets
6+
* Write patches for open bug/feature tickets, preferably with testcases included
7+
* Contribute to the [documentation](https://github.com/UseMuffin/Tags/tree/gh-pages)
8+
9+
There are a few guidelines that we need contributors to follow so that we have a
10+
chance of keeping on top of things.
11+
12+
## Getting Started
13+
14+
* Make sure you have a [GitHub account](https://github.com/signup/free)
15+
* Submit a ticket for your issue, assuming one does not already exist.
16+
* Clearly describe the issue including steps to reproduce when it is a bug.
17+
* Make sure you fill in the earliest version that you know has the issue.
18+
* Fork the repository on GitHub.
19+
20+
## Making Changes
21+
22+
* Create a topic branch from where you want to base your work.
23+
* This is usually the develop branch
24+
* To quickly create a topic branch based on master; `git branch
25+
master/my_contribution master` then checkout the new branch with `git
26+
checkout master/my_contribution`. Better avoid working directly on the
27+
`master` branch, to avoid conflicts if you pull in updates from origin.
28+
* Make commits of logical units.
29+
* Check for unnecessary whitespace with `git diff --check` before committing.
30+
* Use descriptive commit messages and reference the #ticket number
31+
* Core testcases should continue to pass. You can run tests locally or enable
32+
[travis-ci](https://travis-ci.org/) for your fork, so all tests and codesniffs
33+
will be executed.
34+
* Your work should apply the CakePHP coding standards.
35+
36+
## Which branch to base the work
37+
38+
* Bugfix branches will be based on develop branch.
39+
* New features that are backwards compatible will be based on develop branch
40+
* New features or other non-BC changes will go in the next major release branch.
41+
42+
## Submitting Changes
43+
44+
* Push your changes to a topic branch in your fork of the repository.
45+
* Submit a pull request to the repository with the correct target branch.
46+
47+
## Testcases and codesniffer
48+
49+
Tags tests requires [PHPUnit](http://www.phpunit.de/manual/current/en/installation.html)
50+
8.5.0 or higher. To run the testcases locally use the following command:
51+
52+
phpunit
53+
54+
To run the sniffs for CakePHP coding standards
55+
56+
phpcs -n -p --extensions=php --standard=vendor/cakephp/cakephp-codesniffer/CakePHP --ignore=vendor --ignore=docs src/ tests/
57+
58+
Check the [cakephp-codesniffer](https://github.com/cakephp/cakephp-codesniffer)
59+
repository to setup the CakePHP standard. The README contains installation info
60+
for the sniff and phpcs.
61+
62+
## Documentation
63+
64+
You can build the documentation using Docker via the following commands:
65+
66+
# go to the docs dir
67+
cd docs
68+
69+
# build the docs
70+
docker build .
71+
72+
# make the html
73+
docker run -it --rm -v $(pwd)/docs:/data UseMuffin/Tags make html
74+
75+
# open the generated html docs in docs/_build/html
76+
77+
# Additional Resources
78+
79+
* [CakePHP coding standards](https://book.cakephp.org/4/en/contributing/cakephp-coding-conventions.html)
80+
* [Bug tracker](https://github.com/UseMuffin/Tags/issues)
81+
* [General GitHub documentation](https://help.github.com/)
82+
* [GitHub pull request documentation](https://help.github.com/send-pull-requests/)
83+
* #cakephp IRC channel on freenode.org

composer.json

Lines changed: 60 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,61 @@
11
{
2-
"name" : "muffin/tags",
3-
"description" : "Tags plugin for CakePHP 3.x",
4-
"type" : "cakephp-plugin",
5-
"keywords" : [
6-
"cakephp",
7-
"muffin",
8-
"tags"
9-
],
10-
"homepage" : "https://github.com/usemuffin/tags",
11-
"license" : "MIT",
12-
"authors" : [{
13-
"name" : "Jad Bitar",
14-
"homepage" : "http://jadb.io",
15-
"role" : "Author"
16-
}, {
17-
"name" : "ADmad",
18-
"homepage" : "https://github.com/ADmad",
19-
"role" : "Author"
20-
}, {
21-
"name" : "Others",
22-
"homepage" : "https://github.com/usemuffin/tags/graphs/contributors"
23-
}
24-
],
25-
"support" : {
26-
"issues" : "https://github.com/usemuffin/tags/issues",
27-
"source" : "https://github.com/usemuffin/tags"
28-
},
29-
"require" : {
30-
"cakephp/orm" : "^3.5",
31-
"cakephp/migrations" : "^2.0"
32-
},
33-
"require-dev" : {
34-
"cakephp/cakephp" : "^3.5",
35-
"phpunit/phpunit" : "^5.7.14|^6.0",
36-
"muffin/slug" : "^1.4"
37-
},
38-
"autoload" : {
39-
"psr-4" : {
40-
"Muffin\\Tags\\" : "src"
41-
}
42-
},
43-
"autoload-dev" : {
44-
"psr-4" : {
45-
"Muffin\\Tags\\Test\\" : "tests"
46-
}
47-
}
48-
}
2+
"name": "muffin/tags",
3+
"description": "Tags plugin for CakePHP 3.x",
4+
"type": "cakephp-plugin",
5+
"keywords": [
6+
"cakephp",
7+
"muffin",
8+
"tags"
9+
],
10+
"homepage": "https://github.com/usemuffin/tags",
11+
"license": "MIT",
12+
"authors": [
13+
{
14+
"name": "Jad Bitar",
15+
"homepage": "http://jadb.io",
16+
"role": "Author"
17+
},
18+
{
19+
"name": "ADmad",
20+
"homepage": "https://github.com/ADmad",
21+
"role": "Author"
22+
},
23+
{
24+
"name": "Others",
25+
"homepage": "https://github.com/usemuffin/tags/graphs/contributors"
26+
}
27+
],
28+
"support": {
29+
"issues": "https://github.com/usemuffin/tags/issues",
30+
"source": "https://github.com/usemuffin/tags"
31+
},
32+
"require": {
33+
"cakephp/orm": "^4.0",
34+
"cakephp/migrations": "^3.0"
35+
},
36+
"require-dev": {
37+
"cakephp/cakephp": "^4.0",
38+
"cakephp/cakephp-codesniffer": "^4.0",
39+
"phpstan/phpstan": "^0.12",
40+
"phpunit/phpunit": "~8.5.0",
41+
"psalm/phar": "^3.7"
42+
},
43+
"suggest": {
44+
"muffin/slug": "For adding slugs to tags"
45+
},
46+
"autoload": {
47+
"psr-4": {
48+
"Muffin\\Tags\\": "src"
49+
}
50+
},
51+
"autoload-dev": {
52+
"psr-4": {
53+
"Muffin\\Tags\\Test\\": "tests"
54+
}
55+
},
56+
"prefer-stable": true,
57+
"config": {
58+
"sort-packages": true
59+
},
60+
"minimum-stability": "dev"
61+
}

phpstan-baseline.neon

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
parameters:
2+
ignoreErrors: []

phpstan.neon

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
includes:
2+
- phpstan-baseline.neon
3+
4+
parameters:
5+
level: 6
6+
checkGenericClassInNonGenericObjectType: false
7+
checkMissingIterableValueType: false
8+
excludes_analyse:
9+
- */src/TestSuite/*

phpunit.xml.dist

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
>
77

88
<testsuites>
9-
<testsuite name="Tags Test Cases">
9+
<testsuite name="Muffin/Tags Test Cases">
1010
<directory>./tests/</directory>
1111
</testsuite>
1212
</testsuites>
@@ -25,6 +25,7 @@
2525
<filter>
2626
<whitelist>
2727
<directory suffix=".php">./src/</directory>
28+
<directory suffix=".ctp">./src/</directory>
2829
</whitelist>
2930
</filter>
3031
</phpunit>

0 commit comments

Comments
 (0)