From 6335a8084b8cb8b4805ee1634e4d013d739a740b Mon Sep 17 00:00:00 2001 From: Ondrej Mirtes Date: Tue, 27 Sep 2022 13:46:39 +0200 Subject: [PATCH] Update CS --- build-cs/composer.json | 2 +- build-cs/composer.lock | 75 +++++++++++---------- phpcs.xml | 9 +-- src/Type/Constant/ConstantBooleanType.php | 6 ++ src/Type/Constant/ConstantFloatType.php | 6 ++ src/Type/Constant/ConstantIntegerType.php | 6 ++ src/Type/IntegerRangeType.php | 2 +- src/Type/Traits/ConstantScalarTypeTrait.php | 6 -- 8 files changed, 59 insertions(+), 53 deletions(-) diff --git a/build-cs/composer.json b/build-cs/composer.json index cd99706507..60184b6b66 100644 --- a/build-cs/composer.json +++ b/build-cs/composer.json @@ -2,7 +2,7 @@ "require-dev": { "consistence-community/coding-standard": "^3.11.0", "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", - "slevomat/coding-standard": "^7.2.0", + "slevomat/coding-standard": "^8.0.0", "squizlabs/php_codesniffer": "^3.5.3" }, "config": { diff --git a/build-cs/composer.lock b/build-cs/composer.lock index 2db057fffe..076d95da3b 100644 --- a/build-cs/composer.lock +++ b/build-cs/composer.lock @@ -4,35 +4,35 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "e7fd93609f5cdb879d31db375d48e16c", + "content-hash": "a6c963dcf5d33dad94841883f3b6cbe3", "packages": [], "packages-dev": [ { "name": "consistence-community/coding-standard", - "version": "3.11.1", + "version": "3.11.2", "source": { "type": "git", "url": "https://github.com/consistence-community/coding-standard.git", - "reference": "4632fead8c9ee8f50044fcbce9f66c797b34c0df" + "reference": "adb4be482e76990552bf624309d2acc8754ba1bd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/consistence-community/coding-standard/zipball/4632fead8c9ee8f50044fcbce9f66c797b34c0df", - "reference": "4632fead8c9ee8f50044fcbce9f66c797b34c0df", + "url": "https://api.github.com/repos/consistence-community/coding-standard/zipball/adb4be482e76990552bf624309d2acc8754ba1bd", + "reference": "adb4be482e76990552bf624309d2acc8754ba1bd", "shasum": "" }, "require": { - "php": ">=7.4", - "slevomat/coding-standard": "~7.0", - "squizlabs/php_codesniffer": "~3.6.0" + "php": "~8.0", + "slevomat/coding-standard": "~8.0", + "squizlabs/php_codesniffer": "~3.7.0" }, "replace": { "consistence/coding-standard": "3.10.*" }, "require-dev": { - "phing/phing": "2.16.4", - "php-parallel-lint/php-parallel-lint": "1.3.0", - "phpunit/phpunit": "9.5.4" + "phing/phing": "2.17.0", + "php-parallel-lint/php-parallel-lint": "1.3.1", + "phpunit/phpunit": "9.5.10" }, "type": "library", "autoload": { @@ -70,9 +70,9 @@ ], "support": { "issues": "https://github.com/consistence-community/coding-standard/issues", - "source": "https://github.com/consistence-community/coding-standard/tree/3.11.1" + "source": "https://github.com/consistence-community/coding-standard/tree/3.11.2" }, - "time": "2021-05-03T18:13:22+00:00" + "time": "2022-06-21T08:36:36+00:00" }, { "name": "dealerdirect/phpcodesniffer-composer-installer", @@ -151,16 +151,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.5.1", + "version": "1.8.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "981cc368a216c988e862a75e526b6076987d1b50" + "reference": "8dd908dd6156e974b9a0f8bb4cd5ad0707830f04" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/981cc368a216c988e862a75e526b6076987d1b50", - "reference": "981cc368a216c988e862a75e526b6076987d1b50", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/8dd908dd6156e974b9a0f8bb4cd5ad0707830f04", + "reference": "8dd908dd6156e974b9a0f8bb4cd5ad0707830f04", "shasum": "" }, "require": { @@ -170,6 +170,7 @@ "php-parallel-lint/php-parallel-lint": "^1.2", "phpstan/extension-installer": "^1.0", "phpstan/phpstan": "^1.5", + "phpstan/phpstan-phpunit": "^1.1", "phpstan/phpstan-strict-rules": "^1.0", "phpunit/phpunit": "^9.5", "symfony/process": "^5.2" @@ -189,43 +190,43 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.5.1" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.8.0" }, - "time": "2022-05-05T11:32:40+00:00" + "time": "2022-09-04T18:59:06+00:00" }, { "name": "slevomat/coding-standard", - "version": "7.2.1", + "version": "8.5.1", "source": { "type": "git", "url": "https://github.com/slevomat/coding-standard.git", - "reference": "aff06ae7a84e4534bf6f821dc982a93a5d477c90" + "reference": "971f489404350bf4608b7e59381e603c47700366" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/aff06ae7a84e4534bf6f821dc982a93a5d477c90", - "reference": "aff06ae7a84e4534bf6f821dc982a93a5d477c90", + "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/971f489404350bf4608b7e59381e603c47700366", + "reference": "971f489404350bf4608b7e59381e603c47700366", "shasum": "" }, "require": { "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7", "php": "^7.2 || ^8.0", - "phpstan/phpdoc-parser": "^1.5.1", - "squizlabs/php_codesniffer": "^3.6.2" + "phpstan/phpdoc-parser": ">=1.7.0 <1.9.0", + "squizlabs/php_codesniffer": "^3.7.1" }, "require-dev": { - "phing/phing": "2.17.3", + "phing/phing": "2.17.4", "php-parallel-lint/php-parallel-lint": "1.3.2", - "phpstan/phpstan": "1.4.10|1.7.1", + "phpstan/phpstan": "1.4.10|1.8.5", "phpstan/phpstan-deprecation-rules": "1.0.0", "phpstan/phpstan-phpunit": "1.0.0|1.1.1", - "phpstan/phpstan-strict-rules": "1.2.3", - "phpunit/phpunit": "7.5.20|8.5.21|9.5.20" + "phpstan/phpstan-strict-rules": "1.4.3", + "phpunit/phpunit": "7.5.20|8.5.21|9.5.24" }, "type": "phpcodesniffer-standard", "extra": { "branch-alias": { - "dev-master": "7.x-dev" + "dev-master": "8.x-dev" } }, "autoload": { @@ -240,7 +241,7 @@ "description": "Slevomat Coding Standard for PHP_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.", "support": { "issues": "https://github.com/slevomat/coding-standard/issues", - "source": "https://github.com/slevomat/coding-standard/tree/7.2.1" + "source": "https://github.com/slevomat/coding-standard/tree/8.5.1" }, "funding": [ { @@ -252,20 +253,20 @@ "type": "tidelift" } ], - "time": "2022-05-25T10:58:12+00:00" + "time": "2022-09-23T05:34:53+00:00" }, { "name": "squizlabs/php_codesniffer", - "version": "3.6.2", + "version": "3.7.1", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "5e4e71592f69da17871dba6e80dd51bce74a351a" + "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/5e4e71592f69da17871dba6e80dd51bce74a351a", - "reference": "5e4e71592f69da17871dba6e80dd51bce74a351a", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/1359e176e9307e906dc3d890bcc9603ff6d90619", + "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619", "shasum": "" }, "require": { @@ -308,7 +309,7 @@ "source": "https://github.com/squizlabs/PHP_CodeSniffer", "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" }, - "time": "2021-12-12T21:44:58+00:00" + "time": "2022-06-18T07:21:10+00:00" } ], "aliases": [], diff --git a/phpcs.xml b/phpcs.xml index c3ef5f04c0..8424334283 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -1,6 +1,6 @@ - + @@ -40,9 +40,6 @@ - - - 10 @@ -50,7 +47,6 @@ - @@ -60,9 +56,6 @@ - - - 10 diff --git a/src/Type/Constant/ConstantBooleanType.php b/src/Type/Constant/ConstantBooleanType.php index 0317f30667..972e2f9b2e 100644 --- a/src/Type/Constant/ConstantBooleanType.php +++ b/src/Type/Constant/ConstantBooleanType.php @@ -4,6 +4,7 @@ use PHPStan\Type\BooleanType; use PHPStan\Type\ConstantScalarType; +use PHPStan\Type\GeneralizePrecision; use PHPStan\Type\MixedType; use PHPStan\Type\NeverType; use PHPStan\Type\StaticTypeFactory; @@ -90,6 +91,11 @@ public function toFloat(): Type return new ConstantFloatType((float) $this->value); } + public function generalize(GeneralizePrecision $precision): Type + { + return new BooleanType(); + } + /** * @param mixed[] $properties */ diff --git a/src/Type/Constant/ConstantFloatType.php b/src/Type/Constant/ConstantFloatType.php index a4630286f1..1d586d04bf 100644 --- a/src/Type/Constant/ConstantFloatType.php +++ b/src/Type/Constant/ConstantFloatType.php @@ -6,6 +6,7 @@ use PHPStan\Type\CompoundType; use PHPStan\Type\ConstantScalarType; use PHPStan\Type\FloatType; +use PHPStan\Type\GeneralizePrecision; use PHPStan\Type\Traits\ConstantNumericComparisonTypeTrait; use PHPStan\Type\Traits\ConstantScalarTypeTrait; use PHPStan\Type\Type; @@ -82,6 +83,11 @@ public function toInteger(): Type return new ConstantIntegerType((int) $this->value); } + public function generalize(GeneralizePrecision $precision): Type + { + return new FloatType(); + } + /** * @param mixed[] $properties */ diff --git a/src/Type/Constant/ConstantIntegerType.php b/src/Type/Constant/ConstantIntegerType.php index 0fde15de8b..5497ce6ebd 100644 --- a/src/Type/Constant/ConstantIntegerType.php +++ b/src/Type/Constant/ConstantIntegerType.php @@ -5,6 +5,7 @@ use PHPStan\TrinaryLogic; use PHPStan\Type\CompoundType; use PHPStan\Type\ConstantScalarType; +use PHPStan\Type\GeneralizePrecision; use PHPStan\Type\IntegerRangeType; use PHPStan\Type\IntegerType; use PHPStan\Type\Traits\ConstantNumericComparisonTypeTrait; @@ -77,6 +78,11 @@ public function toString(): Type return new ConstantStringType((string) $this->value); } + public function generalize(GeneralizePrecision $precision): Type + { + return new IntegerType(); + } + /** * @param mixed[] $properties */ diff --git a/src/Type/IntegerRangeType.php b/src/Type/IntegerRangeType.php index 88f7e68aad..973297b753 100644 --- a/src/Type/IntegerRangeType.php +++ b/src/Type/IntegerRangeType.php @@ -285,7 +285,7 @@ public function equals(Type $type): bool public function generalize(GeneralizePrecision $precision): Type { - return new parent(); + return new IntegerType(); } public function isSmallerThan(Type $otherType): TrinaryLogic diff --git a/src/Type/Traits/ConstantScalarTypeTrait.php b/src/Type/Traits/ConstantScalarTypeTrait.php index 44e8674c39..4669a27219 100644 --- a/src/Type/Traits/ConstantScalarTypeTrait.php +++ b/src/Type/Traits/ConstantScalarTypeTrait.php @@ -5,7 +5,6 @@ use PHPStan\TrinaryLogic; use PHPStan\Type\CompoundType; use PHPStan\Type\ConstantScalarType; -use PHPStan\Type\GeneralizePrecision; use PHPStan\Type\Type; trait ConstantScalarTypeTrait @@ -72,9 +71,4 @@ public function isSmallerThanOrEqual(Type $otherType): TrinaryLogic return TrinaryLogic::createMaybe(); } - public function generalize(GeneralizePrecision $precision): Type - { - return new parent(); - } - }