Skip to content

Commit ddda753

Browse files
authored
chore(deps): Bump PHP and dev dependency versions (#54)
- Require PHP ^8.2 and update dev packages: jbzoo/toolbox-dev ^7.2, jbzoo/data ^7.2, symfony/process >=7.3.4 - Update GitHub Actions: add permissions.contents read, remove schedule, bump matrix PHP versions to 8.2/8.3/8.4, and upgrade actions/upload-artifact to v4 - Normalize union type order and apply minor style fixes across src (non-functional) - Reorganize and restore several test cases/providers in tests/* - Minor README formatting tweaks and small comment adjustments
1 parent 346c3b2 commit ddda753

File tree

18 files changed

+303
-308
lines changed

18 files changed

+303
-308
lines changed

.github/workflows/main.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#
1212

1313
name: CI
14+
permissions:
15+
contents: read
1416

1517
on:
1618
pull_request:
@@ -19,8 +21,6 @@ on:
1921
push:
2022
branches:
2123
- 'master'
22-
schedule:
23-
- cron: '39 */8 * * *'
2424

2525
env:
2626
COLUMNS: 120
@@ -34,7 +34,7 @@ jobs:
3434
JBZOO_COMPOSER_UPDATE_FLAGS: ${{ matrix.composer_flags }}
3535
strategy:
3636
matrix:
37-
php-version: [ 8.1, 8.2, 8.3 ]
37+
php-version: [ 8.2, 8.3, 8.4 ]
3838
coverage: [ xdebug, none ]
3939
composer_flags: [ "--prefer-lowest", "" ]
4040
steps:
@@ -65,7 +65,7 @@ jobs:
6565
run: make report-coveralls --no-print-directory || true
6666

6767
- name: Upload Artifacts
68-
uses: actions/upload-artifact@v3
68+
uses: actions/upload-artifact@v4
6969
continue-on-error: true
7070
with:
7171
name: PHPUnit - ${{ matrix.php-version }} - ${{ matrix.coverage }}
@@ -77,7 +77,7 @@ jobs:
7777
runs-on: ubuntu-latest
7878
strategy:
7979
matrix:
80-
php-version: [ 8.1, 8.2, 8.3 ]
80+
php-version: [ 8.2, 8.3, 8.4 ]
8181
steps:
8282
- name: Checkout code
8383
uses: actions/checkout@v3
@@ -99,7 +99,7 @@ jobs:
9999
run: make codestyle --no-print-directory
100100

101101
- name: Upload Artifacts
102-
uses: actions/upload-artifact@v3
102+
uses: actions/upload-artifact@v4
103103
continue-on-error: true
104104
with:
105105
name: Linters - ${{ matrix.php-version }}
@@ -111,7 +111,7 @@ jobs:
111111
runs-on: ubuntu-latest
112112
strategy:
113113
matrix:
114-
php-version: [ 8.1, 8.2, 8.3 ]
114+
php-version: [ 8.2, 8.3, 8.4 ]
115115
steps:
116116
- name: Checkout code
117117
uses: actions/checkout@v3
@@ -133,7 +133,7 @@ jobs:
133133
run: make report-all --no-print-directory
134134

135135
- name: Upload Artifacts
136-
uses: actions/upload-artifact@v3
136+
uses: actions/upload-artifact@v4
137137
continue-on-error: true
138138
with:
139139
name: Reports - ${{ matrix.php-version }}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# JBZoo / Utils
22

3-
[![CI](https://github.com/JBZoo/Utils/actions/workflows/main.yml/badge.svg?branch=master)](https://github.com/JBZoo/Utils/actions/workflows/main.yml?query=branch%3Amaster) [![Coverage Status](https://coveralls.io/repos/github/JBZoo/Utils/badge.svg?branch=master)](https://coveralls.io/github/JBZoo/Utils?branch=master) [![Psalm Coverage](https://shepherd.dev/github/JBZoo/Utils/coverage.svg)](https://shepherd.dev/github/JBZoo/Utils) [![Psalm Level](https://shepherd.dev/github/JBZoo/Utils/level.svg)](https://shepherd.dev/github/JBZoo/Utils) [![CodeFactor](https://www.codefactor.io/repository/github/jbzoo/utils/badge)](https://www.codefactor.io/repository/github/jbzoo/utils/issues)
3+
[![CI](https://github.com/JBZoo/Utils/actions/workflows/main.yml/badge.svg?branch=master)](https://github.com/JBZoo/Utils/actions/workflows/main.yml?query=branch%3Amaster) [![Coverage Status](https://coveralls.io/repos/github/JBZoo/Utils/badge.svg?branch=master)](https://coveralls.io/github/JBZoo/Utils?branch=master) [![Psalm Coverage](https://shepherd.dev/github/JBZoo/Utils/coverage.svg)](https://shepherd.dev/github/JBZoo/Utils) [![Psalm Level](https://shepherd.dev/github/JBZoo/Utils/level.svg)](https://shepherd.dev/github/JBZoo/Utils) [![CodeFactor](https://www.codefactor.io/repository/github/jbzoo/utils/badge)](https://www.codefactor.io/repository/github/jbzoo/utils/issues)
44
[![Stable Version](https://poser.pugx.org/jbzoo/utils/version)](https://packagist.org/packages/jbzoo/utils/) [![Total Downloads](https://poser.pugx.org/jbzoo/utils/downloads)](https://packagist.org/packages/jbzoo/utils/stats) [![Dependents](https://poser.pugx.org/jbzoo/utils/dependents)](https://packagist.org/packages/jbzoo/utils/dependents?order_by=downloads) [![GitHub License](https://img.shields.io/github/license/jbzoo/utils)](https://github.com/JBZoo/Utils/blob/master/LICENSE)
55

66

@@ -889,6 +889,6 @@ MIT
889889
- [Composer-Graph](https://github.com/JBZoo/Composer-Graph) - Dependency graph visualization of composer.json based on mermaid-js.
890890
- [Mermaid-PHP](https://github.com/JBZoo/Mermaid-PHP) - Generate diagrams and flowcharts with the help of the mermaid script language.
891891
- [Image](https://github.com/JBZoo/Image) - Package provides object-oriented way to manipulate with images as simple as possible.
892-
- [Data](https://github.com/JBZoo/Data) - Extended implementation of ArrayObject. Use files as config/array.
892+
- [Data](https://github.com/JBZoo/Data) - Extended implementation of ArrayObject. Use files as config/array.
893893
- [Retry](https://github.com/JBZoo/Retry) - Tiny PHP library providing retry/backoff functionality with multiple backoff strategies and jitter support.
894894
- [SimpleTypes](https://github.com/JBZoo/SimpleTypes) - Converting any values and measures - money, weight, exchange rates, length, ...

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@
4848
],
4949

5050
"require" : {
51-
"php" : "^8.1"
51+
"php" : "^8.2"
5252
},
5353

5454
"require-dev" : {
55-
"jbzoo/toolbox-dev" : "^7.1",
56-
"jbzoo/data" : "^7.1",
57-
"symfony/process" : ">=6.4"
55+
"jbzoo/toolbox-dev" : "^7.2",
56+
"jbzoo/data" : "^7.2",
57+
"symfony/process" : ">=7.3.4"
5858
},
5959

6060
"suggest" : {

src/Arr.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public static function key(mixed $key, array $array, bool $returnValue = false):
7171
* Check is value exists in the array.
7272
* @SuppressWarnings(PHPMD.ShortMethodName)
7373
*/
74-
public static function in(mixed $value, array $array, bool $returnKey = false): null|bool|int|string
74+
public static function in(mixed $value, array $array, bool $returnKey = false): bool|int|string|null
7575
{
7676
$inArray = \in_array($value, $array, true);
7777

@@ -105,7 +105,7 @@ public static function last(array $array): mixed
105105
/**
106106
* Returns the first key in an array.
107107
*/
108-
public static function firstKey(array $array): null|int|string
108+
public static function firstKey(array $array): int|string|null
109109
{
110110
\reset($array);
111111

@@ -115,7 +115,7 @@ public static function firstKey(array $array): null|int|string
115115
/**
116116
* Returns the last key in an array.
117117
*/
118-
public static function lastKey(array $array): null|int|string
118+
public static function lastKey(array $array): int|string|null
119119
{
120120
\end($array);
121121

@@ -157,7 +157,7 @@ static function (mixed $value, int|string $key) use (&$flattened, $preserveKeys)
157157
*/
158158
public static function search(
159159
array $array,
160-
null|bool|float|int|string $search,
160+
bool|float|int|string|null $search,
161161
?string $field = null,
162162
): bool|string {
163163
// *grumbles* stupid PHP type system
@@ -411,11 +411,11 @@ public static function implode(string $glue, array $array): string
411411
/**
412412
* Remove all items from array by value.
413413
*/
414-
public static function removeByValue(array $array, null|bool|float|int|string $value): array
414+
public static function removeByValue(array $array, bool|float|int|string|null $value): array
415415
{
416416
return \array_filter(
417417
$array,
418-
static fn (null|bool|float|int|string $arrayItem): bool => $value !== $arrayItem,
418+
static fn (bool|float|int|string|null $arrayItem): bool => $value !== $arrayItem,
419419
\ARRAY_FILTER_USE_BOTH,
420420
);
421421
}

src/Dates.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ final class Dates
3131
/**
3232
* Convert to timestamp.
3333
*/
34-
public static function toStamp(null|\DateTime|int|string $time = null, bool $currentIsDefault = true): int
34+
public static function toStamp(\DateTime|int|string|null $time = null, bool $currentIsDefault = true): int
3535
{
3636
if ($time instanceof \DateTime) {
3737
return (int)$time->format('U');
@@ -51,7 +51,7 @@ public static function toStamp(null|\DateTime|int|string $time = null, bool $cur
5151
/**
5252
* Build PHP \DateTime object from mixed input.
5353
*/
54-
public static function factory(mixed $time = null, null|\DateTimeZone|string $timeZone = null): \DateTime
54+
public static function factory(mixed $time = null, \DateTimeZone|string|null $timeZone = null): \DateTime
5555
{
5656
$timeZone = self::timezone($timeZone);
5757

@@ -68,7 +68,7 @@ public static function factory(mixed $time = null, null|\DateTimeZone|string $ti
6868
/**
6969
* Returns a DateTimeZone object based on the current timezone.
7070
*/
71-
public static function timezone(null|\DateTimeZone|string $timezone = null): \DateTimeZone
71+
public static function timezone(\DateTimeZone|string|null $timezone = null): \DateTimeZone
7272
{
7373
if ($timezone instanceof \DateTimeZone) {
7474
return $timezone;
@@ -94,7 +94,7 @@ public static function is(?string $date): bool
9494
/**
9595
* Convert time for sql format.
9696
*/
97-
public static function sql(null|int|string $time = null): string
97+
public static function sql(int|string|null $time = null): string
9898
{
9999
return self::factory($time)->format(self::SQL_FORMAT);
100100
}

src/Env.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ final class Env
3030
*/
3131
public static function get(
3232
string $envVarName,
33-
null|bool|float|int|string $default = null,
33+
bool|float|int|string|null $default = null,
3434
int $options = self::VAR_STRING,
35-
): null|bool|float|int|string {
35+
): bool|float|int|string|null {
3636
$envKey = \trim($envVarName);
3737

3838
$value = \getenv($envKey);
@@ -52,7 +52,7 @@ public static function get(
5252
/**
5353
* Converts the type of values like "true", "false", "null" or "123".
5454
*/
55-
public static function convert(?string $value, int $options = self::VAR_STRING): null|bool|float|int|string
55+
public static function convert(?string $value, int $options = self::VAR_STRING): bool|float|int|string|null
5656
{
5757
$cleanedValue = \trim(Filter::stripQuotes((string)$value));
5858

src/FS.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ public static function perms(string $file, ?int $perms = null): string
8383
} elseif (($perms & self::TYPE_FIFO) === self::TYPE_FIFO) {
8484
$info = 'p';
8585
}
86-
// @codeCoverageIgnoreEnd
86+
87+
/** @codeCoverageIgnoreEnd */
8788

8889
// Owner
8990
$info .= (($perms & self::PERM_OWNER_READ) > 0 ? 'r' : '-');

src/Filter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ public static function float(mixed $value, int $round = 10): float
173173
/**
174174
* Smart convert any string to int.
175175
*/
176-
public static function int(null|bool|float|int|string $value): int
176+
public static function int(bool|float|int|string|null $value): int
177177
{
178178
$cleaned = (string)\preg_replace('#[^0-9-+.,]#', '', (string)$value);
179179
\preg_match('#[-+]?[\d]+#', $cleaned, $matches);
@@ -250,7 +250,7 @@ public static function trimExtend(string $value): string
250250
/**
251251
* Cleanup array. No empty values.
252252
*/
253-
public static function arr(mixed $value, null|\Closure|string $filter = null): array
253+
public static function arr(mixed $value, \Closure|string|null $filter = null): array
254254
{
255255
$array = (array)$value;
256256

src/Stats.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public static function mean(?array $values): float
6060
return 0;
6161
}
6262

63-
\array_walk($values, static function (null|float|int|string &$value): void {
63+
\array_walk($values, static function (float|int|string|null &$value): void {
6464
$value = float($value);
6565
});
6666
$sum = \array_sum($values);

src/Str.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ public static function uuid(): string
606606
/**
607607
* Get class name without namespace.
608608
*/
609-
public static function getClassName(null|object|string $object, bool $toLower = false): ?string
609+
public static function getClassName(object|string|null $object, bool $toLower = false): ?string
610610
{
611611
if (\is_object($object)) {
612612
$className = $object::class;
@@ -826,7 +826,7 @@ public static function listToDescription(array $data, bool $alignByKeys = false)
826826
/**
827827
* Extend version of checking if potetielly empty string is empty.
828828
*/
829-
public static function isEmpty(null|bool|string $value, bool $strict = false): bool
829+
public static function isEmpty(bool|string|null $value, bool $strict = false): bool
830830
{
831831
if ($value === null || $value === false) {
832832
return true;

0 commit comments

Comments
 (0)