From 7c21770fe74c709dec0430e2630b85a0b1f30ad4 Mon Sep 17 00:00:00 2001 From: Luiz Marin <67489841+luizcmarin@users.noreply.github.com> Date: Mon, 15 Apr 2024 13:15:19 -0300 Subject: [PATCH 1/4] Docs folder standardization and other fixes --- docs/internals.md | 46 ++++++++++++++++++++++++++++++++++++++++++++++ psalm.xml | 2 +- src/Json.php | 2 +- 3 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 docs/internals.md diff --git a/docs/internals.md b/docs/internals.md new file mode 100644 index 0000000..b715d9f --- /dev/null +++ b/docs/internals.md @@ -0,0 +1,46 @@ +# 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 +``` + +## Dependencies + +Use [ComposerRequireChecker](https://github.com/maglnet/ComposerRequireChecker) to detect transitive +[Composer](https://getcomposer.org/) dependencies. + +To run the checker, execute the following command: + +```shell +./vendor/bin/composer-require-checker +``` diff --git a/psalm.xml b/psalm.xml index 5a95a3a..f8ac92e 100644 --- a/psalm.xml +++ b/psalm.xml @@ -1,7 +1,7 @@ diff --git a/src/Json.php b/src/Json.php index 7b77f82..758154d 100644 --- a/src/Json.php +++ b/src/Json.php @@ -33,7 +33,7 @@ final class Json * * @param mixed $value The data to be encoded. * @param int $options The encoding options. For more details please refer to - * {@see http://www.php.net/manual/en/function.json-encode.php}. + * {@see https://www.php.net/manual/en/function.json-encode.php}. * Default is `JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR`. * @param int $depth The maximum depth. * From f293f445d5071626c74a1dffe1a0d34f879b8d8d Mon Sep 17 00:00:00 2001 From: Luiz Marin <67489841+luizcmarin@users.noreply.github.com> Date: Wed, 17 Apr 2024 10:16:56 -0300 Subject: [PATCH 2/4] IRC link fix and update xml files --- composer.json | 2 +- psalm.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index bb20ec3..8937a42 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ "issues": "https://github.com/yiisoft/json/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/json" }, diff --git a/psalm.xml b/psalm.xml index f8ac92e..5a95a3a 100644 --- a/psalm.xml +++ b/psalm.xml @@ -1,7 +1,7 @@ From 8b1317dfecd94675b71c769f9cbcd27869edfaf0 Mon Sep 17 00:00:00 2001 From: Luiz Marin <67489841+luizcmarin@users.noreply.github.com> Date: Sat, 20 Apr 2024 12:00:00 -0300 Subject: [PATCH 3/4] Docs folder standardization and other fixes --- LICENSE.md | 8 ++++---- README.md | 45 ++++++++++++++------------------------------- docs/internals.md | 9 +++++---- 3 files changed, 23 insertions(+), 39 deletions(-) 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 611e2e0..ca788c7 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ The package provides methods to encode and decode JSON. - It always throws `\JsonException` instead of returning false on error. - It has sensible defaults, so you don't have to specify flags all the time. - It has handy method to encode for HTML safely. -- It handles `\JsonSerializable`, `\DateTimeInterface`, and `\SimpleXMLElement` well. +- It handles `\JsonSerializable`, `\DateTimeInterface`, and `\SimpleXMLElement` well. ## Requirements @@ -65,40 +65,16 @@ $json = '{"name":"Alex","team":"Yii"}'; $data = Json::decode($json); ``` -## Testing +## Documentation -### Unit testing +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 -``` +- More information can be found in the [Internals.](docs/internals.md) +## Support -## License - -The Yii JSON 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 @@ -111,3 +87,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 JSON 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 b715d9f..25ce6eb 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,13 +34,14 @@ use either newest or any specific version of PHP: ./vendor/bin/rector ``` -## Dependencies +## Composer require checker -Use [ComposerRequireChecker](https://github.com/maglnet/ComposerRequireChecker) to detect transitive -[Composer](https://getcomposer.org/) 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: ```shell ./vendor/bin/composer-require-checker ``` + +``` From 496ce1c10ee9f4fdaca7ec63550971e85e2adb18 Mon Sep 17 00:00:00 2001 From: Luiz Marin <67489841+luizcmarin@users.noreply.github.com> Date: Sun, 21 Apr 2024 06:43:52 -0300 Subject: [PATCH 4/4] Update README.md --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index ca788c7..951f541 100644 --- a/README.md +++ b/README.md @@ -67,9 +67,7 @@ $data = Json::decode($json); ## Documentation -Testing: - -- More information can be found in the [Internals.](docs/internals.md) +- [Internals](docs/internals.md) ## Support