Skip to content

fix: Update dependencies (fix phpstan/rector issues) #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ jobs:
strategy:
matrix:
php-version:
- "8.2"
- "8.3"
- "8.4"

Expand Down
23 changes: 11 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,19 @@
}
],
"require": {
"php": "^8.2"
"php": "^8.3"
},
"require-dev": {
"brainbits/phpcs-standard": "^7.0.2",
"brainbits/phpstan-rules": "^3.1.2",
"ergebnis/phpstan-rules": "^2.5.2",
"thecodingmachine/phpstan-safe-rule": "^1.2.0",
"thecodingmachine/phpstan-strict-rules": "^1.0.0",
"phpstan/phpstan-phpunit": "^1.4.2",
"squizlabs/php_codesniffer": "^3.11.3",
"phpstan/phpstan": "^1.12.19",
"phpstan/phpstan-strict-rules": "^1.6.2",
"phpunit/phpunit": "^11.5.10",
"rector/rector": "^1.2.10"
"brainbits/phpcs-standard": "^8.0.0",
"brainbits/phpstan-rules": "^4.0.0",
"ergebnis/phpstan-rules": "^2.8.0",
"thecodingmachine/phpstan-safe-rule": "^1.4.0",
"phpstan/phpstan-phpunit": "^2.0.6",
"squizlabs/php_codesniffer": "^3.12.2",
"phpstan/phpstan": "^2.1.14",
"phpstan/phpstan-strict-rules": "^2.0.4",
"phpunit/phpunit": "^12.1.4",
"rector/rector": "^2.0.15"
},
"autoload": {
"psr-4": {
Expand Down
1 change: 0 additions & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,3 @@ includes:
- vendor/phpstan/phpstan-phpunit/extension.neon
- vendor/phpstan/phpstan-phpunit/rules.neon
- vendor/phpstan/phpstan-strict-rules/rules.neon
- vendor/thecodingmachine/phpstan-strict-rules/phpstan-strict-rules.neon
2 changes: 1 addition & 1 deletion src/InvalidValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ private static function withMessage(string $message): self
$line = $trace['line'] ?? null;

if ($file !== null && $line !== null && !str_contains($file, __DIR__)) {
$me->message = sprintf('%s in %s:%s', $me->message, basename($file), $line);
$me->message = sprintf('%s in %s:%s', $message, basename($file), $line);
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/NotConvertable.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ private static function withMessage(string $message): self
$line = $trace['line'] ?? null;

if ($file !== null && $line !== null && !str_contains($file, __DIR__)) {
$me->message = sprintf('%s in %s:%s', $me->message, basename($file), $line);
$me->message = sprintf('%s in %s:%s', $message, basename($file), $line);
break;
}
}
Expand Down
6 changes: 4 additions & 2 deletions src/TypeGuard.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ final class TypeGuard

private string $dateTimeFormat = 'c';

private static TypeGuard $typeGuard;

public static function instance(): self
{
static $instance = new self();
self::$typeGuard ??= new self();

return $instance;
return self::$typeGuard;
}

/** @return ($value is null ? null : bool) */
Expand Down
2 changes: 1 addition & 1 deletion tests/AsBoolTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#[CoversClass(TypeGuard::class)]
#[CoversClass(NotConvertable::class)]
#[CoversFunction('\Plook\TypeGuard\asBool')]
#[CoversFunction('Plook\TypeGuard\asBool')]
final class AsBoolTest extends TestCase
{
public function testDoesNotTouchBools(): void
Expand Down
4 changes: 2 additions & 2 deletions tests/AsDateTimeImmutableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

#[CoversClass(TypeGuard::class)]
#[CoversClass(NotConvertable::class)]
#[CoversFunction('\Plook\TypeGuard\asDateTimeImmutable')]
#[CoversFunction('\Plook\TypeGuard\asString')]
#[CoversFunction('Plook\TypeGuard\asDateTimeImmutable')]
#[CoversFunction('Plook\TypeGuard\asString')]
final class AsDateTimeImmutableTest extends TestCase
{
private readonly DateTimeZone $originalTimeZone;
Expand Down
6 changes: 3 additions & 3 deletions tests/AsDateTimeStringTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

#[CoversClass(TypeGuard::class)]
#[CoversClass(NotConvertable::class)]
#[CoversFunction('\Plook\TypeGuard\asDateTimeString')]
#[CoversFunction('\Plook\TypeGuard\asDateTimeImmutable')]
#[CoversFunction('\Plook\TypeGuard\asString')]
#[CoversFunction('Plook\TypeGuard\asDateTimeString')]
#[CoversFunction('Plook\TypeGuard\asDateTimeImmutable')]
#[CoversFunction('Plook\TypeGuard\asString')]
final class AsDateTimeStringTest extends TestCase
{
private readonly string $originalDateTimeFormat;
Expand Down
2 changes: 1 addition & 1 deletion tests/AsFloatTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#[CoversClass(TypeGuard::class)]
#[CoversClass(NotConvertable::class)]
#[CoversFunction('\Plook\TypeGuard\asFloat')]
#[CoversFunction('Plook\TypeGuard\asFloat')]
final class AsFloatTest extends TestCase
{
public function testDoesNotTouchFloats(): void
Expand Down
2 changes: 1 addition & 1 deletion tests/AsIntTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#[CoversClass(TypeGuard::class)]
#[CoversClass(NotConvertable::class)]
#[CoversFunction('\Plook\TypeGuard\asInt')]
#[CoversFunction('Plook\TypeGuard\asInt')]
final class AsIntTest extends TestCase
{
public function testDoesNotTouchInts(): void
Expand Down
2 changes: 1 addition & 1 deletion tests/AsStringTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#[CoversClass(TypeGuard::class)]
#[CoversClass(NotConvertable::class)]
#[CoversFunction('\Plook\TypeGuard\asString')]
#[CoversFunction('Plook\TypeGuard\asString')]
final class AsStringTest extends TestCase
{
public function testDoesNotTouchStrings(): void
Expand Down
2 changes: 1 addition & 1 deletion tests/BlankAsNullTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#[CoversClass(TypeGuard::class)]
#[CoversClass(NotConvertable::class)]
#[CoversFunction('\Plook\TypeGuard\blankAsNull')]
#[CoversFunction('Plook\TypeGuard\blankAsNull')]
final class BlankAsNullTest extends TestCase
{
public function testConvertsBlankToNull(): void
Expand Down
2 changes: 1 addition & 1 deletion tests/FalseAsNullTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#[CoversClass(TypeGuard::class)]
#[CoversClass(NotConvertable::class)]
#[CoversFunction('\Plook\TypeGuard\falseAsNull')]
#[CoversFunction('Plook\TypeGuard\falseAsNull')]
final class FalseAsNullTest extends TestCase
{
public function testConvertsFalseToNull(): void
Expand Down
2 changes: 1 addition & 1 deletion tests/FalsyAsNullTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#[CoversClass(TypeGuard::class)]
#[CoversClass(NotConvertable::class)]
#[CoversFunction('\Plook\TypeGuard\falsyAsNull')]
#[CoversFunction('Plook\TypeGuard\falsyAsNull')]
final class FalsyAsNullTest extends TestCase
{
public function testConvertsBlankToNull(): void
Expand Down
2 changes: 1 addition & 1 deletion tests/NotNullTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#[CoversClass(TypeGuard::class)]
#[CoversClass(InvalidValue::class)]
#[CoversFunction('\Plook\TypeGuard\notNull')]
#[CoversFunction('Plook\TypeGuard\notNull')]
final class NotNullTest extends TestCase
{
public function testDoesNotTouchInts(): void
Expand Down
2 changes: 1 addition & 1 deletion tests/ZeroAsNullTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#[CoversClass(TypeGuard::class)]
#[CoversClass(NotConvertable::class)]
#[CoversFunction('\Plook\TypeGuard\zeroAsNull')]
#[CoversFunction('Plook\TypeGuard\zeroAsNull')]
final class ZeroAsNullTest extends TestCase
{
public function testConvertsZeroIntToNull(): void
Expand Down