diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 9ceb096..48d4abf 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -2,9 +2,9 @@ name: Check on: push: - branches: ['2.0'] + branches: ['3.0'] pull_request: - branches: ['2.0'] + branches: ['3.0'] jobs: @@ -14,7 +14,7 @@ jobs: strategy: fail-fast: false matrix: - php: ['7.4', '8.0', '8.1', '8.2'] + php: ['8.1', '8.2', '8.3'] steps: - name: Checkout diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f67829..c9f9618 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## 3.0.0 + +### PHP support + +- Dropped support for PHP `8.0` and lower. +- Added support for PHP `8.3`. + ## 2.0.1 ### PHP support diff --git a/composer.json b/composer.json index 1b16781..eb0c7c5 100644 --- a/composer.json +++ b/composer.json @@ -22,11 +22,11 @@ } }, "require": { - "php": "7.4.* || 8.0.* || 8.1.* || 8.2.*" + "php": "8.1.* || 8.2.* || 8.3.*" }, "require-dev": { - "phpstan/phpstan": "1.9.12", - "phpunit/phpunit": "9.5.28", - "squizlabs/php_codesniffer": "3.7.1" + "phpstan/phpstan": "1.10.46", + "phpunit/phpunit": "10.4.2", + "squizlabs/php_codesniffer": "3.7.2" } } diff --git a/phpunit.xml b/phpunit.xml index 84828d8..3ac9e70 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,19 +1,17 @@ - - - - src/ - - - + ./tests/AngryBytes/DomainObject/Test - + + + src/ + + diff --git a/src/AngryBytes/DomainObject.php b/src/AngryBytes/DomainObject.php index b61d01c..b03e721 100644 --- a/src/AngryBytes/DomainObject.php +++ b/src/AngryBytes/DomainObject.php @@ -2,6 +2,8 @@ namespace AngryBytes; +use InvalidArgumentException; + /** * DomainObject * @@ -144,10 +146,7 @@ public function getPropertyValueAsSimple(string $property) */ public function propertyIsTraversable(string $property): bool { - return is_array($this->$property) - || $this->$property instanceof \Traversable - || $this->$property instanceof \stdClass - ; + return is_iterable($this->$property) || $this->$property instanceof \stdClass; } /** @@ -162,7 +161,7 @@ public function __get(string $name) // Make sure there's a getter if (!method_exists($this, $function)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'No getter for "' . $name . '" in "' . get_class($this) . '"' ); } @@ -180,7 +179,7 @@ public function __set(string $name, mixed $value): void // Make sure there's a getter if (!method_exists($this, $function)) { - throw new \InvalidArgumentException('No setter for "' . $name . '"'); + throw new InvalidArgumentException('No setter for "' . $name . '"'); } $this->$function($value); @@ -213,7 +212,7 @@ private function getGetters(): array $getters = []; foreach ($reflection->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) { // Only methods starting with "get" make the cut - if (substr($method->getName(), 0, 3) !== 'get') { + if (!str_starts_with($method->getName(), 'get')) { continue; }