Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastian-meyer committed Jul 11, 2024
1 parent c249ac7 commit 09d3940
Show file tree
Hide file tree
Showing 60 changed files with 1,768 additions and 594 deletions.
2 changes: 1 addition & 1 deletion .phpdoc/guide/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ v2.0.0
* Added new trait :php:trait:`OCC\Basics\Traits\OverloadingGetter`
* Added new trait :php:trait:`OCC\Basics\Traits\OverloadingSetter`
* Added new trait :php:trait:`OCC\Basics\Traits\TypeChecker`
* Extended API for all datastructures (see :php:trait:`OCC\Basics\DataStructures\Traits\StrictSplDatastructureTrait`)
* Extended API for all datastructures (see :php:trait:`OCC\Basics\DataStructures\Traits\StrictSplDoublyLinkedListTrait`)
* Introduced :php:class:`OCC\Basics\DataStructures\Exceptions\InvalidDataTypeException` for strict datastructures
* Extended `documentation <https://opencultureconsulting.github.io/php-basics/>`_

Expand Down
10 changes: 5 additions & 5 deletions .phpdoc/guide/overview/datastructures.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ The datastructures in this package are derived from their respective `Standard P
<https://www.php.net/spl.datastructures>`_ which they extend by the option to control the data types of items those
datastructures can hold.

To restrict allowed data types for items, provide the constructor with an array of atomic types or fully qualified
class names you want to allow as item types. Available atomic types are `array`, `bool`, `callable`, `countable`,
`float` / `double`, `int` / `integer` / `long`, `iterable`, `null`, `numeric`, `object`, `resource`, `scalar` and
`string`.
To restrict allowed data types for items provide the constructor with an array of atomic types or fully qualified class
names (FQCN) you want to allow as item types. Available atomic types are `array`, `bool`, `callable`, `countable`,
`float` (or `double`), `int` (or `integer` or `long`), `iterable`, `null`, `numeric`, `object`, `resource`, `scalar`
and `string`.

Trying to add an item with a data type not on the list of allowed types to a strict datastructure will result in an
:php:class:`OCC\Basics\DataStructures\Exceptions\InvalidDataTypeException`.
:php:class:`OCC\Basics\DataStructures\Exceptions\InvalidDataTypeException` being thrown.

All strict datastructures inherit the implementation of the `\ArrayAccess <https://www.php.net/arrayaccess>`_,
`\Countable <https://www.php.net/countable>`_ and `\Serializable <https://www.php.net/serializable>`_ interfaces. All
Expand Down
4 changes: 2 additions & 2 deletions .phpdoc/guide/overview/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Overview
The package currently contains classes for :doc:`datastructures`, :doc:`errorhandlers`, multiple :doc:`interfaces`, and
more generic :doc:`traits` for common use cases. They share the same design principles like property and method naming
schema, the highest coding standards of `PHPStan <https://phpstan.org/>`_ and `Psalm <https://psalm.dev/>`_, and full
`PSR-12 <https://www.php-fig.org/psr/psr-12/>`_ compliance to make sure they can be combined and easily re-used in
other projects.
`PSR-12 <https://www.php-fig.org/psr/psr-12/>`_ compliance to make sure they can be combined and easily used in other
projects.

.. toctree::
:maxdepth: 2
Expand Down
8 changes: 4 additions & 4 deletions .phpdoc/guide/overview/traits.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ reading. Replace `{Property}` in the method's name with the name of the actual p
letter).

Trying to access an undefined property or a property without corresponding "magic" getter method will result in an
`\InvalidArgumentException <https://www.php.net/invalidargumentexception>`_.
`\InvalidArgumentException <https://www.php.net/invalidargumentexception>`_ being thrown.

Example: If the property is named `$fooBar`, the "magic" method has to be `_magicGetFooBar()`. This method is then
called when `$fooBar` is read in a context where it normally would not be accessible.
Expand All @@ -41,7 +41,7 @@ writing. Replace `{Property}` in the method's name with the name of the actual p
letter).

Trying to access an undefined property or a property without corresponding "magic" setter method will result in an
`\InvalidArgumentException <https://www.php.net/invalidargumentexception>`_.
`\InvalidArgumentException <https://www.php.net/invalidargumentexception>`_ being thrown.

Example: If the property is named `$fooBar`, the "magic" method has to be `_magicSetFooBar()`. This method is then
called when `$fooBar` is written to in a context where it normally would not be accessible.
Expand Down Expand Up @@ -109,5 +109,5 @@ TypeChecker
This allows to set a list of allowed atomic data types and fully qualified class names. It also provides a method to
check if a value's data type matches at least one of these types.

Available atomic types are `array`, `bool`, `callable`, `countable`, `float` / `double`, `int` / `integer` / `long`,
`iterable`, `null`, `numeric`, `object`, `resource`, `scalar` and `string`.
Available atomic types are `array`, `bool`, `callable`, `countable`, `float` (or `double`), `int` (or `integer` or
`long`), `iterable`, `null`, `numeric`, `object`, `resource`, `scalar` and `string`.
10 changes: 5 additions & 5 deletions .phpdoc/guide/usage/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Installation
Composer
========

The intended and recommended way of re-using this package is via `Composer <https://getcomposer.org/>`_. The following
The intended and recommended way of using this package is via `Composer <https://getcomposer.org/>`_. The following
command will get you the latest version and make it a dependency of your project. It will also register all classes and
traits with the autoloader to make them available inside the application.

Expand All @@ -23,8 +23,8 @@ the desired version constraint:

.. code-block:: shell
# This will install the latest patch level version of 2.0 (i. e. >=2.0.0 && <2.1.0)
composer require "opencultureconsulting/basics:~2.0"
# This will install the latest patch level version of 2.1 (i. e. >=2.1.0 && <2.2.0)
composer require "opencultureconsulting/basics:~2.1"
All available versions as well as further information about :doc:`requirements` and dependencies can be found on
`Packagist <https://packagist.org/packages/opencultureconsulting/basics>`_.
Expand All @@ -46,8 +46,8 @@ well:

.. code-block:: shell
# This will clone the repository state at version "2.0.0" into the "basics" directory
git clone --branch=v2.0.0 https://github.com/opencultureconsulting/php-basics.git basics
# This will clone the repository state at version "2.1.0" into the "basics" directory
git clone --branch=v2.1.0 https://github.com/opencultureconsulting/php-basics.git basics
Be aware that you also need to make the classes and traits available in your application by either adding them to your
autoloader or by including all files individually in PHP.
Expand Down
4 changes: 2 additions & 2 deletions .phpdoc/guide/usage/requirements.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Environment
This package requires at least **PHP 8.1**.

It is highly recommended to use `Composer <https://getcomposer.org/>`_ for dependency management and autoloading,
although it is technically not strictly required for re-using any of these classes and traits. But it certainly
makes it a lot easier!
although it is technically not strictly required for using any of these classes and traits. But it certainly makes it a
lot easier!

Dependencies
============
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

***A collection of generic classes and useful traits for PHP projects.***

The package currently contains classes for [type-sensitive data structures](src/DataStructures/), [error and exception handlers](src/ErrorHandlers/), multiple [traits implementing standard interfaces](src/Interfaces/), and more generic [traits for common use cases](src/Traits/). They share the same design principles like property and method naming schema, highest coding standards of [PHPStan](https://phpstan.org/) and [Psalm](https://psalm.dev/), and full [PSR-12](https://www.php-fig.org/psr/psr-12/) compliance to make sure they can be combined and easily re-used in other projects.
The package currently contains classes for [type-sensitive data structures](src/DataStructures/), [error and exception handlers](src/ErrorHandlers/), multiple [traits implementing standard interfaces](src/Interfaces/), and more generic [traits for common use cases](src/Traits/). They share the same design principles like property and method naming schema, highest coding standards of [PHPStan](https://phpstan.org/) and [Psalm](https://psalm.dev/), and full [PSR-12](https://www.php-fig.org/psr/psr-12/) compliance to make sure they can be combined and easily used in other projects.

## Quick Start

The intended and recommended way of re-using this package is via [Composer](https://getcomposer.org/). The following command will get you the latest version:
The intended and recommended way of using this package is via [Composer](https://getcomposer.org/). The following command will get you the latest version:

composer require opencultureconsulting/basics

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ <h2 class="phpdocumentor-content__title">

<p class="phpdocumentor-summary">Common exception for type-sensitive datastructures.</p>


<section class="phpdocumentor-description"><p>Exception thrown if a value does not adhere to the defined list of valid
data types.</p>
</section>
Expand All @@ -233,6 +234,8 @@ <h5 class="phpdocumentor-tag-list__heading" id="tags">





<h3 id="toc">
Table of Contents
<a href="classes/OCC-Basics-DataStructures-Exceptions-InvalidDataTypeException.html#toc" class="headerlink"><i class="fas fa-link"></i></a>
Expand All @@ -251,7 +254,6 @@ <h3 id="toc">







Expand Down
Loading

0 comments on commit 09d3940

Please sign in to comment.