Skip to content

Commit

Permalink
Merge pull request #25 from patinthehat/v2
Browse files Browse the repository at this point in the history
Add PHP 8-only support (v2)
  • Loading branch information
freekmurze authored Mar 26, 2021
2 parents 4942bd8 + a116363 commit 9de2c86
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
php: [8.0, 7.4, 7.3, 7.2]
php: [8.0]
dependency-version: [prefer-lowest, prefer-stable]
os: [ubuntu-latest, windows-latest]

Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All notable changes to `macroable` will be documented in this file

## 2.0.0 - unreleased

- require PHP 8+
- drop support for PHP 7.x
- convert syntax to PHP 8

## 1.0.1 - 2020-11-03

- add support for PHP 8.0
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
}
],
"require": {
"php": "^7.2|^8.0"
"php": "^8.0"
},
"require-dev": {
"phpunit/phpunit": "^8.0|^9.3"
Expand Down
19 changes: 4 additions & 15 deletions src/Macroable.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,14 @@

trait Macroable
{
protected static $macros = [];

/**
* Register a custom macro.
*
* @param string $name
* @param object|callable $macro
*/
public static function macro(string $name, $macro)
protected static array $macros = [];

public static function macro(string $name, object | callable $macro): void
{
static::$macros[$name] = $macro;
}

/**
* Mix another object into the class.
*
* @param object $mixin
*/
public static function mixin($mixin)
public static function mixin(object | string $mixin): void
{
$methods = (new ReflectionClass($mixin))->getMethods(
ReflectionMethod::IS_PUBLIC | ReflectionMethod::IS_PROTECTED
Expand Down

0 comments on commit 9de2c86

Please sign in to comment.