Skip to content
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

Feat/#23557 php84 update #1

Merged
merged 32 commits into from
Feb 7, 2025
Merged
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
2e78646
#23557 chore(*): add github workflows; remove psalm; analog to other …
micharoesler Jan 31, 2025
7e16f10
#23557 chore(*): add changelog.md
micharoesler Jan 31, 2025
1e47bc9
#23557 chore(*): add rector config analog to other repos
micharoesler Jan 31, 2025
bb2c036
#23557 chore(*): add pint config analog to other repos
micharoesler Jan 31, 2025
fcf0561
#23557 chore(*): add phpstan config analog to other repos, but with l…
micharoesler Jan 31, 2025
9607ace
#23557 chore(*): modify composer.json to add tools like phpstant, pin…
micharoesler Jan 31, 2025
763d851
#23557 chore(*): run rector over codebase (level 0)
micharoesler Jan 31, 2025
a0691f2
#23557 chore(*): run rector over codebase (level 1)
micharoesler Jan 31, 2025
0b642c7
#23557 chore(*): run rector over codebase (level 2)
micharoesler Jan 31, 2025
6b90920
#23557 chore(*): run rector over codebase (level 3)
micharoesler Jan 31, 2025
90528b8
#23557 chore(*): run rector over codebase (level 0-6) different ruleset
micharoesler Jan 31, 2025
a189635
#23557 chore(*): run rector over codebase (level 7) different ruleset
micharoesler Jan 31, 2025
1179b42
#23557 chore(*): run rector over codebase (level 12) different ruleset
micharoesler Jan 31, 2025
fee885d
#23557 chore(*): run rector over codebase (level 13) different ruleset
micharoesler Jan 31, 2025
76d0941
#23557 fix(*): fix issues found by phpstan and cody style check
micharoesler Jan 31, 2025
017ec84
#23557 fix(*): fix if block
micharoesler Jan 31, 2025
0d12ffb
#23557 fix(*): update changelog
micharoesler Jan 31, 2025
42db8af
#23557 fix(*): fix unit tests
micharoesler Jan 31, 2025
8fb0928
#23557 fix(*): fix unit tests; no more errors due to variables not in…
micharoesler Feb 3, 2025
f8c7bfe
#23557 fix(*): fix phpstan issues
micharoesler Feb 3, 2025
9323676
#23557 fix(*): run pint over codebase (tab vs. indents everywhere)
micharoesler Feb 3, 2025
af21061
#23557 fix(*): fix unit tests once more
micharoesler Feb 3, 2025
69cbd0e
#23557 fix(*): pint it up
micharoesler Feb 3, 2025
1df00b0
#23557 fix(*): version number to 3.0.0
micharoesler Feb 3, 2025
3a32462
#23557 fix(*): phpstan level 3 compliant
micharoesler Feb 3, 2025
9092467
#23557 fix(*): pinting the world
micharoesler Feb 3, 2025
1449c0e
Update .github/workflows/phpstan.yml
tmArtemeon Feb 6, 2025
4b2bc51
Update .github/workflows/pint.yml
tmArtemeon Feb 6, 2025
70039f9
Update .github/workflows/tests.yml
tmArtemeon Feb 6, 2025
d7f90d9
Update composer.json
tmArtemeon Feb 6, 2025
a09991f
Update changelog.md
tmArtemeon Feb 6, 2025
9ffbdec
Update pint.json
tmArtemeon Feb 6, 2025
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
Prev Previous commit
Next Next commit
#23557 chore(*): run rector over codebase (level 3)
micharoesler committed Jan 31, 2025
commit 6b909204cb3951482a8416de498523e586857ae4
70 changes: 45 additions & 25 deletions rector.php
Original file line number Diff line number Diff line change
@@ -8,29 +8,49 @@
->withPhpSets()
->withAttributesSets(phpunit: true)
->withRules([
Rector\CodeQuality\Rector\Ternary\ArrayKeyExistsTernaryThenValueToCoalescingRector::class,
Rector\CodeQuality\Rector\NullsafeMethodCall\CleanupUnneededNullsafeOperatorRector::class,
Rector\CodeQuality\Rector\ClassMethod\InlineArrayReturnAssignRector::class,
Rector\CodeQuality\Rector\Ternary\UnnecessaryTernaryExpressionRector::class,
Rector\DeadCode\Rector\Foreach_\RemoveUnusedForeachKeyRector::class,
Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictFluentReturnRector::class,
Rector\Php80\Rector\Class_\StringableForToStringRector::class,
Rector\CodingStyle\Rector\ArrowFunction\StaticArrowFunctionRector::class,
Rector\CodingStyle\Rector\Closure\StaticClosureRector::class,
Rector\DeadCode\Rector\Node\RemoveNonExistingVarAnnotationRector::class,
Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodParameterRector::class,
Rector\TypeDeclaration\Rector\ClassMethod\BoolReturnTypeFromBooleanStrictReturnsRector::class,
Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromReturnNewRector::class,
Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByMethodCallTypeRector::class,
Rector\TypeDeclaration\Rector\ClassMethod\NumericReturnTypeFromStrictScalarReturnsRector::class,
Rector\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedStrictParamTypeRector::class,
Rector\CodeQuality\Rector\If_\ExplicitBoolCompareRector::class,
Rector\CodeQuality\Rector\Foreach_\ForeachItemsAssignToEmptyArrayToAssignRector::class,
Rector\CodeQuality\Rector\Foreach_\ForeachToInArrayRector::class,
Rector\CodeQuality\Rector\BooleanAnd\RemoveUselessIsObjectCheckRector::class,
])
Rector\CodeQuality\Rector\Ternary\ArrayKeyExistsTernaryThenValueToCoalescingRector::class,
Rector\CodeQuality\Rector\NullsafeMethodCall\CleanupUnneededNullsafeOperatorRector::class,
Rector\CodeQuality\Rector\ClassMethod\InlineArrayReturnAssignRector::class,
Rector\CodingStyle\Rector\Stmt\NewlineAfterStatementRector::class,
Rector\CodingStyle\Rector\ClassMethod\NewlineBeforeNewAssignSetRector::class,
Rector\Php71\Rector\BooleanOr\IsIterableRector::class,
Rector\Php71\Rector\FuncCall\RemoveExtraParametersRector::class,
Rector\Php73\Rector\FuncCall\JsonThrowOnErrorRector::class,
Rector\TypeDeclaration\Rector\FunctionLike\AddReturnTypeDeclarationFromYieldsRector::class,
Rector\TypeDeclaration\Rector\FunctionLike\AddParamTypeForFunctionLikeWithinCallLikeArgDeclarationRector::class,
Rector\TypeDeclaration\Rector\FunctionLike\AddParamTypeSplFixedArrayRector::class,
Rector\Php80\Rector\Catch_\RemoveUnusedVariableInCatchRector::class,
Rector\Php84\Rector\Param\ExplicitNullableParamTypeRector::class,
Rector\DeadCode\Rector\Foreach_\RemoveUnusedForeachKeyRector::class,
Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPromotedPropertyRector::class,
Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictFluentReturnRector::class,
Rector\Php80\Rector\Class_\StringableForToStringRector::class,
Rector\CodeQuality\Rector\Ternary\UnnecessaryTernaryExpressionRector::class,
Rector\CodingStyle\Rector\ArrowFunction\StaticArrowFunctionRector::class,
Rector\CodingStyle\Rector\Closure\StaticClosureRector::class,
Rector\DeadCode\Rector\Node\RemoveNonExistingVarAnnotationRector::class,
Rector\DeadCode\Rector\ClassMethod\RemoveUnusedConstructorParamRector::class,
Rector\DeadCode\Rector\Concat\RemoveConcatAutocastRector::class,
Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodParameterRector::class,
Rector\Php72\Rector\FuncCall\GetClassOnNullRector::class,
Rector\Php73\Rector\FuncCall\ArrayKeyFirstLastRector::class,
Rector\Php80\Rector\ClassMethod\AddParamBasedOnParentClassMethodRector::class,
Rector\Php80\Rector\NotIdentical\StrContainsRector::class,
Rector\Php80\Rector\Identical\StrEndsWithRector::class,
Rector\Php80\Rector\Identical\StrStartsWithRector::class,
Rector\TypeDeclaration\Rector\ClassMethod\BoolReturnTypeFromBooleanStrictReturnsRector::class,
Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromReturnNewRector::class,
Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByMethodCallTypeRector::class,
Rector\TypeDeclaration\Rector\ClassMethod\NumericReturnTypeFromStrictScalarReturnsRector::class,
Rector\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedStrictParamTypeRector::class,
Rector\CodeQuality\Rector\If_\ExplicitBoolCompareRector::class,
Rector\CodeQuality\Rector\Foreach_\ForeachItemsAssignToEmptyArrayToAssignRector::class,
Rector\CodeQuality\Rector\Foreach_\ForeachToInArrayRector::class,
Rector\CodeQuality\Rector\BooleanAnd\RemoveUselessIsObjectCheckRector::class,
Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector::class,
])
->withPaths([
__DIR__ . '/src',
__DIR__ . '/tests',
])
->withTypeCoverageLevel(2);
__DIR__ . '/src',
__DIR__ . '/tests',
])
->withTypeCoverageLevel(3);
5 changes: 5 additions & 0 deletions src/IP.php
Original file line number Diff line number Diff line change
@@ -13,12 +13,15 @@ class IP implements Stringable
use PropertyTrait;

const IP_V4 = 'IPv4';

const IP_V6 = 'IPv6';

const IP_V4_MAX_PREFIX_LENGTH = 32;

const IP_V6_MAX_PREFIX_LENGTH = 128;

const IP_V4_OCTETS = 4;

const IP_V6_OCTETS = 16;

/**
@@ -35,6 +38,7 @@ public function __construct($ip)
if (!filter_var($ip, FILTER_VALIDATE_IP)) {
throw new IpException("Invalid IP address format");
}

$this->in_addr = inet_pton($ip);
}

@@ -116,6 +120,7 @@ public static function parseLong($longIP, $version=self::IP_V4): self
$binary[] = bcmod($longIP, 256);
$longIP = bcdiv($longIP, 256, 0);
}

$ip = new self(inet_ntop(call_user_func_array('pack', array_merge(['C*'], array_reverse($binary)))));
}

2 changes: 2 additions & 0 deletions src/Network.php
Original file line number Diff line number Diff line change
@@ -16,10 +16,12 @@ class Network implements \Iterator, \Countable, \Stringable
* @var IP
*/
private $ip;

/**
* @var IP
*/
private $netmask;

/**
* @var int
*/
1 change: 1 addition & 0 deletions src/PropertyTrait.php
Original file line number Diff line number Diff line change
@@ -39,6 +39,7 @@ public function __set($name, $value)
trigger_error('Undefined property');
return;
}

$this->$method($value);
}

2 changes: 2 additions & 0 deletions src/Range.php
Original file line number Diff line number Diff line change
@@ -16,10 +16,12 @@ class Range implements \Iterator, \Countable
* @var IP
*/
private $firstIP;

/**
* @var IP
*/
private $lastIP;

/**
* @var int
*/