Skip to content

Commit

Permalink
Merge pull request #8 from AngryBytes/feat/php-8.3
Browse files Browse the repository at this point in the history
Feat/php 8.3
  • Loading branch information
stephank authored Dec 1, 2023
2 parents b59ed55 + b057939 commit eba9988
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 23 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Check

on:
push:
branches: ['2.0']
branches: ['3.0']
pull_request:
branches: ['2.0']
branches: ['3.0']

jobs:

Expand All @@ -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
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
16 changes: 7 additions & 9 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
<?xml version="1.0"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.4/phpunit.xsd"
bootstrap="./vendor/autoload.php"
colors="true"
>

<coverage>
<include>
<directory suffix=".php">src/</directory>
</include>
</coverage>

<coverage/>
<testsuite name="DomainObject">
<directory>./tests/AngryBytes/DomainObject/Test</directory>
</testsuite>

<source>
<include>
<directory suffix=".php">src/</directory>
</include>
</source>
</phpunit>
13 changes: 6 additions & 7 deletions src/AngryBytes/DomainObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace AngryBytes;

use InvalidArgumentException;

/**
* DomainObject
*
Expand Down Expand Up @@ -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;
}

/**
Expand All @@ -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) . '"'
);
}
Expand All @@ -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);
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit eba9988

Please sign in to comment.