Skip to content

Commit 4dad687

Browse files
committed
doc fixed
1 parent c3f9139 commit 4dad687

File tree

10 files changed

+127
-78
lines changed

10 files changed

+127
-78
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ composer.phar
22
composer.lock
33
clover.xml
44
infection-log.txt
5+
.phpdoc/cache/
56
vendor/
7+
.phan/
68
.php-cs-fixer.cache
7-
.phpunit.result.cache
9+
.phpunit.result.cache
10+
phpunit.local.xml
11+
phpdoc.xml

src/Linna/TypedArrayObject/AbstractArray.php

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,16 @@
1212
namespace Linna\TypedArrayObject;
1313

1414
use ArrayObject;
15+
use ArrayIterator;
1516
use Closure;
1617
use InvalidArgumentException;
1718

1819
/**
19-
* Provide a way to create an array of string typed elements with php.
20+
* Provide a way to create an array of typed elements with php.
21+
*
22+
* @extends ArrayObject<int|string, mixed>
23+
*
24+
* @link https://www.php.net/manual/en/class.arrayobject.php
2025
*/
2126
class AbstractArray extends ArrayObject
2227
{
@@ -26,15 +31,14 @@ class AbstractArray extends ArrayObject
2631
/**
2732
* Class Contructor.
2833
*
29-
* @param Closure $func function to check the array values
30-
* @param array<mixed> $input array of values
31-
* @param int $flags see array object on php site
32-
* @param string $iterator_class see array object on php site
34+
* @param Closure $func Function to check the array values.
35+
* @param array<mixed> $input Array of values.
36+
* @param int $flags Flags to control the behaviour of the ArrayObject object. See array object on php site.
37+
* @param class-string $iterator_class Specify the class that will be used for iteration of the ArrayObject object. The class must implement ArrayIterator.
3338
*
34-
* @throws InvalidArgumentException If elements in the optional array parameter
35-
* aren't of the configured type.
39+
* @throws InvalidArgumentException If elements in the optional array parameter aren't of the configured type.
3640
*/
37-
public function __construct(Closure $func, array $input = [], int $flags = 0, string $iterator_class = "ArrayIterator")
41+
public function __construct(Closure $func, array $input = [], int $flags = 0, string $iterator_class = ArrayIterator::class)
3842
{
3943
//check for invalid values inside provided array
4044
//array_map returns an array of trues or false
@@ -73,7 +77,7 @@ public function offsetSet($index, $newval): void
7377
/**
7478
* Append a value at the end of the array.
7579
*
76-
* @param string $value
80+
* @param mixed $value
7781
* @return void
7882
*
7983
* @throws InvalidArgumentException If value passed with $value are not of the string type

src/Linna/TypedArrayObject/ArrayOfArrays.php

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,36 @@
1111

1212
namespace Linna\TypedArrayObject;
1313

14+
use ArrayIterator;
1415
use InvalidArgumentException;
1516

1617
/**
1718
* Provide a way to create an array of array typed elements with php.
19+
*
20+
* @link https://www.php.net/manual/en/functions.first_class_callable_syntax.php
1821
*/
1922
class ArrayOfArrays extends AbstractArray
2023
{
2124
/**
22-
* It overrides parent message
23-
* @var string Exception message
25+
* It overrides parent message.
26+
*
27+
* @var string Exception message.
2428
*/
2529
protected string $exceptionMessage = 'Elements passed must be of the type <array>.';
2630

2731
/**
2832
* Class Contructor.
2933
*
30-
* @param array<array> $input
31-
* @param int $flags
32-
* @param string $iterator_class
34+
* @param array<int|string, array<mixed>> $input Array of values, every value must be an <code>array</code>.
35+
* @param int $flags Flags to control the behaviour of the <code>ArrayObject</code> object,
36+
* see <code>ArrayObject</code> on php site.
37+
* @param class-string $iterator_class Specify the class that will be used for iteration of the
38+
* <code>ArrayObject</code> object, the class must
39+
* implement <code>ArrayIterator</code>.
3340
*
34-
* @throws InvalidArgumentException If elements in the optional array parameter
35-
* aren't of the configured type.
41+
* @throws InvalidArgumentException If elements in the optional array parameter aren't of the configured type.
3642
*/
37-
public function __construct(array $input = [], int $flags = 0, string $iterator_class = "ArrayIterator")
43+
public function __construct(array $input = [], int $flags = 0, string $iterator_class = ArrayIterator::class)
3844
{
3945
// first argument is the php8.1 method to pass function reference as closure.
4046
// check https://www.php.net/manual/en/functions.first_class_callable_syntax.php

src/Linna/TypedArrayObject/ArrayOfBooleans.php

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,35 @@
1111

1212
namespace Linna\TypedArrayObject;
1313

14+
use ArrayIterator;
1415
use InvalidArgumentException;
1516

1617
/**
1718
* Provide a way to create an array of boolean typed elements with php.
19+
*
20+
* @link https://www.php.net/manual/en/functions.first_class_callable_syntax.php
1821
*/
1922
class ArrayOfBooleans extends AbstractArray
2023
{
2124
/**
22-
* It overrides parent message
23-
* @var string Exception message
25+
* It overrides parent message.
26+
*
27+
* @var string Exception message.
2428
*/
2529
protected string $exceptionMessage = 'Elements passed must be of the type <bool>.';
2630

2731
/**
2832
* Class Contructor.
2933
*
30-
* @param array<bool> $input
31-
* @param int $flags
32-
* @param string $iterator_class
34+
* @param array<bool> $input Array of values, every value must be a <code>bool</code>.
35+
* @param int $flags Flags to control the behaviour of the <code>ArrayObject</code> object,
36+
* see <code>ArrayObject</code> on php site.
37+
* @param class-string $iterator_class Specify the class that will be used for iteration of the <code>ArrayObject</code>
38+
* object, the class must implement <code>ArrayIterator</code>.
3339
*
34-
* @throws InvalidArgumentException If elements in the optional array parameter
35-
* aren't of the configured type.
40+
* @throws InvalidArgumentException If elements in the optional array parameter aren't of the configured type.
3641
*/
37-
public function __construct(array $input = [], int $flags = 0, string $iterator_class = "ArrayIterator")
42+
public function __construct(array $input = [], int $flags = 0, string $iterator_class = ArrayIterator::class)
3843
{
3944
// first argument is the php8.1 method to pass function reference as closure.
4045
// check https://www.php.net/manual/en/functions.first_class_callable_syntax.php

src/Linna/TypedArrayObject/ArrayOfCallable.php

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,35 @@
1111

1212
namespace Linna\TypedArrayObject;
1313

14+
use ArrayIterator;
1415
use InvalidArgumentException;
1516

1617
/**
1718
* Provide a way to create an array of callable typed elements with php.
19+
*
20+
* @link https://www.php.net/manual/en/functions.first_class_callable_syntax.php
1821
*/
1922
class ArrayOfCallable extends AbstractArray
2023
{
2124
/**
22-
* It overrides parent message
23-
* @var string Exception message
25+
* It overrides parent message.
26+
*
27+
* @var string Exception message.
2428
*/
2529
protected string $exceptionMessage = 'Elements passed must be of the type <callable>.';
2630

2731
/**
2832
* Class Contructor.
2933
*
30-
* @param array $input
31-
* @param int $flags
32-
* @param string $iterator_class
34+
* @param array<callable> $input Array of values, every value must be a <code>callable</code>.
35+
* @param int $flags Flags to control the behaviour of the <code>ArrayObject</code> object,
36+
* see <code>ArrayObject</code> on php site.
37+
* @param class-string $iterator_class Specify the class that will be used for iteration of the <code>ArrayObject</code>
38+
* object, the class must implement <code>ArrayIterator</code>.
3339
*
34-
* @throws InvalidArgumentException If elements in the optional array parameter
35-
* aren't of the configured type.
40+
* @throws InvalidArgumentException If elements in the optional array parameter aren't of the configured type.
3641
*/
37-
public function __construct(array $input = [], int $flags = 0, string $iterator_class = "ArrayIterator")
42+
public function __construct(array $input = [], int $flags = 0, string $iterator_class = ArrayIterator::class)
3843
{
3944
// first argument is the php8.1 method to pass function reference as closure.
4045
// check https://www.php.net/manual/en/functions.first_class_callable_syntax.php

src/Linna/TypedArrayObject/ArrayOfClasses.php

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,36 +11,41 @@
1111

1212
namespace Linna\TypedArrayObject;
1313

14+
use ArrayIterator;
1415
use InvalidArgumentException;
1516

1617
/**
1718
* Provide a way for create an array of typed elements with php.
19+
*
20+
* @link https://www.php.net/manual/en/functions.first_class_callable_syntax.php
1821
*/
1922
class ArrayOfClasses extends AbstractArray
2023
{
2124
/**
22-
* @var string Current type for array
25+
* @var string Current type for array.
2326
*/
2427
protected string $class;
2528

2629
/**
27-
* It overrides parent message
28-
* @var string Exception message
30+
* It overrides parent message.
31+
*
32+
* @var string Exception message.
2933
*/
3034
protected string $exceptionMessage;
3135

3236

3337
/**
3438
* Class Contructor.
3539
*
36-
* @param array<object> $input
37-
* @param int $flags
38-
* @param string $iterator_class
40+
* @param array<object> $input Array of values, every value must be a <code>object</code>.
41+
* @param int $flags Flags to control the behaviour of the <code>ArrayObject</code> object,
42+
* see <code>ArrayObject</code> on php site.
43+
* @param class-string $iterator_class Specify the class that will be used for iteration of the <code>ArrayObject</code>
44+
* object, the class must implement <code>ArrayIterator</code>.
3945
*
40-
* @throws InvalidArgumentException If elements in the optional array parameter
41-
* aren't of the configured type.
46+
* @throws InvalidArgumentException If elements in the optional array parameter aren't of the configured type.
4247
*/
43-
public function __construct(string $class, array $input = [], int $flags = 0, string $iterator_class = "ArrayIterator")
48+
public function __construct(string $class, array $input = [], int $flags = 0, string $iterator_class = ArrayIterator::class)
4449
{
4550
$this->class = $class;
4651
$this->exceptionMessage = "Elements passed must be of the type <{$class}>.";
@@ -50,11 +55,11 @@ public function __construct(string $class, array $input = [], int $flags = 0, st
5055
}
5156

5257
/**
53-
* Check if argument is instance of specific class.
58+
* Check if the passed value is instance of specific class.
5459
*
55-
* @param mixed $value
60+
* @param mixed $value The value will be checked.
5661
*
57-
* @return bool
62+
* @return bool True if the value passed is a valid class, false otherwise.
5863
*/
5964
protected function is_class(mixed $value): bool
6065
{

src/Linna/TypedArrayObject/ArrayOfFloats.php

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,35 @@
1111

1212
namespace Linna\TypedArrayObject;
1313

14+
use ArrayIterator;
1415
use InvalidArgumentException;
1516

1617
/**
1718
* Provide a way to create an array of float typed elements with php.
19+
*
20+
* @link https://www.php.net/manual/en/functions.first_class_callable_syntax.php
1821
*/
1922
class ArrayOfFloats extends AbstractArray
2023
{
2124
/**
22-
* It overrides parent message
23-
* @var string Exception message
25+
* It overrides parent message.
26+
*
27+
* @var string Exception message.
2428
*/
2529
protected string $exceptionMessage = 'Elements passed must be of the type <float>.';
2630

2731
/**
2832
* Class Contructor.
2933
*
30-
* @param array<float> $input
31-
* @param int $flags
32-
* @param string $iterator_class
34+
* @param array<float> $input Array of values, every value must be a <code>float</code>.
35+
* @param int $flags Flags to control the behaviour of the <code>ArrayObject</code> object,
36+
* see <code>ArrayObject</code> on php site.
37+
* @param class-string $iterator_class Specify the class that will be used for iteration of the <code>ArrayObject</code>
38+
* object, the class must implement <code>ArrayIterator</code>.
3339
*
34-
* @throws InvalidArgumentException If elements in the optional array parameter
35-
* aren't of the configured type.
40+
* @throws InvalidArgumentException If elements in the optional array parameter aren't of the configured type.
3641
*/
37-
public function __construct(array $input = [], int $flags = 0, string $iterator_class = "ArrayIterator")
42+
public function __construct(array $input = [], int $flags = 0, string $iterator_class = ArrayIterator::class)
3843
{
3944
// first argument is the php8.1 method to pass function reference as closure.
4045
// check https://www.php.net/manual/en/functions.first_class_callable_syntax.php

src/Linna/TypedArrayObject/ArrayOfIntegers.php

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,35 @@
1111

1212
namespace Linna\TypedArrayObject;
1313

14+
use ArrayIterator;
1415
use InvalidArgumentException;
1516

1617
/**
1718
* Provide a way to create an array of integer typed elements with php.
19+
*
20+
* @link https://www.php.net/manual/en/functions.first_class_callable_syntax.php
1821
*/
1922
class ArrayOfIntegers extends AbstractArray
2023
{
2124
/**
22-
* It overrides parent message
23-
* @var string Exception message
25+
* It overrides parent message.
26+
*
27+
* @var string Exception message.
2428
*/
2529
protected string $exceptionMessage = 'Elements passed must be of the type <int>.';
2630

2731
/**
2832
* Class Contructor.
2933
*
30-
* @param array<int> $input
31-
* @param int $flags
32-
* @param string $iterator_class
34+
* @param array<int> $input Array of values, every value must be a <code>int</code>.
35+
* @param int $flags Flags to control the behaviour of the <code>ArrayObject</code> object,
36+
* see <code>ArrayObject</code> on php site.
37+
* @param class-string $iterator_class Specify the class that will be used for iteration of the <code>ArrayObject</code>
38+
* object, the class must implement <code>ArrayIterator</code>.
3339
*
34-
* @throws InvalidArgumentException If elements in the optional array parameter
35-
* aren't of the configured type.
40+
* @throws InvalidArgumentException If elements in the optional array parameter aren't of the configured type.
3641
*/
37-
public function __construct(array $input = [], int $flags = 0, string $iterator_class = "ArrayIterator")
42+
public function __construct(array $input = [], int $flags = 0, string $iterator_class = ArrayIterator::class)
3843
{
3944
// first argument is the php8.1 method to pass function reference as closure.
4045
// check https://www.php.net/manual/en/functions.first_class_callable_syntax.php

src/Linna/TypedArrayObject/ArrayOfObjects.php

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,35 @@
1111

1212
namespace Linna\TypedArrayObject;
1313

14+
use ArrayIterator;
1415
use InvalidArgumentException;
1516

1617
/**
1718
* Provide a way to create an array of object typed elements with php.
19+
*
20+
* @link https://www.php.net/manual/en/functions.first_class_callable_syntax.php
1821
*/
1922
class ArrayOfObjects extends AbstractArray
2023
{
2124
/**
22-
* It overrides parent message
23-
* @var string Exception message
25+
* It overrides parent message.
26+
*
27+
* @var string Exception message.
2428
*/
2529
protected string $exceptionMessage = 'Elements passed must be of the type <object>.';
2630

2731
/**
2832
* Class Contructor.
2933
*
30-
* @param array<object> $input
31-
* @param int $flags
32-
* @param string $iterator_class
34+
* @param array<object> $input Array of values, every value must be a <code>object</code>.
35+
* @param int $flags Flags to control the behaviour of the <code>ArrayObject</code> object,
36+
* see <code>ArrayObject</code> on php site.
37+
* @param class-string $iterator_class Specify the class that will be used for iteration of the <code>ArrayObject</code>
38+
* object, the class must implement <code>ArrayIterator</code>.
3339
*
34-
* @throws InvalidArgumentException If elements in the optional array parameter
35-
* aren't of the configured type.
40+
* @throws InvalidArgumentException If elements in the optional array parameter aren't of the configured type.
3641
*/
37-
public function __construct(array $input = [], int $flags = 0, string $iterator_class = "ArrayIterator")
42+
public function __construct(array $input = [], int $flags = 0, string $iterator_class = ArrayIterator::class)
3843
{
3944
// first argument is the php8.1 method to pass function reference as closure.
4045
// check https://www.php.net/manual/en/functions.first_class_callable_syntax.php

0 commit comments

Comments
 (0)