Skip to content

Commit e233170

Browse files
author
fureev
committed
fix
1 parent 766130f commit e233170

37 files changed

+334
-619
lines changed

.travis.yml

-51
This file was deleted.

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog][keepachangelog] and this project adheres to [Semantic Versioning][semver].
66

7+
## v5.0.0
8+
9+
### Added
10+
11+
- Add `PHP 8.4` support
12+
713
## v4.28.0
814

915
### Added

composer.json

+19-12
Original file line numberDiff line numberDiff line change
@@ -16,35 +16,42 @@
1616
}
1717
],
1818
"require": {
19-
"php": "^8.1|^8.2|^8.3",
19+
"php": "^8.4",
2020
"ext-mbstring": "*"
2121
},
2222
"require-dev": {
23-
"phpunit/phpunit": "^10.1.1",
24-
"phpstan/phpstan": "^1.10.14",
25-
"squizlabs/php_codesniffer": "^3.7.2"
23+
"ergebnis/composer-normalize": "^2.45",
24+
"phpstan/phpstan": "^2.0",
25+
"phpunit/phpunit": "^11.5",
26+
"squizlabs/php_codesniffer": "^3.11",
27+
"symfony/var-dumper": "^7.2"
2628
},
2729
"autoload": {
28-
"files": [
29-
"src/Global/base.php"
30-
],
3130
"psr-4": {
3231
"Php\\Support\\": "src/"
33-
}
32+
},
33+
"files": [
34+
"src/Global/base.php"
35+
]
3436
},
3537
"autoload-dev": {
3638
"psr-4": {
3739
"Php\\Support\\Tests\\": "tests/"
3840
}
3941
},
42+
"config": {
43+
"allow-plugins": {
44+
"ergebnis/composer-normalize": true
45+
}
46+
},
4047
"scripts": {
41-
"phpcs": "@php ./vendor/bin/phpcs",
4248
"cs-fix": "@php ./vendor/bin/phpcbf",
43-
"phpunit": "@php ./vendor/bin/phpunit --no-coverage --testdox --colors=always",
44-
"phpunit-test": "@php ./vendor/bin/phpunit --no-coverage --testdox --colors=always",
4549
"infection": "@php ./vendor/bin/infection --coverage=./storage/coverage --threads=4",
50+
"phpcs": "@php ./vendor/bin/phpcs",
51+
"phpstan": "@php ./vendor/bin/phpstan analyze -c phpstan.neon --no-progress --ansi",
52+
"phpunit": "@php ./vendor/bin/phpunit --no-coverage --testdox --colors=always",
4653
"phpunit-cover": "@php ./vendor/bin/phpunit --coverage-text",
47-
"phpstan": "@php ./vendor/bin/phpstan analyze -c ./phpstan.neon.dist --no-progress --ansi",
54+
"phpunit-test": "@php ./vendor/bin/phpunit --no-coverage --testdox --colors=always",
4855
"test": [
4956
"@phpstan",
5057
"@phpunit"

phpstan.neon.dist renamed to phpstan.neon

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
parameters:
2-
level: 'max'
2+
level: '6'
33
paths:
44
- src
5-
checkMissingIterableValueType: false
6-
checkGenericClassInNonGenericObjectType: false
5+
# - tests
6+
ignoreErrors:
7+
-
8+
identifier: trait.unused
79
excludePaths:
810
- 'src/Types/Point.php'
911
- 'src/Types/GeoPoint.php'

phpunit.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" bootstrap="vendor/autoload.php"
33
colors="true" processIsolation="false" executionOrder="random" resolveDependencies="true" stopOnFailure="false"
4-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd" cacheDirectory=".phpunit.cache"
4+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.5/phpunit.xsd" cacheDirectory=".phpunit.cache"
55
backupStaticProperties="false">
66
<coverage>
77
<report>

src/ConditionalHandler.php

+21-3
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,24 @@
3030
*/
3131
final class ConditionalHandler
3232
{
33+
/**
34+
* @var array
35+
* @phpstan-ignore missingType.iterableValue
36+
*/
3337
private array $params = [];
3438

39+
/**
40+
* @param Closure(mixed ...): mixed $handler
41+
* @param bool|(Closure(mixed ...): bool) $condition
42+
*/
3543
public function __construct(private Closure $handler, private bool|Closure $condition = true)
3644
{
3745
}
3846

47+
/**
48+
* @param (Closure(mixed ...): bool)|bool $fn
49+
* @return ConditionalHandler
50+
*/
3951
public function handleIf(Closure|bool $fn): self
4052
{
4153
$this->condition = $fn;
@@ -52,6 +64,9 @@ private function resolveCondition(): bool
5264
return $this->condition;
5365
}
5466

67+
/**
68+
* @param mixed ...$params
69+
*/
5570
public function resolve(mixed ...$params): mixed
5671
{
5772
$this->params = $params;
@@ -65,14 +80,17 @@ public function resolve(mixed ...$params): mixed
6580

6681
/**
6782
* @param mixed ...$params
68-
*
69-
* @return mixed
7083
*/
71-
public function __invoke(mixed ...$params)
84+
public function __invoke(mixed ...$params): mixed
7285
{
7386
return $this->resolve(...$params);
7487
}
7588

89+
/**
90+
* @param Closure(mixed ...): mixed $fn
91+
* @param bool|(Closure(mixed ...): bool) $condition
92+
* @return ConditionalHandler
93+
*/
7694
public static function make(Closure $fn, bool|Closure $condition = true): self
7795
{
7896
return new self($fn, $condition);

src/Enums/WithEnhancesForStrings.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ trait WithEnhancesForStrings
1414
casesToString as casesToStringBase;
1515
}
1616

17-
public static function casesToString(string $delimiter = ', ', callable $decorator = null): string
17+
public static function casesToString(string $delimiter = ', ', ?callable $decorator = null): string
1818
{
1919
if ($decorator === null) {
2020
$decorator = static fn(self $enumItem) => "{$enumItem->value}";

src/Exceptions/Exception.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ class Exception extends \Exception
2121
/**
2222
* Exception constructor.
2323
*
24-
* @param null|string $message
24+
* @param ?string $message
2525
* @param int $code
26-
* @param Throwable|null $previous
26+
* @param ?Throwable $previous
2727
*/
28-
public function __construct(?string $message = null, $code = 0, Throwable $previous = null)
28+
public function __construct(?string $message = null, int $code = 0, ?Throwable $previous = null)
2929
{
3030
parent::__construct($message ?? $this->getName(), $code, $previous);
3131
}

src/Exceptions/InvalidArgumentException.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ class InvalidArgumentException extends \InvalidArgumentException
1616
/**
1717
* Exception constructor.
1818
*
19-
* @param null|string $message
19+
* @param ?string $message
2020
* @param int $code
21-
* @param Throwable|null $previous
21+
* @param ?Throwable $previous
2222
*/
23-
public function __construct(?string $message = null, $code = 0, Throwable $previous = null)
23+
public function __construct(?string $message = null, int $code = 0, ?Throwable $previous = null)
2424
{
2525
parent::__construct($message ?? $this->getName(), $code, $previous);
2626
}

src/Exceptions/MissingMethodException.php

+8-10
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,14 @@ class MissingMethodException extends BadMethodCallException
1111
{
1212
use Thrower;
1313

14-
public function __construct(protected ?string $method = null, string $message = null)
15-
{
14+
public function __construct(
15+
protected ?string $method = null {
16+
get {
17+
return $this->method;
18+
}
19+
},
20+
?string $message = null
21+
) {
1622
parent::__construct(
1723
$message ??
1824
($this->getName() . ($this->method ? ': "' . $this->method . '"' : ''))
@@ -26,12 +32,4 @@ public function getName(): string
2632
{
2733
return 'Missing method';
2834
}
29-
30-
/**
31-
* @return null|string
32-
*/
33-
public function getMethod(): ?string
34-
{
35-
return $this->method;
36-
}
3735
}

0 commit comments

Comments
 (0)