-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
21 changed files
with
1,676 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,12 @@ | ||
; top-most EditorConfig file | ||
root = true | ||
|
||
; Unix-style newlines | ||
[*] | ||
end_of_line = lf | ||
|
||
[*.php] | ||
indent_style = space | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true |
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,3 @@ | ||
.gitattributes export-ignore | ||
.github/ export-ignore | ||
tests/ export-ignore |
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,106 @@ | ||
name: build | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
- master | ||
- feature/** | ||
- bugfix/** | ||
- release/** | ||
paths: | ||
- src/** | ||
- tests/** | ||
- .github/workflows/build.yml | ||
pull_request: | ||
branches: | ||
- develop | ||
paths: | ||
- src/** | ||
- tests/** | ||
|
||
jobs: | ||
main: | ||
name: Build [PHP ${{ matrix.php-versions }}] | ||
runs-on: ubuntu-latest | ||
if: "!contains(github.event.head_commit.message, '[ci skip]')" | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
php-versions: ['7.3', '7.4'] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP, with composer and extensions | ||
uses: shivammathur/setup-php@master | ||
with: | ||
php-version: ${{ matrix.php-versions }} | ||
tools: composer | ||
extensions: curl, intl, mbstring, xdebug | ||
coverage: xdebug | ||
|
||
- name: Validate composer.json | ||
run: composer validate --strict | ||
|
||
- name: Get composer cache directory | ||
id: composer-cache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
|
||
- name: Create composer cache directory | ||
run: mkdir -p ${{ steps.composer-cache.outputs.dir }} | ||
|
||
- name: Cache composer dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | ||
restore-keys: ${{ runner.os }}-composer- | ||
|
||
- name: Create PHPStan cache directory | ||
run: mkdir -p build/phpstan | ||
|
||
- name: Cache PHPStan cache directory | ||
uses: actions/cache@v2 | ||
with: | ||
path: build/phpstan | ||
key: ${{ runner.os }}-phpstan-${{ github.sha }} | ||
restore-keys: ${{ runner.os }}-phpstan- | ||
|
||
- name: Setup Composer's GitHub OAuth access | ||
run: composer config --global github-oauth.github.com ${{ secrets.ACCESS_TOKEN }} | ||
|
||
- name: Install dependencies | ||
run: composer update --ansi --no-scripts --no-interaction | ||
|
||
- name: Run PHP-CS-Fixer | ||
run: vendor/bin/php-cs-fixer fix --ansi --config=.php_cs.dist --verbose --dry-run --using-cache=no | ||
|
||
- name: Run PHPStan Static Analysis Check | ||
run: vendor/bin/phpstan analyse --ansi | ||
|
||
- name: Run NexusPHP CS Config TestSuite | ||
run: vendor/bin/phpunit --colors=always | ||
|
||
- name: Run Coveralls | ||
run: | | ||
composer global require --ansi php-coveralls/php-coveralls | ||
php-coveralls --coverage_clover=build/logs/clover.xml -v | ||
env: | ||
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
COVERALLS_PARALLEL: true | ||
COVERALLS_FLAG_NAME: PHP ${{ matrix.php-versions }} | ||
|
||
coveralls-finish: | ||
name: Coveralls Finished | ||
needs: [main] | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Upload to Coveralls API | ||
uses: coverallsapp/github-action@master | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
parallel-finished: true |
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,26 @@ | ||
name: release | ||
|
||
on: | ||
push: | ||
tags: | ||
- '**' | ||
|
||
jobs: | ||
build: | ||
name: Create a release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Create release | ||
uses: actions/create-release@latest | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: NexusPHP CS Config ${{ github.ref }} | ||
draft: false | ||
prerelease: false | ||
body: | | ||
Please refer to the CHANGELOG for the detailed list of changes. |
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,50 @@ | ||
#------------------------- | ||
# Test Files | ||
#------------------------- | ||
phpunit | ||
build/ | ||
/phpunit*.xml | ||
/.phpunit.*.cache | ||
|
||
#------------------------- | ||
# Composer | ||
#------------------------- | ||
vendor/ | ||
composer.lock | ||
|
||
#------------------------- | ||
# IDE / Development Files | ||
#------------------------- | ||
|
||
# Jetbrains editors (PHPStorm, etc) | ||
.idea/ | ||
*.iml | ||
|
||
# Netbeans | ||
nbproject/ | ||
nbbuild/ | ||
dist/ | ||
nbdist/ | ||
nbactions.xml | ||
nb-configuration.xml | ||
.nb-gradle/ | ||
|
||
# Sublime Text | ||
*.tmlanguage.cache | ||
*.tmPreferences.cache | ||
*.stTheme.cache | ||
*.sublime-workspace | ||
*.sublime-project | ||
.phpintel | ||
/api/ | ||
|
||
# Visual Studio Code | ||
.vscode/ | ||
|
||
#------------------------- | ||
# Others | ||
#------------------------- | ||
|
||
# php-cs-fixer | ||
.php_cs | ||
.php_cs.cache |
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,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* This file is part of NexusPHP CS Config. | ||
* | ||
* (c) 2020 John Paul E. Balandan, CPA <[email protected]> | ||
* | ||
* For the full copyright and license information, please view | ||
* the LICENSE file that was distributed with this source code. | ||
*/ | ||
|
||
use Nexus\CsConfig\Factory; | ||
use Nexus\CsConfig\Ruleset\Nexus73; | ||
use PhpCsFixer\Finder; | ||
|
||
$finder = Finder::create() | ||
->files() | ||
->in(__DIR__) | ||
->exclude(['build']) | ||
->append([__FILE__]) | ||
; | ||
|
||
$options = [ | ||
'finder' => $finder, | ||
'cacheFile' => 'build/.php_cs.cache', | ||
]; | ||
|
||
return Factory::create(new Nexus73(), [], $options)->forLibrary( | ||
'NexusPHP CS Config', | ||
'John Paul E. Balandan, CPA', | ||
'[email protected]', | ||
2020 | ||
); |
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,13 @@ | ||
# Changelog | ||
|
||
All notable changes to this library will be documented in this file: | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## v2.0.0 - 2020-11-28 | ||
|
||
### Changed | ||
|
||
- Initial release in this repository. See [MIGRATION](MIGRATION.md) for the detailed changes | ||
from its predecessor library. |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 John Paul E. Balandan, CPA | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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 @@ | ||
# Migrating from Liaison CS Config Factory | ||
|
||
The following were the changes implemented in considering the transition to NexusPHP CS Config: | ||
|
||
## Added | ||
|
||
- Public methods `forProjects` and `forLibrary` were added to `Factory` class. | ||
- `forProjects` accepts no arguments and acts as the old `Factory::create`. | ||
- `forLibrary` accepts two required and two optional arguments and behaves as the old `Factory::createForLibrary`. | ||
- The `Nexus73` ruleset is added and meant for use in PHP 7.3+. | ||
- `declare(strict_types=1)` was added to all PHP files for additional type safety. | ||
|
||
## Changed | ||
|
||
- Root namespace of `Liaison\CS\Config` was renamed to `Nexus\CsConfig`. | ||
- `Factory::create` now returns an instance of `Factory` instead of `PhpCsFixer\Config`. This allows it | ||
to be chained with either `forProjects` or `forLibrary` public methods. | ||
|
||
## Removed | ||
|
||
- `Factory::createForLibrary` was removed. Use the public method `forLibrary` to get similar effect. | ||
- The `Liaison` and `CodeIgniter4` rulesets were removed. | ||
- The deprecated `BaseRuleset` class was removed. | ||
- Custom fixers were removed and moved to a new repository, [NexusPHP CS Fixers][1]. | ||
|
||
[1]: https://github.com/NexusPHP/cs-fixers | ||
|
||
Please have a look at this library's [`.php_cs.dist`](.php_cs.dist) to have a glance of the new changes | ||
in action. You can also refer to the [README](README.md) for additional details. |
Oops, something went wrong.