Skip to content

Commit

Permalink
Fix code quality issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
rvdsteege committed Aug 12, 2024
1 parent 5709d5d commit 175ad84
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 2,372 deletions.
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,12 @@
"overtrue/phplint": "^9.0",
"php-coveralls/php-coveralls": "^2.4",
"phpmd/phpmd": "^2.4",
"phpstan/phpstan": "^1.11",
"pronamic/pronamic-cli": "^1.1",
"pronamic/wp-coding-standards": "^1.3",
"roots/wordpress": "^6.0",
"szepeviktor/phpstan-wordpress": "^1.3",
"vimeo/psalm": "^5.25",
"vlucas/phpdotenv": "^2.0",
"wp-phpunit/wp-phpunit": "^6.1",
"yoast/phpunit-polyfills": "^1.0"
Expand Down
4 changes: 1 addition & 3 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
includes:
- vendor-bin/phpstan/vendor/szepeviktor/phpstan-wordpress/extension.neon
- vendor/szepeviktor/phpstan-wordpress/extension.neon
parameters:
customRulesetUsed: false
level: max
bootstrapFiles:
- tests/phpstan/bootstrap.php
paths:
- src/
2 changes: 1 addition & 1 deletion src/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function parse( $string ) {
$full = sprintf( '-%s', $full );

// Remove minus from end of half.
$half = \substr( (string) $half, 0, -1 );
$half = \substr( $half, 0, -1 );

Check failure on line 94 in src/Parser.php

View workflow job for this annotation

GitHub Actions / phpstan / phpstan

Parameter #1 $string of function substr expects string, string|false given.
}

$string = $full . '.' . $half;
Expand Down
10 changes: 5 additions & 5 deletions src/TaxedMoney.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ class TaxedMoney extends Money {
/**
* Construct and initialize money object.
*
* @param mixed $value Amount value.
* @param Currency|string $currency Currency.
* @param mixed $tax_value Tax value.
* @param mixed $tax_percentage Tax percentage.
* @param mixed $value Amount value.
* @param Currency|string $currency Currency.
* @param float|int|string|null $tax_value Tax value.
* @param mixed $tax_percentage Tax percentage.
*/
public function __construct( $value = 0, $currency = 'EUR', $tax_value = null, $tax_percentage = null ) {
$value = Number::from_mixed( $value );
Expand All @@ -63,7 +63,7 @@ public function __construct( $value = 0, $currency = 'EUR', $tax_value = null, $
*/
$one_percent_value = $value->divide( $percentage );

$tax_value = $one_percent_value->multiply( $tax_percentage );
$tax_value = (string) $one_percent_value->multiply( $tax_percentage );
}

$this->set_tax_value( $tax_value );
Expand Down
11 changes: 0 additions & 11 deletions tests/phpstan/bootstrap.php

This file was deleted.

6 changes: 0 additions & 6 deletions vendor-bin/phpstan/composer.json

This file was deleted.

269 changes: 0 additions & 269 deletions vendor-bin/phpstan/composer.lock

This file was deleted.

5 changes: 0 additions & 5 deletions vendor-bin/psalm/composer.json

This file was deleted.

Loading

0 comments on commit 175ad84

Please sign in to comment.