From b089e3ce0ee68da0e91cb6bb1041cb7269fe4780 Mon Sep 17 00:00:00 2001 From: Luiz Marin <67489841+luizcmarin@users.noreply.github.com> Date: Mon, 22 Apr 2024 17:08:29 -0300 Subject: [PATCH 1/3] Docs folder standardization and other fixes (#103) --- LICENSE.md | 8 ++++---- README.md | 46 ++++++++++++++-------------------------------- composer.json | 2 +- docs/internals.md | 45 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 64 insertions(+), 37 deletions(-) create mode 100644 docs/internals.md diff --git a/LICENSE.md b/LICENSE.md index bc5674f..6a920d6 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,17 +1,17 @@ -Copyright © 2008 by Yii Software (https://www.yiiframework.com/) +Copyright © 2008 by Yii Software () All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright +* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Yii Software nor the names of its +* Neither the name of Yii Software nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/README.md b/README.md index 701b0cb..d138d18 100644 --- a/README.md +++ b/README.md @@ -102,7 +102,7 @@ $result = $viewRenderer->renderPartialAsString('site/page', [ ]); ``` -### Change view templates path +### Change view templates path You can change view templates path in runtime as follows: @@ -119,7 +119,7 @@ If the view renderer is used in a controller, you can either specify controller `withControllerName()` or determine name automatically by passing a controller instance to `withController()`. In this case the name is determined as follows: -``` +```php App\Controller\FooBar\BazController -> foo-bar/baz App\Controllers\FooBar\BazController -> foo-bar/baz Path\To\File\BlogController -> blog @@ -270,39 +270,14 @@ $viewRenderer = $viewRenderer->withLocale('de_DE'); For more information about localization, see at the [localization](https://github.com/yiisoft/view/blob/master/docs/basic-functionality.md#localization) section in [yiisoft/view](https://github.com/yiisoft/view) package. -## Testing - -### Unit testing - -The package is tested with [PHPUnit](https://phpunit.de/). To run tests: - -```shell -./vendor/bin/phpunit -``` - -### Mutation testing - -The package tests are checked with [Infection](https://infection.github.io/) mutation framework with -[Infection Static Analysis Plugin](https://github.com/Roave/infection-static-analysis-plugin). To run it: - -```shell -./vendor/bin/roave-infection-static-analysis-plugin -``` - -### Static analysis - -The code is statically analyzed with [Psalm](https://psalm.dev/). To run static analysis: +## Documentation -```shell -./vendor/bin/psalm -``` +- [Internals](docs/internals.md) -## License +## Support -The Yii View Extension is free software. It is released under the terms of the BSD License. -Please see [`LICENSE`](./LICENSE.md) for more information. - -Maintained by [Yii Software](https://www.yiiframework.com/). +If you need help or have a question, the [Yii Forum](https://forum.yiiframework.com/c/yii-3-0/63) is a good place for that. +You may also check out other [Yii Community Resources](https://www.yiiframework.com/community). ## Support the project @@ -315,3 +290,10 @@ Maintained by [Yii Software](https://www.yiiframework.com/). [![Telegram](https://img.shields.io/badge/telegram-join-1DA1F2?style=flat&logo=telegram)](https://t.me/yii3en) [![Facebook](https://img.shields.io/badge/facebook-join-1DA1F2?style=flat&logo=facebook&logoColor=ffffff)](https://www.facebook.com/groups/yiitalk) [![Slack](https://img.shields.io/badge/slack-join-1DA1F2?style=flat&logo=slack)](https://yiiframework.com/go/slack) + +## License + +The Yii View Extension is free software. It is released under the terms of the BSD License. +Please see [`LICENSE`](./LICENSE.md) for more information. + +Maintained by [Yii Software](https://www.yiiframework.com/). diff --git a/composer.json b/composer.json index 7908af3..5f20cd0 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "issues": "https://github.com/yiisoft/yii-view/issues?state=open", "forum": "https://www.yiiframework.com/forum/", "wiki": "https://www.yiiframework.com/wiki/", - "irc": "irc://irc.freenode.net/yii", + "irc": "ircs://irc.libera.chat:6697/yii", "chat": "https://t.me/yii3en", "source": "https://github.com/yiisoft/yii-view" }, diff --git a/docs/internals.md b/docs/internals.md new file mode 100644 index 0000000..8dc4049 --- /dev/null +++ b/docs/internals.md @@ -0,0 +1,45 @@ +# Internals + +## Unit testing + +The package is tested with [PHPUnit](https://phpunit.de/). To run tests: + +```shell +./vendor/bin/phpunit +``` + +## Mutation testing + +The package tests are checked with [Infection](https://infection.github.io/) mutation framework with +[Infection Static Analysis Plugin](https://github.com/Roave/infection-static-analysis-plugin). To run it: + +```shell +./vendor/bin/roave-infection-static-analysis-plugin +``` + +## Static analysis + +The code is statically analyzed with [Psalm](https://psalm.dev/). To run static analysis: + +```shell +./vendor/bin/psalm +``` + +## Rector + +Use [Rector](https://github.com/rectorphp/rector) to make codebase follow some specific rules or +use either newest or any specific version of PHP: + +```shell +./vendor/bin/rector +``` + +## Composer require checker + +This package uses [composer-require-checker](https://github.com/maglnet/ComposerRequireChecker) to check if all dependencies are correctly defined in `composer.json`. + +To run the checker, execute the following command: + +```shell +./vendor/bin/composer-require-checker +``` From 137a4b5e0cd7eb43e07c906253a127a745de4e0b Mon Sep 17 00:00:00 2001 From: Sergei Predvoditelev Date: Fri, 3 May 2024 11:05:12 +0300 Subject: [PATCH 2/3] Fix docs (#104) --- LICENSE.md | 12 ++++++------ README.md | 20 +++++++++----------- docs/internals.md | 9 ++++----- 3 files changed, 19 insertions(+), 22 deletions(-) diff --git a/LICENSE.md b/LICENSE.md index 6a920d6..fa6ef0f 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -6,14 +6,14 @@ modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. * Neither the name of Yii Software nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT diff --git a/README.md b/README.md index d138d18..daeb777 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,7 @@ If the view renderer is used in a controller, you can either specify controller `withControllerName()` or determine name automatically by passing a controller instance to `withController()`. In this case the name is determined as follows: -```php +```text App\Controller\FooBar\BazController -> foo-bar/baz App\Controllers\FooBar\BazController -> foo-bar/baz Path\To\File\BlogController -> blog @@ -274,10 +274,15 @@ For more information about localization, see at the [localization](https://githu - [Internals](docs/internals.md) -## Support +If you need help or have a question, the [Yii Forum](https://forum.yiiframework.com/c/yii-3-0/63) is a good place for +that. You may also check out other [Yii Community Resources](https://www.yiiframework.com/community). + +## License -If you need help or have a question, the [Yii Forum](https://forum.yiiframework.com/c/yii-3-0/63) is a good place for that. -You may also check out other [Yii Community Resources](https://www.yiiframework.com/community). +The Yii View Extension is free software. It is released under the terms of the BSD License. +Please see [`LICENSE`](./LICENSE.md) for more information. + +Maintained by [Yii Software](https://www.yiiframework.com/). ## Support the project @@ -290,10 +295,3 @@ You may also check out other [Yii Community Resources](https://www.yiiframework. [![Telegram](https://img.shields.io/badge/telegram-join-1DA1F2?style=flat&logo=telegram)](https://t.me/yii3en) [![Facebook](https://img.shields.io/badge/facebook-join-1DA1F2?style=flat&logo=facebook&logoColor=ffffff)](https://www.facebook.com/groups/yiitalk) [![Slack](https://img.shields.io/badge/slack-join-1DA1F2?style=flat&logo=slack)](https://yiiframework.com/go/slack) - -## License - -The Yii View Extension is free software. It is released under the terms of the BSD License. -Please see [`LICENSE`](./LICENSE.md) for more information. - -Maintained by [Yii Software](https://www.yiiframework.com/). diff --git a/docs/internals.md b/docs/internals.md index 8dc4049..0a0a1cd 100644 --- a/docs/internals.md +++ b/docs/internals.md @@ -25,7 +25,7 @@ The code is statically analyzed with [Psalm](https://psalm.dev/). To run static ./vendor/bin/psalm ``` -## Rector +## Code style Use [Rector](https://github.com/rectorphp/rector) to make codebase follow some specific rules or use either newest or any specific version of PHP: @@ -34,11 +34,10 @@ use either newest or any specific version of PHP: ./vendor/bin/rector ``` -## Composer require checker +## Dependencies -This package uses [composer-require-checker](https://github.com/maglnet/ComposerRequireChecker) to check if all dependencies are correctly defined in `composer.json`. - -To run the checker, execute the following command: +This package uses [composer-require-checker](https://github.com/maglnet/ComposerRequireChecker) to check if all +dependencies are correctly defined in `composer.json`. To run the checker, execute the following command: ```shell ./vendor/bin/composer-require-checker From d3c4a9a324a04ab4485b2feddb3afd6d1e7a63f1 Mon Sep 17 00:00:00 2001 From: Sergei Predvoditelev Date: Fri, 3 May 2024 11:13:07 +0300 Subject: [PATCH 3/3] Improve CI (#105) --- .github/PULL_REQUEST_TEMPLATE.md | 1 - .github/workflows/bc.yml | 23 +++++++++++++++++-- .github/workflows/build.yml | 5 +++- .../workflows/composer-require-checker.yml | 3 ++- .github/workflows/mutation.yml | 3 ++- .github/workflows/static.yml | 10 +++++++- composer.json | 2 +- psalm83.xml | 21 +++++++++++++++++ 8 files changed, 60 insertions(+), 8 deletions(-) create mode 100644 psalm83.xml diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 4a3e8ac..6be5d58 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -3,4 +3,3 @@ | Is bugfix? | ✔️/❌ | New feature? | ✔️/❌ | Breaks BC? | ✔️/❌ -| Fixed issues | comma-separated list of tickets # fixed by the PR, if any diff --git a/.github/workflows/bc.yml b/.github/workflows/bc.yml index ba3e9ef..f8cc564 100644 --- a/.github/workflows/bc.yml +++ b/.github/workflows/bc.yml @@ -1,6 +1,25 @@ on: - - pull_request - - push + pull_request: + paths-ignore: + - 'docs/**' + - 'README.md' + - 'CHANGELOG.md' + - '.gitignore' + - '.gitattributes' + - 'infection.json.dist' + - 'phpunit.xml.dist' + - 'psalm.xml' + push: + branches: ['master'] + paths-ignore: + - 'docs/**' + - 'README.md' + - 'CHANGELOG.md' + - '.gitignore' + - '.gitattributes' + - 'infection.json.dist' + - 'phpunit.xml.dist' + - 'psalm.xml' name: backwards compatibility diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8506ea1..e96052e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,6 +10,7 @@ on: - 'psalm.xml' push: + branches: ['master'] paths-ignore: - 'docs/**' - 'README.md' @@ -24,8 +25,10 @@ name: build jobs: phpunit: uses: yiisoft/actions/.github/workflows/phpunit.yml@master + secrets: + codecovToken: ${{ secrets.CODECOV_TOKEN }} with: os: >- ['ubuntu-latest', 'windows-latest'] php: >- - ['8.0', '8.1'] + ['8.0', '8.1', '8.2', '8.3'] diff --git a/.github/workflows/composer-require-checker.yml b/.github/workflows/composer-require-checker.yml index 6cb4099..5473ec9 100644 --- a/.github/workflows/composer-require-checker.yml +++ b/.github/workflows/composer-require-checker.yml @@ -11,6 +11,7 @@ on: - 'psalm.xml' push: + branches: ['master'] paths-ignore: - 'docs/**' - 'README.md' @@ -30,4 +31,4 @@ jobs: os: >- ['ubuntu-latest'] php: >- - ['8.0'] + ['8.0', '8.1', '8.2', '8.3'] diff --git a/.github/workflows/mutation.yml b/.github/workflows/mutation.yml index c1aca98..8150499 100644 --- a/.github/workflows/mutation.yml +++ b/.github/workflows/mutation.yml @@ -9,6 +9,7 @@ on: - 'psalm.xml' push: + branches: ['master'] paths-ignore: - 'docs/**' - 'README.md' @@ -26,6 +27,6 @@ jobs: os: >- ['ubuntu-latest'] php: >- - ['8.1'] + ['8.2'] secrets: STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }} diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index d2a03af..d873c39 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -30,7 +30,7 @@ jobs: os: >- ['ubuntu-latest'] php: >- - ['8.1', '8.2', '8.3'] + ['8.1', '8.2'] psalm80: uses: yiisoft/actions/.github/workflows/psalm.yml@master with: @@ -39,3 +39,11 @@ jobs: ['ubuntu-latest'] php: >- ['8.0'] + psalm83: + uses: yiisoft/actions/.github/workflows/psalm.yml@master + with: + psalm-config: psalm83.xml + os: >- + ['ubuntu-latest'] + php: >- + ['8.3'] diff --git a/composer.json b/composer.json index 5f20cd0..bfcc133 100644 --- a/composer.json +++ b/composer.json @@ -34,7 +34,7 @@ "rector/rector": "^1.0.0", "roave/infection-static-analysis-plugin": "^1.25", "spatie/phpunit-watcher": "^1.23", - "vimeo/psalm": "^4.30|^5.21", + "vimeo/psalm": "^4.30|^5.24", "yiisoft/di": "^1.2", "yiisoft/psr-dummy-provider": "^1.0", "yiisoft/test-support": "^3.0", diff --git a/psalm83.xml b/psalm83.xml new file mode 100644 index 0000000..ee80eb3 --- /dev/null +++ b/psalm83.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + +