Skip to content

Commit

Permalink
Update CS
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Sep 27, 2022
1 parent 6d56dcd commit 6335a80
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 53 deletions.
2 changes: 1 addition & 1 deletion build-cs/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
75 changes: 38 additions & 37 deletions build-cs/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 1 addition & 8 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<ruleset name="PHPStan">
<config name="php_version" value="70100"/>
<config name="php_version" value="70400"/>
<arg name="colors"/>
<arg name="extensions" value="php"/>
<arg name="encoding" value="utf-8"/>
Expand Down Expand Up @@ -40,17 +40,13 @@
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint">
<exclude name="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingTraversableTypeHintSpecification"/>
<properties>
<property name="enableObjectTypeHint" value="true"/>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint.UselessAnnotation">
<severity>10</severity>
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint">
<exclude name="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingTraversableTypeHintSpecification"/>
<properties>
<property name="enableNativeTypeHint" value="true"/>
<property name="enableUnionTypeHint" value="true"/>
</properties>
</rule>
Expand All @@ -60,9 +56,6 @@
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint">
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification"/>
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingAnyTypeHint"/>
<properties>
<property name="enableObjectTypeHint" value="true"/>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint.UselessAnnotation">
<severity>10</severity>
Expand Down
6 changes: 6 additions & 0 deletions src/Type/Constant/ConstantBooleanType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
*/
Expand Down
6 changes: 6 additions & 0 deletions src/Type/Constant/ConstantFloatType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
*/
Expand Down
6 changes: 6 additions & 0 deletions src/Type/Constant/ConstantIntegerType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Type/IntegerRangeType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 0 additions & 6 deletions src/Type/Traits/ConstantScalarTypeTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -72,9 +71,4 @@ public function isSmallerThanOrEqual(Type $otherType): TrinaryLogic
return TrinaryLogic::createMaybe();
}

public function generalize(GeneralizePrecision $precision): Type
{
return new parent();
}

}

0 comments on commit 6335a80

Please sign in to comment.