Skip to content

Commit 835774e

Browse files
committed
Remove spread support from Features::include()
1 parent 51791b9 commit 835774e

File tree

4 files changed

+12
-14
lines changed

4 files changed

+12
-14
lines changed

CHANGELOG.md

+4-6
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@ This library adheres to [Semantic Versioning](https://semver.org/) and [Keep a C
66

77
### Added
88

9-
- `Widget_Feature` feature. #32
10-
- `Widget_Features` feature. #32
11-
- Ignore `.idea` dir from source control for PHPStorm users.
12-
- CI: support PHP 8.4. #35
9+
- `Widget_Feature` feature.
10+
- `Widget_Features` feature.
11+
- PHP 8.4 support.
1312

1413
### Changed
1514

16-
- PHPCS: The minimum PHP version is now 8.2.
17-
- Unit test: `WidgetFeatureTest` test works por PHP 8.3 and 8.4.
15+
- `Features::include()` no longer accepts a spread of individual `Feature` instances. Use something more specific like `Group` or `Ordered` to include multiple features at once.
1816

1917
## 4.0.0
2018

docs/features.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The `Features` interface describes multiple project features. This interface ext
66

77
```php
88
interface Features extends Feature{
9-
public function include( Feature ...$features ): void;
9+
public function include( Feature $feature ): void;
1010
}
1111
```
1212

src/features/class-group.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ public function boot(): void {
4040
}
4141

4242
/**
43-
* Include features.
43+
* Include a feature.
4444
*
45-
* @param Feature ...$features Features to include.
45+
* @param Feature $feature Feature to include.
4646
*/
47-
public function include( Feature ...$features ): void {
48-
array_push( $this->features, ...$features );
47+
public function include( Feature $feature ): void {
48+
$this->features[] = $feature;
4949
}
5050
}

src/types/interface-features.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
*/
1313
interface Features extends Feature {
1414
/**
15-
* Include features.
15+
* Include a feature.
1616
*
17-
* @param Feature ...$features Features to include.
17+
* @param Feature $feature Feature to include.
1818
*/
19-
public function include( Feature ...$features ): void;
19+
public function include( Feature $feature ): void;
2020
}

0 commit comments

Comments
 (0)