Skip to content

Commit a5d3dd3

Browse files
committed
v1.0.1
1 parent e6ac371 commit a5d3dd3

File tree

5 files changed

+19
-21
lines changed

5 files changed

+19
-21
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212
- `Fixed` for any bug fixes.
1313
- `Security` in case of vulnerabilities
1414

15+
## [1.0.1] - 2020.08.02
16+
17+
### Changed
18+
19+
- Corrected return type for `set()` as `void`
20+
1521
## [1.0.0] - 2020.07.27
1622

1723
### Added

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ John Robinson, [Bayfront Media](https://www.bayfrontmedia.com)
1818

1919
## Requirements
2020

21-
* PHP > 7.1.0
21+
* PHP >= 7.1.0
2222

2323
## Installation
2424

@@ -124,7 +124,7 @@ Set an array item to a given value using "dot" notation.
124124

125125
**Returns:**
126126

127-
- (array)
127+
- (void)
128128

129129
**Example:**
130130

@@ -138,7 +138,7 @@ $array = [
138138
],
139139
];
140140
141-
$array = Arr::set($array, 'name.middle_name', 'Middle');
141+
Arr::set($array, 'name.middle_name', 'Middle');
142142
```
143143

144144
<hr />
@@ -220,7 +220,7 @@ Returns an array of values for a given key from an array using "dot" notation.
220220

221221
- `$array` (array): Original array
222222
- `$value` (string): Value to return in "dot" notation
223-
- `$key = NULL` (string): Optionally how to key the returned array in "dot" notation
223+
- `$key = NULL` (string|null): Optionally how to key the returned array in "dot" notation
224224

225225
**Returns:**
226226

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "Helper class to provide useful array functions.",
44
"homepage": "https://github.com/bayfrontmedia/php-array-helpers",
55
"license" : "MIT",
6-
"version": "1.0.0",
6+
"version": "1.0.1",
77
"type": "library",
88
"keywords": [
99
"php",

composer.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Arr.php

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
<?php
22
/**
3-
* Helper class to provide useful array functions
4-
*
5-
* Heavily inspired by: https://laravel.com/docs/7.x/helpers
6-
* See: https://github.com/laravel/framework/blob/5.8/src/Illuminate/Support/Arr.php
7-
*
8-
* @version 1.0.0
9-
* @link https://github.com/bayfrontmedia/php-array-helpers
10-
* @license MIT https://opensource.org/licenses/MIT
11-
* @copyright 2020 Bayfront Media https://www.bayfrontmedia.com
12-
* @author John Robinson <[email protected]>
3+
* @package php-array-helpers
4+
* @link https://github.com/bayfrontmedia/php-array-helpers
5+
* @author John Robinson <[email protected]>
6+
* @copyright 2020 Bayfront Media
137
*/
148

159
namespace Bayfront\ArrayHelpers;
@@ -86,10 +80,10 @@ public static function undot(array $array): array
8680
* @param string $key (Key to set in "dot" notation)
8781
* @param mixed $value (Value of key)
8882
*
89-
* @return array (Modified array)
83+
* @return void
9084
*/
9185

92-
public static function set(&$array, string $key, $value): array
86+
public static function set(&$array, string $key, $value): void
9387
{
9488

9589
$keys = explode('.', $key);
@@ -116,8 +110,6 @@ public static function set(&$array, string $key, $value): array
116110

117111
$array[array_shift($keys)] = $value;
118112

119-
return $array;
120-
121113
}
122114

123115
/**
@@ -180,7 +172,7 @@ public static function get(array $array, string $key, $default = NULL)
180172
*
181173
* @param array $array (Original array)
182174
* @param string $value (Value to return in "dot" notation)
183-
* @param string $key (Optionally how to key the returned array in "dot" notation)
175+
* @param string|null $key (Optionally how to key the returned array in "dot" notation)
184176
*
185177
* @return array
186178
*/

0 commit comments

Comments
 (0)