From cd04bb47b5693f7653a1175468a635e69a6b0859 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Mon, 5 Jan 2026 20:49:06 +0100 Subject: [PATCH 1/2] Add docs --- .gitignore | 2 + Makefile | 4 ++ docs/contributing.rst | 12 +++++ .../01-interpreting-a-simple-docblock.php | 2 +- .../examples}/02-interpreting-tags.php | 2 +- .../03-reconstituting-a-docblock.php | 2 +- .../examples}/04-adding-your-own-tag.php | 2 +- .../playing-with-descriptions/02-escaping.php | 2 +- docs/how-to/adding-your-own-tag.rst | 9 ++++ docs/how-to/index.rst | 13 ++++++ .../how-to/interpreting-a-simple-docblock.rst | 9 ++++ docs/how-to/interpreting-tags.rst | 9 ++++ docs/how-to/reconstituting-a-docblock.rst | 9 ++++ docs/index.rst | 42 +++++++++++++++++ docs/installation.rst | 9 ++++ docs/upgrade-to-v6.rst | 7 +++ phpdoc.dist.xml | 46 +++++++++++++++++++ .../integration/InterpretingDocBlocksTest.php | 6 +-- .../ReconstitutingADocBlockTest.php | 2 +- tests/integration/UsingTagsTest.php | 2 +- 20 files changed, 181 insertions(+), 10 deletions(-) create mode 100644 docs/contributing.rst rename {examples => docs/examples}/01-interpreting-a-simple-docblock.php (93%) rename {examples => docs/examples}/02-interpreting-tags.php (91%) rename {examples => docs/examples}/03-reconstituting-a-docblock.php (93%) rename {examples => docs/examples}/04-adding-your-own-tag.php (99%) rename {examples => docs/examples}/playing-with-descriptions/02-escaping.php (96%) create mode 100644 docs/how-to/adding-your-own-tag.rst create mode 100644 docs/how-to/index.rst create mode 100644 docs/how-to/interpreting-a-simple-docblock.rst create mode 100644 docs/how-to/interpreting-tags.rst create mode 100644 docs/how-to/reconstituting-a-docblock.rst create mode 100644 docs/index.rst create mode 100644 docs/installation.rst create mode 100644 phpdoc.dist.xml diff --git a/.gitignore b/.gitignore index 62394e1a..581a7f0c 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,5 @@ vendor/ # By default the phpunit.xml.dist is provided; you can override this using a local config file phpunit.xml .phpunit.result.cache + +.phpdoc diff --git a/Makefile b/Makefile index 5420da71..05849d2a 100644 --- a/Makefile +++ b/Makefile @@ -41,3 +41,7 @@ rector: ## Refactor code using rector .PHONY: pre-commit-test pre-commit-test: fix-code-style test code-style static-code-analysis + +.PHONY: docs +docs: ## Generate documentation with phpDocumentor + docker run -it --rm -v${PWD}:/opt/project -w /opt/project phpdoc/phpdoc:3 diff --git a/docs/contributing.rst b/docs/contributing.rst new file mode 100644 index 00000000..a016ce46 --- /dev/null +++ b/docs/contributing.rst @@ -0,0 +1,12 @@ +Contributing +============ + +Contributions are welcome! If you would like to contribute to ReflectionDocBlock, please follow these guidelines: + +- Fork the repository and create your branch from ``main``. +- Ensure your code follows the project's coding standards. +- Write tests for your changes. +- Submit a pull request with a clear description of your changes. + +For questions or discussions, please open an issue on GitHub. + diff --git a/examples/01-interpreting-a-simple-docblock.php b/docs/examples/01-interpreting-a-simple-docblock.php similarity index 93% rename from examples/01-interpreting-a-simple-docblock.php rename to docs/examples/01-interpreting-a-simple-docblock.php index 6d67dea4..d95d455f 100644 --- a/examples/01-interpreting-a-simple-docblock.php +++ b/docs/examples/01-interpreting-a-simple-docblock.php @@ -1,5 +1,5 @@ create('/**\n * This is a summary.\n *\n * This is a description.\n */'); + + echo $docblock->getSummary(); // Outputs: This is a summary. + +For more detailed usage and how-to guides, see the ``examples/`` directory. + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + installation + how-to/index + migration-v6 + contributing diff --git a/docs/installation.rst b/docs/installation.rst new file mode 100644 index 00000000..13232061 --- /dev/null +++ b/docs/installation.rst @@ -0,0 +1,9 @@ +Installation +============ + +To install ReflectionDocBlock, use Composer: + +.. code-block:: bash + + composer require phpdocumentor/reflection-docblock + diff --git a/docs/upgrade-to-v6.rst b/docs/upgrade-to-v6.rst index e69de29b..7a55dce2 100644 --- a/docs/upgrade-to-v6.rst +++ b/docs/upgrade-to-v6.rst @@ -0,0 +1,7 @@ + +Stop using ::create + +StandardTagFactory needs to be created via createInstance + +Method::getArguments removed +Method::create is removed diff --git a/phpdoc.dist.xml b/phpdoc.dist.xml new file mode 100644 index 00000000..3b02e31b --- /dev/null +++ b/phpdoc.dist.xml @@ -0,0 +1,46 @@ + + + Reflection Docblock + + build/docs + + + latest + + + src/ + + api + + + php + + + template + template-extends + template-implements + extends + implements + + phpDocumentor + + + + docs + + guides + + + +