Skip to content

Commit

Permalink
Merge pull request #46 from UseMuffin/cake-4.x
Browse files Browse the repository at this point in the history
Cake 4.x
  • Loading branch information
ADmad committed Sep 25, 2023
2 parents f0f252d + 3e4292c commit 4aac217
Show file tree
Hide file tree
Showing 30 changed files with 342 additions and 161 deletions.
7 changes: 2 additions & 5 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@ root = true
[*]
indent_style = space
indent_size = 4
charset = "utf-8"
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.bat]
end_of_line = crlf

[*.yml]
indent_style = space
indent_size = 2
indent_size = 2
5 changes: 4 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# Remove files for archives generated using `git archive`
CONTRIBUTING.md export-ignore
.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.semver export-ignore
phpunit.xml.dist export-ignore
.travis.yml export-ignore
.scrutinizer.yml export-ignore
tests export-ignore
docs export-ignore
.github export-ignore
10 changes: 7 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/composer.lock
/plugins
/vendor
*.pyc
docs/_build
phpunit.xml
vendor/
composer.lock
tmp
.phpunit.result.cache
11 changes: 0 additions & 11 deletions .stickler.yml

This file was deleted.

40 changes: 20 additions & 20 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
language: php

php:
- 5.6
- 7.0
- 7.1
- 7.2
- 7.3
- 7.4

services:
- mysql
Expand All @@ -19,40 +18,41 @@ env:
global:
- DEFAULT=1

services:
- mysql
- postgresql

matrix:
fast_finish: true

include:
- php: 7.1
- php: 7.3
env: PHPCS=1 DEFAULT=0

- php: 7.1
env: PHPSTAN=1 DEFAULT=0

- php: 5.6
env: PREFER_LOWEST=1
- php: 7.3
env: STATIC_ANALYSIS=1 DEFAULT=0

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

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

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

- if [[ $PHPCS = 1 ]]; then composer require cakephp/cakephp-codesniffer:^3.0; fi
- if [[ $PHPSTAN = 1 ]]; then composer require phpstan/phpstan; fi
- if [[ $PHPCS == 1 ]]; then composer require cakephp/cakephp-codesniffer:^4.0; fi
- if [[ $STATIC_ANALYSIS == 1 ]]; then composer require --dev phpstan/phpstan:^0.12 psalm/phar:^3.8; fi

script:
- if [[ $DEFAULT = 1 && $TRAVIS_PHP_VERSION != 7.0 ]]; then vendor/bin/phpunit; fi
- if [[ $DEFAULT = 1 && $TRAVIS_PHP_VERSION = 7.0 ]]; then vendor/bin/phpunit --coverage-clover=clover.xml; fi
- if [[ $DEFAULT == 1 && $TRAVIS_PHP_VERSION != 7.2 ]]; then vendor/bin/phpunit; fi

- if [[ $PHPCS == 1 ]]; then vendor/bin/phpcs -p --standard=vendor/cakephp/cakephp-codesniffer/CakePHP ./src ./tests; fi

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

after_success:
- if [[ $DEFAULT = 1 && $TRAVIS_PHP_VERSION = 7.0 ]]; then bash <(curl -s https://codecov.io/bash); fi
- if [[ $DEFAULT == 1 && $TRAVIS_PHP_VERSION == 7.2 ]]; then bash <(curl -s https://codecov.io/bash); fi

notifications:
email: false
68 changes: 68 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# How to contribute

Tags loves to welcome your contributions. There are several ways to help out:
* Create a ticket in GitHub, if you have found a bug
* Write testcases for open bug tickets
* Write patches for open bug/feature tickets, preferably with testcases included
* Contribute to the documentation/readme

There are a few guidelines that we need contributors to follow so that we have a
chance of keeping on top of things.

## Getting Started

* Make sure you have a [GitHub account](https://github.com/signup/free)
* Submit a ticket for your issue, assuming one does not already exist.
* Clearly describe the issue including steps to reproduce when it is a bug.
* Make sure you fill in the earliest version that you know has the issue.
* Fork the repository on GitHub.

## Making Changes

* Create a topic branch from where you want to base your work.
* This is usually the develop branch
* To quickly create a topic branch based on master; `git branch
master/my_contribution master` then checkout the new branch with `git
checkout master/my_contribution`. Better avoid working directly on the
`master` branch, to avoid conflicts if you pull in updates from origin.
* Make commits of logical units.
* Check for unnecessary whitespace with `git diff --check` before committing.
* Use descriptive commit messages and reference the #ticket number
* Core testcases should continue to pass. You can run tests locally or enable
[travis-ci](https://travis-ci.org/) for your fork, so all tests and codesniffs
will be executed.
* Your work should apply the CakePHP coding standards.

## Which branch to base the work

* Bugfix branches will be based on develop branch.
* New features that are backwards compatible will be based on develop branch
* New features or other non-BC changes will go in the next major release branch.

## Submitting Changes

* Push your changes to a topic branch in your fork of the repository.
* Submit a pull request to the repository with the correct target branch.

## Testcases and codesniffer

Tags tests requires [PHPUnit](http://www.phpunit.de/manual/current/en/installation.html)
8.5.0 or higher. To run the testcases locally use the following command:

phpunit

To run the sniffs for CakePHP coding standards

phpcs -n -p --extensions=php --standard=vendor/cakephp/cakephp-codesniffer/CakePHP --ignore=vendor --ignore=docs src/ tests/

Check the [cakephp-codesniffer](https://github.com/cakephp/cakephp-codesniffer)
repository to setup the CakePHP standard. The README contains installation info
for the sniff and phpcs.

# Additional Resources

* [CakePHP coding standards](https://book.cakephp.org/4/en/contributing/cakephp-coding-conventions.html)
* [Bug tracker](https://github.com/UseMuffin/Tags/issues)
* [General GitHub documentation](https://help.github.com/)
* [GitHub pull request documentation](https://help.github.com/send-pull-requests/)
* #cakephp IRC channel on freenode.org
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2015 Use Muffin
Copyright (c) 2015-Present Use Muffin

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,16 @@ composer require muffin/tags

You then need to load the plugin. You can use the shell command:

```php
```
bin/cake plugin load Muffin/Tags
```

or by manually adding the following line to `src/Application.php`:

```php
$this->addPlugin('Muffin/Obfuscate');
```

## Usage

## Quick Start Guide
Expand Down Expand Up @@ -63,7 +69,7 @@ http://github.com/usemuffin/tags/issues

## License

Copyright (c) 2015, [Use Muffin] and licensed under [The MIT License][mit].
Copyright (c) 2015-Present, [Use Muffin] and licensed under [The MIT License][mit].

[cakephp]:http://cakephp.org
[composer]:http://getcomposer.org
Expand Down
104 changes: 57 additions & 47 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,48 +1,58 @@
{
"name" : "muffin/tags",
"description" : "Tags plugin for CakePHP 3.x",
"type" : "cakephp-plugin",
"keywords" : [
"cakephp",
"muffin",
"tags"
],
"homepage" : "https://github.com/usemuffin/tags",
"license" : "MIT",
"authors" : [{
"name" : "Jad Bitar",
"homepage" : "http://jadb.io",
"role" : "Author"
}, {
"name" : "ADmad",
"homepage" : "https://github.com/ADmad",
"role" : "Author"
}, {
"name" : "Others",
"homepage" : "https://github.com/usemuffin/tags/graphs/contributors"
}
],
"support" : {
"issues" : "https://github.com/usemuffin/tags/issues",
"source" : "https://github.com/usemuffin/tags"
},
"require" : {
"cakephp/orm" : "^3.5",
"cakephp/migrations" : "^2.0"
},
"require-dev" : {
"cakephp/cakephp" : "^3.5",
"phpunit/phpunit" : "^5.7.14|^6.0",
"muffin/slug" : "^1.4"
},
"autoload" : {
"psr-4" : {
"Muffin\\Tags\\" : "src"
}
},
"autoload-dev" : {
"psr-4" : {
"Muffin\\Tags\\Test\\" : "tests"
}
}
}
"name": "muffin/tags",
"description": "Tags plugin for CakePHP",
"type": "cakephp-plugin",
"keywords": [
"cakephp",
"muffin",
"tags"
],
"homepage": "https://github.com/usemuffin/tags",
"license": "MIT",
"authors": [
{
"name": "Jad Bitar",
"homepage": "http://jadb.io",
"role": "Author"
},
{
"name": "ADmad",
"homepage": "https://github.com/ADmad",
"role": "Author"
},
{
"name": "Others",
"homepage": "https://github.com/usemuffin/tags/graphs/contributors"
}
],
"support": {
"issues": "https://github.com/usemuffin/tags/issues",
"source": "https://github.com/usemuffin/tags"
},
"require": {
"cakephp/orm": "^4.0",
"cakephp/utility": "^4.0"
},
"require-dev": {
"cakephp/cakephp": "^4.0",
"cakephp/cakephp-codesniffer": "^4.0",
"phpunit/phpunit": "~8.5.0"
},
"suggest": {
"muffin/slug": "For adding slugs to tags"
},
"autoload": {
"psr-4": {
"Muffin\\Tags\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Muffin\\Tags\\Test\\": "tests",
"Muffin\\Tags\\Test\\App\\": "tests/test_app/src"
}
},
"config": {
"sort-packages": true
}
}
4 changes: 4 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
parameters:
level: 6
checkGenericClassInNonGenericObjectType: false
checkMissingIterableValueType: false
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
>

<testsuites>
<testsuite name="Tags Test Cases">
<testsuite name="Muffin/Tags Test Cases">
<directory>./tests/</directory>
</testsuite>
</testsuites>
Expand Down
29 changes: 29 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0"?>
<psalm
totallyTyped="false"
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>

<issueHandlers>
<MissingClosureReturnType errorLevel="info" />

<PropertyNotSetInConstructor errorLevel="info" />
<MissingConstructor errorLevel="info" />
<MissingClosureParamType errorLevel="info" />

<DocblockTypeContradiction errorLevel="info" />
<RedundantConditionGivenDocblockType errorLevel="info" />

<UndefinedPropertyFetch errorLevel="info" />
<UndefinedThisPropertyFetch errorLevel="info" />
<UndefinedPropertyAssignment errorLevel="info" />
</issueHandlers>
</psalm>
Loading

0 comments on commit 4aac217

Please sign in to comment.