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
Show file tree
Hide file tree
Changes from all commits
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
40 changes: 0 additions & 40 deletions .github/workflows/ci.yml

This file was deleted.

9 changes: 9 additions & 0 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: PHPStan
on:
pull_request:
push:
branches:
- 1.x
jobs:
phpstan:
uses: artemeon/.shared/.github/workflows/phpstan-php84-upwards.yml@main
27 changes: 27 additions & 0 deletions .github/workflows/pint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Pint

on:
- pull_request

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
pint:
name: Pint (PHP-CS-Fixer)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.4"
coverage: none
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Composer install
run: composer install --no-interaction --no-ansi --no-progress
- name: Run Pint
run: composer pint
22 changes: 22 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: UNIT-TESTS
on:
pull_request:
push:
branches:
- 1.x
jobs:
phpunit:
name: PHPUnit
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.4
coverage: none
- name: Composer install
run: composer install --no-interaction --no-ansi --no-progress
- name: Run PHPUnit
run: vendor/phpunit/phpunit/phpunit -c ./phpunit.xml.dist
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## 3.0.0 - 2025-01-31
- Drop support for PHP 8.0, PHP 8.1, PHP 8.2 and PHP 8.3.
- Add Support for PHP 8.4.

## 0.1.0 - Some time in the past
* Initial release
23 changes: 20 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,35 @@
"description": "PHP Library for manipulating network addresses (IPv4 and IPv6)",
"keywords": ["IP-Tools", "network", "subnet", "cidr", "IP", "IPv4", "IPv6"],
"license": "MIT",
"scripts": {
"phpstan": "php ./vendor/bin/phpstan analyse --memory-limit=4G",
"pint": "./vendor/bin/pint --test -v",
"pint:fix": "./vendor/bin/pint",
"test": "./vendor/bin/pest"
},
"authors": [{
"name": "Safarov Alisher",
"email": "[email protected]",
"homepage": "https://github.com/S1lentium"
}],
"require": {
"php": ">=8.0",
"php": ">=8.4",
"ext-bcmath": "*"
},
"require-dev": {
"phpunit/phpunit": "~9.0",
"vimeo/psalm": "^4.0"
"laravel/pint": "^1.20.0",
"phpstan/phpstan": "^2.1.2",
"phpstan/extension-installer": "^1.3",
"phpstan/phpstan-phpunit": "^2.0.4",
"rector/rector": "^2.0.7",
"pestphp/pest": "^v3.7",
"pestphp/pest-plugin-type-coverage": "^3.2"
},
"config": {
"allow-plugins": {
"phpstan/extension-installer": true,
"pestphp/pest-plugin": true
}
},
"autoload": {
"psr-4": {
Expand Down
7 changes: 7 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
includes:
- phar://phpstan.phar/conf/bleedingEdge.neon

parameters:
level: 3
paths:
- src
129 changes: 129 additions & 0 deletions pint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
{
"preset": "psr12",
"rules": {
"align_multiline_comment": true,
"array_indentation": true,
"array_push": true,
"array_syntax": {
"syntax": "short"
},
"assign_null_coalescing_to_coalesce_equal": true,
"binary_operator_spaces": true,
"blank_line_before_statement": true,
"cast_spaces": true,
"clean_namespace": true,
"combine_consecutive_issets": true,
"combine_consecutive_unsets": true,
"compact_nullable_typehint": true,
"concat_space": {
"spacing": "one"
},
"fully_qualified_strict_types": true,
"function_to_constant": true,
"get_class_to_class_keyword": true,
"is_null": true,
"lambda_not_used_import": true,
"logical_operators": true,
"method_chaining_indentation": true,
"modernize_types_casting": true,
"multiline_whitespace_before_semicolons": true,
"no_empty_comment": true,
"no_empty_phpdoc": true,
"no_empty_statement": true,
"no_extra_blank_lines": {
"tokens": [
"attribute",
"break",
"case",
"continue",
"curly_brace_block",
"default",
"extra",
"parenthesis_brace_block",
"return",
"square_brace_block",
"switch",
"throw",
"use",
"use_trait"
]
},
"no_multiline_whitespace_around_double_arrow": true,
"no_short_bool_cast": true,
"no_singleline_whitespace_before_semicolons": true,
"no_superfluous_elseif": false,
"no_superfluous_phpdoc_tags": true,
"no_trailing_comma_in_singleline": true,
"no_unneeded_control_parentheses": true,
"no_useless_concat_operator": true,
"no_useless_else": true,
"no_useless_nullsafe_operator": true,
"no_useless_return": true,
"no_whitespace_before_comma_in_array": true,
"not_operator_with_successor_space": false,
"nullable_type_declaration": true,
"object_operator_without_whitespace": true,
"ordered_imports": {
"imports_order": [
"class",
"function",
"const"
],
"sort_algorithm": "alpha"
},
"ordered_interfaces": true,
"ordered_types": {
"null_adjustment": "always_last"
},
"phpdoc_align": {
"align": "left"
},
"phpdoc_indent": true,
"phpdoc_no_useless_inheritdoc": true,
"phpdoc_order": true,
"phpdoc_scalar": true,
"phpdoc_single_line_var_spacing": true,
"phpdoc_summary": true,
"phpdoc_tag_casing": true,
"phpdoc_trim": true,
"phpdoc_trim_consecutive_blank_line_separation": true,
"phpdoc_var_without_name": true,
"php_unit_construct": true,
"php_unit_dedicate_assert": true,
"php_unit_dedicate_assert_internal_type": true,
"php_unit_internal_class": true,
"php_unit_method_casing": true,
"return_assignment": true,
"return_type_declaration": true,
"short_scalar_cast": true,
"single_line_comment_spacing": true,
"single_line_comment_style": true,
"single_quote": true,
"single_space_around_construct": true,
"ternary_to_null_coalescing": true,
"trailing_comma_in_multiline": {
"elements": [
"arguments",
"arrays",
"match",
"parameters"
]
},
"trim_array_spaces": true,
"type_declaration_spaces": true,
"types_spaces": {
"space": "single"
},
"use_arrow_functions": false,
"void_return": true,
"whitespace_after_comma_in_array": {
"ensure_single_space": true
},
"yoda_style": {
"equal": false,
"identical": false,
"less_and_greater": false,
"always_move_variable": false
}
}
}
62 changes: 62 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?php

declare(strict_types=1);

use Rector\Config\RectorConfig;

return RectorConfig::configure()
->withAttributesSets(phpunit: true)
->withPhpSets(php84: true)
->withPreparedSets(
deadCode: true,
codeQuality: true,
codingStyle: true,
privatization: true,
naming: true,
rectorPreset: true,
)
->withRules([
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\ReturnTypeFromReturnNewRector::class,
Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByMethodCallTypeRector::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(13);
3 changes: 3 additions & 0 deletions src/Exception/IpException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php

declare(strict_types=1);

namespace IPTools\Exception;

use Exception;
Expand Down
3 changes: 3 additions & 0 deletions src/Exception/IpToolsException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php

declare(strict_types=1);

namespace IPTools\Exception;

interface IpToolsException
Expand Down
3 changes: 3 additions & 0 deletions src/Exception/NetworkException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php

declare(strict_types=1);

namespace IPTools\Exception;

use Exception;
Expand Down
3 changes: 3 additions & 0 deletions src/Exception/RangeException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php

declare(strict_types=1);

namespace IPTools\Exception;

use Exception;
Expand Down
Loading