Skip to content

Commit 6ba1780

Browse files
committed
up: update some for run on php8.4
1 parent 01afddf commit 6ba1780

15 files changed

+47
-59
lines changed

.github/workflows/php.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,17 @@ on:
1111

1212
jobs:
1313
test:
14-
name: Test on php ${{ matrix.php}} and ${{ matrix.os }}
15-
runs-on: ${{ matrix.os }}
14+
name: Test on php ${{ matrix.php}}
15+
runs-on: ubuntu-latest
1616
timeout-minutes: 10
1717
strategy:
1818
fail-fast: true
1919
matrix:
20-
php: [ 8.1, 8.2] # 7.1, 7.2,
21-
os: [ubuntu-latest] # windows-latest, macOS-latest
20+
php: [ 8.1, 8.2, 8.3, 8.4] # 7.1, 7.2,
2221

2322
steps:
2423
- name: Checkout
25-
uses: actions/checkout@v3
24+
uses: actions/checkout@v4
2625

2726
# usage refer https://github.com/shivammathur/setup-php
2827
- name: Setup PHP
@@ -46,4 +45,4 @@ jobs:
4645

4746
- name: Run unit tests
4847
# run: composer run test
49-
run: phpunit -vv
48+
run: phpunit

.github/workflows/release.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,15 @@ on:
77

88
jobs:
99
release:
10-
name: Test on php ${{ matrix.php}}
10+
name: New tag release
1111
runs-on: ubuntu-latest
1212
timeout-minutes: 10
1313
strategy:
1414
fail-fast: true
15-
matrix:
16-
php: [8.1]
1715

1816
steps:
1917
- name: Checkout
20-
uses: actions/checkout@v3
18+
uses: actions/checkout@v4
2119
with:
2220
fetch-depth: 0
2321

@@ -35,7 +33,7 @@ jobs:
3533
3634
# https://github.com/softprops/action-gh-release
3735
- name: Create release and upload assets
38-
uses: softprops/action-gh-release@v1
36+
uses: softprops/action-gh-release@v2
3937
env:
4038
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4139
with:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ composer.lock
1212
*.swo
1313
.DS_Store
1414
.phpunit.result.cache
15+
*.cache

README.en.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# PHP Validate
22

33
[![License](https://img.shields.io/packagist/l/inhere/php-validate.svg?style=flat-square)](LICENSE)
4-
[![Php Version](https://img.shields.io/badge/php-%3E=8.1-brightgreen.svg?maxAge=2592000)](https://packagist.org/packages/inhere/php-validate)
4+
[![Php Version](https://img.shields.io/packagist/php-v/inhere/php-validate?maxAge=2592000)](https://packagist.org/packages/inhere/php-validate)
55
[![Latest Stable Version](http://img.shields.io/packagist/v/inhere/php-validate.svg)](https://packagist.org/packages/inhere/php-validate)
66
[![Coverage Status](https://coveralls.io/repos/github/inhere/php-validate/badge.svg?branch=master)](https://coveralls.io/github/inhere/php-validate?branch=master)
77
[![Github Actions Status](https://github.com/inhere/php-validate/workflows/Unit-tests/badge.svg)](https://github.com/inhere/php-validate/actions)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# PHP Validate
22

33
[![License](https://img.shields.io/packagist/l/inhere/php-validate.svg?style=flat-square)](LICENSE)
4-
[![Php Version](https://img.shields.io/badge/php-%3E=8.1-brightgreen.svg?maxAge=2592000)](https://packagist.org/packages/inhere/php-validate)
4+
[![Php Version](https://img.shields.io/packagist/php-v/inhere/php-validate?maxAge=2592000)](https://packagist.org/packages/inhere/php-validate)
55
[![Latest Stable Version](http://img.shields.io/packagist/v/inhere/php-validate.svg)](https://packagist.org/packages/inhere/php-validate)
66
[![Coverage Status](https://coveralls.io/repos/github/inhere/php-validate/badge.svg?branch=master)](https://coveralls.io/github/inhere/php-validate?branch=master)
77
[![Github Actions Status](https://github.com/inhere/php-validate/workflows/Unit-tests/badge.svg)](https://github.com/inhere/php-validate/actions)

composer.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@
2222
"php": ">8.1.0",
2323
"toolkit/stdlib": "~2.0"
2424
},
25-
"require-dev": {
26-
"phpunit/phpunit": "^9.5"
27-
},
25+
"require-dev": {},
2826
"autoload": {
2927
"psr-4": {
3028
"Inhere\\Validate\\": "src/"

phpunit.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" backupGlobals="false" bootstrap="test/bootstrap.php" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/12.1/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
3+
<testsuites>
4+
<testsuite name="Php Package Test Suite">
5+
<directory>test</directory>
6+
</testsuite>
7+
</testsuites>
8+
<source>
9+
<include>
10+
<directory suffix=".php">src</directory>
11+
</include>
12+
</source>
13+
</phpunit>

phpunit.xml.dist

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/AbstractValidation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ abstract class AbstractValidation implements ValidationInterface
2626
/**
2727
* @var array
2828
*/
29-
protected $data = [];
29+
protected array $data = [];
3030

3131
/**
3232
* @param array $data

src/Filter/Filters.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public static function abs(mixed $val): int
156156
*
157157
* @return int|float
158158
*/
159-
public static function float(mixed $val, int $decimal = null, int|string $flags = FILTER_FLAG_ALLOW_FRACTION): int|float
159+
public static function float(mixed $val, ?int $decimal = null, int|string $flags = FILTER_FLAG_ALLOW_FRACTION): int|float
160160
{
161161
$options = (int)$flags !== 0 ? ['flags' => (int)$flags] : [];
162162

@@ -509,7 +509,7 @@ public static function str2array(string $string, string $delimiter = ',', int $l
509509
*
510510
* @return string
511511
*/
512-
public static function clearTags(mixed $val, string $allowedTags = null): string
512+
public static function clearTags(mixed $val, ?string $allowedTags = null): string
513513
{
514514
return self::stripTags($val, $allowedTags);
515515
}
@@ -520,7 +520,7 @@ public static function clearTags(mixed $val, string $allowedTags = null): string
520520
*
521521
* @return string
522522
*/
523-
public static function stripTags(mixed $val, string $allowedTags = null): string
523+
public static function stripTags(mixed $val, ?string $allowedTags = null): string
524524
{
525525
if (!$val || !is_string($val)) {
526526
return '';

0 commit comments

Comments
 (0)