Skip to content

Commit

Permalink
support for PHP 8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Sep 12, 2021
1 parent a8a4753 commit f4c9a05
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php: ['7.1', '7.2', '7.3', '7.4', '8.0']
php: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1']

fail-fast: false

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}
],
"require": {
"php": ">=7.1 <8.1",
"php": ">=7.1 <8.2",
"nette/utils": "^3.1.4 || ^4.0"
},
"require-dev": {
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Installation:
composer require nette/schema
```

It requires PHP version 7.1 and supports PHP up to 8.0.
It requires PHP version 7.1 and supports PHP up to 8.1.


[Support Me](https://github.com/sponsors/dg)
Expand Down
5 changes: 3 additions & 2 deletions src/Schema/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ public static function merge($value, $base)

public static function getPropertyType(\ReflectionProperty $prop): ?string
{
if ($types = Reflection::getPropertyTypes($prop)) {
return implode('|', $types);
$kind = '|';
if ($types = Reflection::getPropertyTypes($prop, $kind)) {
return implode($kind, $types);
} elseif ($type = preg_replace('#\s.*#', '', (string) self::parseAnnotation($prop, 'var'))) {
$class = Reflection::getPropertyDeclaringClass($prop);
return preg_replace_callback('#[\w\\\\]+#', function ($m) use ($class) {
Expand Down

0 comments on commit f4c9a05

Please sign in to comment.