Update phpDoc

This commit is contained in:
Sebastian Meyer 2024-01-30 22:24:10 +01:00
parent 625a8bef23
commit a63164c9fc
11 changed files with 39 additions and 55 deletions

View File

@ -30,7 +30,7 @@ jobs:
- name: Upload Artifact - name: Upload Artifact
uses: actions/upload-pages-artifact@v3 uses: actions/upload-pages-artifact@v3
with: with:
path: 'docs/' path: 'doc/'
- name: Deploy to GitHub Pages - name: Deploy to GitHub Pages
id: deployment id: deployment

1
.gitignore vendored
View File

@ -6,3 +6,4 @@ composer.lock
phpcs.xml phpcs.xml
phpdoc.xml phpdoc.xml
phpstan.neon phpstan.neon
psalm.xml

View File

@ -6,7 +6,7 @@
xsi:schemaLocation="https://www.phpdoc.org https://raw.githubusercontent.com/phpDocumentor/phpDocumentor/master/data/xsd/phpdoc.xsd"> xsi:schemaLocation="https://www.phpdoc.org https://raw.githubusercontent.com/phpDocumentor/phpDocumentor/master/data/xsd/phpdoc.xsd">
<title>PHP Basics</title> <title>PHP Basics</title>
<paths> <paths>
<output>docs</output> <output>doc</output>
<cache>.phpdoc/cache</cache> <cache>.phpdoc/cache</cache>
</paths> </paths>
<version number="latest"> <version number="latest">

View File

@ -48,7 +48,7 @@ use Serializable;
* @template AllowedType of mixed * @template AllowedType of mixed
* @extends SplDoublyLinkedList<AllowedType> * @extends SplDoublyLinkedList<AllowedType>
* @implements ArrayAccess<int, AllowedType> * @implements ArrayAccess<int, AllowedType>
* @implements Iterator<int, AllowedType> * @implements Iterator<AllowedType>
*/ */
class StrictList extends SplDoublyLinkedList implements ArrayAccess, Countable, Iterator, Serializable class StrictList extends SplDoublyLinkedList implements ArrayAccess, Countable, Iterator, Serializable
{ {
@ -205,7 +205,7 @@ class StrictList extends SplDoublyLinkedList implements ArrayAccess, Countable,
* *
* @throws InvalidArgumentException * @throws InvalidArgumentException
* *
* @api * @internal
*/ */
public function offsetSet(mixed $offset, mixed $value): void public function offsetSet(mixed $offset, mixed $value): void
{ {

View File

@ -43,7 +43,7 @@ use Serializable;
* @template AllowedType of mixed * @template AllowedType of mixed
* @extends StrictList<AllowedType> * @extends StrictList<AllowedType>
* @implements ArrayAccess<int, AllowedType> * @implements ArrayAccess<int, AllowedType>
* @implements Iterator<int, AllowedType> * @implements Iterator<AllowedType>
*/ */
class StrictQueue extends StrictList implements ArrayAccess, Countable, Iterator, Serializable class StrictQueue extends StrictList implements ArrayAccess, Countable, Iterator, Serializable
{ {

View File

@ -43,7 +43,7 @@ use Serializable;
* @template AllowedType of mixed * @template AllowedType of mixed
* @extends StrictList<AllowedType> * @extends StrictList<AllowedType>
* @implements ArrayAccess<int, AllowedType> * @implements ArrayAccess<int, AllowedType>
* @implements Iterator<int, AllowedType> * @implements Iterator<AllowedType>
*/ */
class StrictStack extends StrictList implements ArrayAccess, Countable, Iterator, Serializable class StrictStack extends StrictList implements ArrayAccess, Countable, Iterator, Serializable
{ {

View File

@ -33,10 +33,8 @@ use ArrayAccess;
* *
* @api * @api
* *
* @template TKey of int|string
* @template TValue of mixed * @template TValue of mixed
* @template TData of array<TKey, TValue> * @implements ArrayAccess<array-key, TValue>
* @implements ArrayAccess<TKey, TValue>
* @phpstan-require-implements ArrayAccess * @phpstan-require-implements ArrayAccess
*/ */
trait ArrayAccessTrait trait ArrayAccessTrait
@ -44,18 +42,18 @@ trait ArrayAccessTrait
/** /**
* Holds the array-accessible data. * Holds the array-accessible data.
* *
* @var TData * @var array<TValue>
*/ */
protected array $data = []; protected array $data = [];
/** /**
* Check if the specified offset exists. * Check if the specified offset exists.
* *
* @param TKey $offset The offset to check for * @param array-key $offset The offset to check for
* *
* @return bool Whether the offset exists * @return bool Whether the offset exists
* *
* @api * @internal
*/ */
public function offsetExists(mixed $offset): bool public function offsetExists(mixed $offset): bool
{ {
@ -65,11 +63,11 @@ trait ArrayAccessTrait
/** /**
* Retrieve data at the specified offset. * Retrieve data at the specified offset.
* *
* @param TKey $offset The offset to retrieve at * @param array-key $offset The offset to retrieve
* *
* @return ?TValue The value at the offset or NULL * @return ?TValue The value at the offset or NULL if invalid
* *
* @api * @internal
*/ */
public function offsetGet(mixed $offset): mixed public function offsetGet(mixed $offset): mixed
{ {
@ -79,12 +77,12 @@ trait ArrayAccessTrait
/** /**
* Assign a value to the specified offset. * Assign a value to the specified offset.
* *
* @param ?TKey $offset The offset to assign to or NULL to append * @param ?array-key $offset The offset to assign to or NULL to append
* @param TValue $value The value to set * @param TValue $value The value to set
* *
* @return void * @return void
* *
* @api * @internal
*/ */
public function offsetSet(mixed $offset, mixed $value): void public function offsetSet(mixed $offset, mixed $value): void
{ {
@ -98,11 +96,11 @@ trait ArrayAccessTrait
/** /**
* Unset the specified offset. * Unset the specified offset.
* *
* @param TKey $offset The offset to unset * @param array-key $offset The offset to unset
* *
* @return void * @return void
* *
* @api * @internal
*/ */
public function offsetUnset(mixed $offset): void public function offsetUnset(mixed $offset): void
{ {

View File

@ -33,10 +33,7 @@ use Countable;
* *
* @api * @api
* *
* @template TKey of int|string
* @template TValue of mixed * @template TValue of mixed
* @template TData of array<TKey, TValue>
* @implements Countable<TValue>
* @phpstan-require-implements Countable * @phpstan-require-implements Countable
*/ */
trait CountableTrait trait CountableTrait
@ -44,16 +41,16 @@ trait CountableTrait
/** /**
* Holds the countable data. * Holds the countable data.
* *
* @var TData * @var array<TValue>
*/ */
protected array $data = []; protected array $data = [];
/** /**
* Count the data items. * Count the data items.
* *
* @return int The number of data items * @return int<0, max> The number of data items
* *
* @api * @internal
*/ */
public function count(): int public function count(): int
{ {

View File

@ -34,10 +34,8 @@ use IteratorAggregate;
* *
* @api * @api
* *
* @template TKey of int|string
* @template TValue of mixed * @template TValue of mixed
* @template TData of array<TKey, TValue> * @implements IteratorAggregate<TValue>
* @implements IteratorAggregate<TKey, TValue>
* @phpstan-require-implements IteratorAggregate * @phpstan-require-implements IteratorAggregate
*/ */
trait IteratorAggregateTrait trait IteratorAggregateTrait
@ -45,16 +43,16 @@ trait IteratorAggregateTrait
/** /**
* Holds the iterable data. * Holds the iterable data.
* *
* @var TData * @var array<TValue>
*/ */
protected array $data = []; protected array $data = [];
/** /**
* Retrieve an external iterator. * Retrieve an external iterator.
* *
* @return ArrayIterator<TKey, TValue> New array iterator for data array * @return ArrayIterator<array-key, TValue> New array iterator for data array
* *
* @api * @internal
*/ */
public function getIterator(): ArrayIterator public function getIterator(): ArrayIterator
{ {

View File

@ -33,10 +33,8 @@ use Iterator;
* *
* @api * @api
* *
* @template TKey of int|string
* @template TValue of mixed * @template TValue of mixed
* @template TData of array<TKey, TValue> * @implements Iterator<TValue>
* @implements Iterator<TKey, TValue>
* @phpstan-require-implements Iterator * @phpstan-require-implements Iterator
*/ */
trait IteratorTrait trait IteratorTrait
@ -44,28 +42,32 @@ trait IteratorTrait
/** /**
* Holds the iterable data. * Holds the iterable data.
* *
* @var TData * @var array<TValue>
*/ */
protected array $data = []; protected array $data = [];
/** /**
* Return the current item. * Return the current item.
* *
* @return TValue|false The current item or FALSE if invalid * @return ?TValue The current item or NULL if invalid
* *
* @api * @internal
*/ */
public function current(): mixed public function current(): mixed
{ {
return current($this->data); if ($this->valid()) {
/** @var TValue */
return current($this->data);
}
return null;
} }
/** /**
* Return the current key. * Return the current key.
* *
* @return ?TKey The current key or NULL if invalid * @return ?array-key The current key or NULL if invalid
* *
* @api * @internal
*/ */
public function key(): mixed public function key(): mixed
{ {
@ -77,31 +79,19 @@ trait IteratorTrait
* *
* @return void * @return void
* *
* @api * @internal
*/ */
public function next(): void public function next(): void
{ {
next($this->data); next($this->data);
} }
/**
* Move back to previous item.
*
* @return void
*
* @api
*/
public function prev(): void
{
prev($this->data);
}
/** /**
* Rewind the iterator to the first item. * Rewind the iterator to the first item.
* *
* @return void * @return void
* *
* @api * @internal
*/ */
public function rewind(): void public function rewind(): void
{ {
@ -113,7 +103,7 @@ trait IteratorTrait
* *
* @return bool Whether the current position is valid * @return bool Whether the current position is valid
* *
* @api * @internal
*/ */
public function valid(): bool public function valid(): bool
{ {