diff --git a/.vim/coc-settings.json b/.vim/coc-settings.json
new file mode 100644
index 0000000..6ca861e
--- /dev/null
+++ b/.vim/coc-settings.json
@@ -0,0 +1,26 @@
+{
+ "diagnostic-languageserver.filetypes": {
+ "php": ["phpstan"]
+ },
+ "diagnostic-languageserver.linters": {
+ "phpstan": {
+ "command": "docker",
+ "debounce": 100,
+ "rootPatterns": [ "composer.json", "composer.lock", "vendor", ".git" ],
+ "args": [ "exec", "laradock-php-enum_workspace_1", "composer", "findbugs", "--", "--error-format", "raw", "--no-progress" ],
+ "offsetLine": 0,
+ "offsetColumn": 0,
+ "sourceName": "phpstan",
+ "formatLines": 1,
+ "formatPattern": [
+ "^/var/www/([^:]+):(\\d+):(.*)(\\r|\\n)*$",
+ {
+ "sourceName": 1,
+ "sourceNameFilter": true,
+ "line": 2,
+ "message": 3
+ }
+ ]
+ }
+ }
+}
diff --git a/composer.json b/composer.json
index cca140a..e02c095 100644
--- a/composer.json
+++ b/composer.json
@@ -20,7 +20,7 @@
],
"require": {
"php": "^7.3|^8.0",
- "ngmy/typed-array": "^0.6.0"
+ "ngmy/typed-array": "^0.8.0"
},
"autoload": {
"psr-4": {
diff --git a/composer.lock b/composer.lock
index 3c89142..24c3434 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,20 +4,20 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "8d72452ca285dffd14b375d9b5c729f0",
+ "content-hash": "66253266947ae0e3c0d9562c9406f21c",
"packages": [
{
"name": "ngmy/typed-array",
- "version": "0.6.0",
+ "version": "0.8.0",
"source": {
"type": "git",
"url": "https://github.com/ngmy/php-typed-array.git",
- "reference": "a7fb1b469b33f875c8198eb3a55de73673750eee"
+ "reference": "edc2ba905657f8b7373ad8f08c9011fa524389ad"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/ngmy/php-typed-array/zipball/a7fb1b469b33f875c8198eb3a55de73673750eee",
- "reference": "a7fb1b469b33f875c8198eb3a55de73673750eee",
+ "url": "https://api.github.com/repos/ngmy/php-typed-array/zipball/edc2ba905657f8b7373ad8f08c9011fa524389ad",
+ "reference": "edc2ba905657f8b7373ad8f08c9011fa524389ad",
"shasum": ""
},
"require": {
@@ -50,7 +50,7 @@
],
"support": {
"issues": "https://github.com/ngmy/php-typed-array/issues",
- "source": "https://github.com/ngmy/php-typed-array/tree/0.6.0"
+ "source": "https://github.com/ngmy/php-typed-array/tree/0.8.0"
},
"funding": [
{
@@ -62,7 +62,7 @@
"type": "github"
}
],
- "time": "2021-03-18T12:09:44+00:00"
+ "time": "2021-03-20T15:20:15+00:00"
}
],
"packages-dev": [],
diff --git a/docs/api/classes/Ngmy-Enum-Enum.html b/docs/api/classes/Ngmy-Enum-Enum.html
index 22473d8..174c5f2 100644
--- a/docs/api/classes/Ngmy-Enum-Enum.html
+++ b/docs/api/classes/Ngmy-Enum-Enum.html
@@ -118,7 +118,7 @@
$names
- : array<string, list<string|int, string>>
+ : array<string, array<int, string>>
@@ -188,7 +188,7 @@
values()
- : list<string|int, static>
+ : array<int, static>
Returns all constants of this enum type.
@@ -278,7 +278,7 @@
private
- static array<string, list<string|int, string>>
+ static array<string, array<int, string>>
$names
= []
@@ -322,14 +322,14 @@
Returns the enum constant of the specified name.
public
- final static __callStatic(string $name, list<string|int, mixed> $arguments) : static
+ final static __callStatic(string $name, array<int, mixed> $arguments) : static
@@ -344,7 +344,7 @@ Parameters
$arguments
- : list<string|int, mixed>
+ : array<int, mixed>
@@ -353,6 +353,21 @@ Parameters
+
+
+ -
+ phpstan-param
+
+ -
+
+
+
+
+
Return values
static
@@ -374,7 +389,7 @@
@@ -425,7 +440,7 @@
Returns the name of this enum constant, as contained in the declaration.
@@ -459,7 +474,7 @@
@@ -491,7 +506,7 @@
Returns true if the specified object is equal to this enum constant.
@@ -535,7 +550,7 @@ Returns the hash code for this enum constant
@@ -569,7 +584,7 @@ Returns the name of this enum constant, exactly as declared in its enum declaration.
@@ -603,7 +618,7 @@ Returns the ordinal of this enum constant.
@@ -638,7 +653,7 @@ Returns the enum constant of the specified name.
@@ -682,22 +697,37 @@ Returns all constants of this enum type.
public
- final static values() : list<string|int, static>
+ final static values() : array<int, static>
+
+
+ -
+ phpstan-return
+
+ -
+
+
+
+
+
Return values
- list<string|int, static>
+ array<int, static>
—
@@ -716,7 +746,7 @@
@@ -749,7 +779,7 @@
@@ -791,7 +821,7 @@
diff --git a/docs/api/classes/Ngmy-Enum-EnumSet.html b/docs/api/classes/Ngmy-Enum-EnumSet.html
index 838e097..13aa8e8 100644
--- a/docs/api/classes/Ngmy-Enum-EnumSet.html
+++ b/docs/api/classes/Ngmy-Enum-EnumSet.html
@@ -292,7 +292,7 @@
toArray()
- : list<string|int, Enum>
+ : array<int, Enum>
Gets the enum set of values as a plain array.
@@ -1120,7 +1120,7 @@
public
- toArray() : list<string|int, Enum>
+ toArray() : array<int, Enum>
@@ -1143,7 +1143,7 @@
The hash map of key's hash codes and keys.
+
private
array<int|string, mixed>
$keys
= []
-
+ This is only used when the key type is the object, class, interface, or trait type.
+
@@ -796,10 +805,11 @@
-
+
The hash map of key's hash codes and values.
+
private
array<int|string, mixed>
@@ -892,7 +902,7 @@
@@ -940,7 +950,7 @@
@@ -997,7 +1007,7 @@
Determines if the typed array is empty or not.
@@ -1031,7 +1041,7 @@
Creates a new instance of the typed array.
@@ -1065,7 +1075,7 @@
@@ -1124,7 +1134,7 @@
@@ -1192,7 +1202,7 @@
@@ -1277,7 +1287,7 @@
@@ -1336,7 +1346,7 @@
Gets the typed array of values as a plain array.
@@ -1385,7 +1395,7 @@
Returns a new instance of the typed array with the array type value.
@@ -1434,7 +1444,7 @@
Returns a new instance of the typed array with the bool type key.
@@ -1483,7 +1493,7 @@
Returns a new instance of the typed array with the bool type value.
@@ -1532,7 +1542,7 @@
Returns a new instance of the typed array with the specified class type key.
@@ -1621,7 +1631,7 @@
Returns a new instance of the typed array with the specified class type value.
@@ -1698,7 +1708,7 @@
Returns a new instance of the typed array with the float type key.
@@ -1747,7 +1757,7 @@
Returns a new instance of the typed array with the float type value.
@@ -1796,7 +1806,7 @@
Returns a new instance of the typed array with the class type key that implements the specified interface.
@@ -1885,7 +1895,7 @@
Returns a new instance of the typed array with the class type value that implements the specified interface.
@@ -1962,7 +1972,7 @@
Returns a new instance of the typed array with the int type key.
@@ -2011,7 +2021,7 @@
Returns a new instance of the typed array with the int type value.
@@ -2060,7 +2070,7 @@
Returns a new instance of the typed array with the mixed type key.
@@ -2109,7 +2119,7 @@
Returns a new instance of the typed array with the mixed type value.
@@ -2158,7 +2168,7 @@
Returns a new instance of the typed array with the object type key.
@@ -2219,7 +2229,7 @@
Returns a new instance of the typed array with the object type value.
@@ -2268,7 +2278,7 @@
Returns a new instance of the typed array with the resource type key.
@@ -2317,7 +2327,7 @@
Returns a new instance of the typed array with the resource type value.
@@ -2366,7 +2376,7 @@
Returns a new instance of the typed array with the string type key.
@@ -2415,7 +2425,7 @@
Returns a new instance of the typed array with the string type value.
@@ -2464,7 +2474,7 @@
Returns a new instance of the typed array with the class type key that uses the specified trait.
@@ -2535,7 +2545,7 @@
Returns a new instance of the typed array with the class type value that uses the specified trait.
@@ -2594,7 +2604,7 @@
@@ -2657,7 +2667,7 @@
@@ -2687,6 +2697,58 @@ Return values
+
+
+
+ keyExists()
+
+
+
+
+
+
+ private
+ keyExists(mixed $key, int|string|null $keyHashCode) : bool
+
+
+
+ Parameters
+
+ -
+ $key
+ : mixed
+
+ -
+
+
+
+ -
+ $keyHashCode
+ : int|string|null
+
+ -
+
+
+
+
+
+
+
+ Return values
+ bool
+ —
+
+
+
diff --git a/docs/api/js/searchIndex.js b/docs/api/js/searchIndex.js
index 9d37cd2..1dcb497 100644
--- a/docs/api/js/searchIndex.js
+++ b/docs/api/js/searchIndex.js
@@ -445,6 +445,11 @@ Search.appendIndex(
"name": "getKeyHashCode",
"summary": "",
"url": "classes/Ngmy-TypedArray-TypedArray.html#method_getKeyHashCode"
+ }, {
+ "fqsen": "\\Ngmy\\TypedArray\\TypedArray\u003A\u003AkeyExists\u0028\u0029",
+ "name": "keyExists",
+ "summary": "",
+ "url": "classes/Ngmy-TypedArray-TypedArray.html#method_keyExists"
}, {
"fqsen": "\\Ngmy\\TypedArray\\TypedArray\u003A\u003AKEY_TYPES",
"name": "KEY_TYPES",
@@ -488,12 +493,12 @@ Search.appendIndex(
}, {
"fqsen": "\\Ngmy\\TypedArray\\TypedArray\u003A\u003A\u0024keys",
"name": "keys",
- "summary": "",
+ "summary": "The\u0020hash\u0020map\u0020of\u0020key\u0027s\u0020hash\u0020codes\u0020and\u0020keys.",
"url": "classes/Ngmy-TypedArray-TypedArray.html#property_keys"
}, {
"fqsen": "\\Ngmy\\TypedArray\\TypedArray\u003A\u003A\u0024values",
"name": "values",
- "summary": "",
+ "summary": "The\u0020hash\u0020map\u0020of\u0020key\u0027s\u0020hash\u0020codes\u0020and\u0020values.",
"url": "classes/Ngmy-TypedArray-TypedArray.html#property_values"
}, {
"fqsen": "\\",
diff --git a/src/Enum.php b/src/Enum.php
index de5a49e..097db9c 100644
--- a/src/Enum.php
+++ b/src/Enum.php
@@ -12,7 +12,7 @@
abstract class Enum
{
/**
- * @var array>
+ * @var array>
* @phpstan-var array>
*/
private static $names = [];
@@ -23,8 +23,10 @@ abstract class Enum
/**
* Returns the enum constant of the specified name.
*
- * @param list $arguments
+ * @param array $arguments
* @return static
+ *
+ * @phpstan-param list $arguments
*/
final public static function __callStatic(string $name, array $arguments): self
{
@@ -44,7 +46,9 @@ final public static function valueOf(string $name): self
/**
* Returns all constants of this enum type.
*
- * @return list
+ * @return array
+ *
+ * @phpstan-return list
*/
final public static function values(): array
{
@@ -56,8 +60,10 @@ final public static function values(): array
/**
* Returns names of all constants of this enum type.
*
- * @return list
+ * @return array
* @internal
+ *
+ * @phpstan-return list
*/
final public static function names(): array
{
diff --git a/src/EnumSet.php b/src/EnumSet.php
index 527c58e..46dd16e 100644
--- a/src/EnumSet.php
+++ b/src/EnumSet.php
@@ -147,14 +147,14 @@ public function isEmpty(): bool
/**
* Gets the enum set of values as a plain array.
*
- * @return list
+ * @return array
*
* @phpstan-return list
*/
public function toArray(): array
{
/**
- * @var list
+ * @var array
* @phpstan-var list
*/
$array = $this->enumMap->toArray();
diff --git a/tests/EnumMapTest.php b/tests/EnumMapTest.php
index c83534e..2235420 100644
--- a/tests/EnumMapTest.php
+++ b/tests/EnumMapTest.php
@@ -70,8 +70,10 @@ public function isEmptyProvider(): array
}
/**
- * @param list $enums
+ * @param array $enums
* @dataProvider isEmptyProvider
+ *
+ * @phpstan-param list $enums
*/
public function testIsEmpty(array $enums, bool $expected): void
{
@@ -94,8 +96,10 @@ public function countProvider(): array
}
/**
- * @param list $enums
+ * @param array $enums
* @dataProvider countProvider
+ *
+ * @phpstan-param list $enums
*/
public function testCount(array $enums, int $expected): void
{
@@ -231,10 +235,13 @@ public function dataProvider(): array
* TODO: Split this test into several smaller tests
*
* @param EnumMap $enumMap
- * @param list $keys
- * @param list $values
+ * @param array $keys
+ * @param array $values
* @param array|Exception $expected
* @dataProvider dataProvider
+ *
+ * @phpstan-param list $keys
+ * @phpstan-param list $values
*/
public function test(EnumMap $enumMap, array $keys, array $values, $expected): void
{
diff --git a/tests/EnumTest.php b/tests/EnumTest.php
index 0d9d7ed..05e5046 100644
--- a/tests/EnumTest.php
+++ b/tests/EnumTest.php
@@ -86,10 +86,11 @@ public function valuesProvider(): array
}
/**
- * @param Exception|list $expected
+ * @param Exception|array $expected
* @dataProvider valuesProvider
*
- * @phpstan-param class-string $class
+ * @phpstan-param class-string $class
+ * @phpstan-param Exception|list $expected
*/
public function testValues(string $class, $expected): void
{
@@ -129,12 +130,13 @@ public function namesProvider(): array
}
/**
- * @param Exception|list $expected
+ * @param Exception|array $expected
* @dataProvider namesProvider
* @runInSeparateProcess
* @preserveGlobalState disabled
*
- * @phpstan-param class-string $class
+ * @phpstan-param class-string $class
+ * @phpstan-param Exception|list $expected
*/
public function testNames(string $class, $expected): void
{