From 00d24e0f77ac69361abf0c442e3e101875137a58 Mon Sep 17 00:00:00 2001 From: Sebastian Meyer Date: Sat, 7 Sep 2024 21:30:06 +0200 Subject: [PATCH] Fix code documentation --- src/DataStructures/StrictArray.php | 11 +++++++++++ src/DataStructures/StrictCollection.php | 2 -- .../Traits/StrictSplDoublyLinkedListTrait.php | 3 +-- src/Interfaces/ArrayAccessTrait.php | 5 +---- src/Interfaces/CountableTrait.php | 5 +---- src/Interfaces/IteratorAggregateTrait.php | 4 +--- src/Interfaces/IteratorTrait.php | 5 +---- src/Traits/Setter.php | 1 + 8 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/DataStructures/StrictArray.php b/src/DataStructures/StrictArray.php index 7a05194..65f555e 100644 --- a/src/DataStructures/StrictArray.php +++ b/src/DataStructures/StrictArray.php @@ -28,6 +28,17 @@ use OCC\Basics\DataStructures\Exceptions\InvalidDataTypeException; use OCC\Basics\Interfaces\IteratorTrait; use RuntimeException; +use function array_key_first; +use function array_key_last; +use function array_pop; +use function array_push; +use function array_shift; +use function array_unshift; +use function count; +use function get_debug_type; +use function is_null; +use function sprintf; + /** * A type-sensitive, traversable array. * diff --git a/src/DataStructures/StrictCollection.php b/src/DataStructures/StrictCollection.php index 78f6883..abcfe6f 100644 --- a/src/DataStructures/StrictCollection.php +++ b/src/DataStructures/StrictCollection.php @@ -362,8 +362,6 @@ class StrictCollection implements ArrayAccess, Countable, Serializable * @return void * * @internal - * - * @hpsalm-suppress MethodSignatureMismatch */ public function __unserialize(array $data): void { diff --git a/src/DataStructures/Traits/StrictSplDoublyLinkedListTrait.php b/src/DataStructures/Traits/StrictSplDoublyLinkedListTrait.php index 73f34d1..57209fa 100644 --- a/src/DataStructures/Traits/StrictSplDoublyLinkedListTrait.php +++ b/src/DataStructures/Traits/StrictSplDoublyLinkedListTrait.php @@ -28,7 +28,6 @@ use OCC\Basics\DataStructures\Exceptions\InvalidDataTypeException; use OCC\Basics\DataStructures\StrictCollection; use OCC\Basics\Traits\TypeChecker; use OutOfRangeException; -use SplDoublyLinkedList; use function get_debug_type; use function iterator_to_array; @@ -47,7 +46,7 @@ use function unserialize; * @package Basics\DataStructures * * @template AllowedType of mixed - * @phpstan-require-extends SplDoublyLinkedList + * @phpstan-require-extends \SplDoublyLinkedList */ trait StrictSplDoublyLinkedListTrait { diff --git a/src/Interfaces/ArrayAccessTrait.php b/src/Interfaces/ArrayAccessTrait.php index 974da74..9769703 100644 --- a/src/Interfaces/ArrayAccessTrait.php +++ b/src/Interfaces/ArrayAccessTrait.php @@ -23,8 +23,6 @@ declare(strict_types=1); namespace OCC\Basics\Interfaces; -use ArrayAccess; - use function is_null; /** @@ -38,8 +36,7 @@ use function is_null; * @api * * @template TValue of mixed - * @implements ArrayAccess - * @phpstan-require-implements ArrayAccess + * @phpstan-require-implements \ArrayAccess */ trait ArrayAccessTrait { diff --git a/src/Interfaces/CountableTrait.php b/src/Interfaces/CountableTrait.php index 7e40b10..c31e39e 100644 --- a/src/Interfaces/CountableTrait.php +++ b/src/Interfaces/CountableTrait.php @@ -23,8 +23,6 @@ declare(strict_types=1); namespace OCC\Basics\Interfaces; -use Countable; - use function count; /** @@ -38,8 +36,7 @@ use function count; * @api * * @template TValue of mixed - * @implements Countable - * @phpstan-require-implements Countable + * @phpstan-require-implements \Countable */ trait CountableTrait { diff --git a/src/Interfaces/IteratorAggregateTrait.php b/src/Interfaces/IteratorAggregateTrait.php index d9d23bb..9bca3ca 100644 --- a/src/Interfaces/IteratorAggregateTrait.php +++ b/src/Interfaces/IteratorAggregateTrait.php @@ -24,7 +24,6 @@ declare(strict_types=1); namespace OCC\Basics\Interfaces; use ArrayIterator; -use IteratorAggregate; /** * A generic implementation of the IteratorAggregate interface. @@ -37,8 +36,7 @@ use IteratorAggregate; * @api * * @template TValue of mixed - * @implements IteratorAggregate - * @phpstan-require-implements IteratorAggregate + * @phpstan-require-implements \IteratorAggregate */ trait IteratorAggregateTrait { diff --git a/src/Interfaces/IteratorTrait.php b/src/Interfaces/IteratorTrait.php index f222078..624d402 100644 --- a/src/Interfaces/IteratorTrait.php +++ b/src/Interfaces/IteratorTrait.php @@ -23,8 +23,6 @@ declare(strict_types=1); namespace OCC\Basics\Interfaces; -use Iterator; - use function current; use function is_null; use function key; @@ -43,8 +41,7 @@ use function reset; * @api * * @template TValue of mixed - * @implements Iterator - * @phpstan-require-implements Iterator + * @phpstan-require-implements \Iterator */ trait IteratorTrait { diff --git a/src/Traits/Setter.php b/src/Traits/Setter.php index e1208a7..121f979 100644 --- a/src/Traits/Setter.php +++ b/src/Traits/Setter.php @@ -85,6 +85,7 @@ trait Setter try { $this->__set($property, null); } catch (InvalidArgumentException) { + // Unsetting an invalid property should not lead to an error. } } }