Skip to content

Commit

Permalink
Updated psalm configuration.
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentmuller committed Oct 3, 2023
1 parent 4597ea2 commit 75e421a
Show file tree
Hide file tree
Showing 12 changed files with 13 additions and 47 deletions.
22 changes: 4 additions & 18 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,6 @@
</errorLevel>
</PropertyNotSetInConstructor>

<MissingPropertyType>
<errorLevel type="suppress">
<referencedProperty name="App\Faker\CustomCompany::$formats"/>
</errorLevel>
</MissingPropertyType>

<InternalMethod>
<errorLevel type="suppress">
<file name="src/Service/DatabaseInfoService.php"/>
Expand All @@ -57,14 +51,6 @@
</errorLevel>
</UndefinedFunction>

<InvalidClassConstantType>
<errorLevel type="suppress">
<referencedConstant name="App\Validator\Captcha::ERROR_NAMES"/>
<referencedConstant name="App\Validator\Password::ERROR_NAMES"/>
<referencedConstant name="App\Validator\Strength::ERROR_NAMES"/>
</errorLevel>
</InvalidClassConstantType>

<UnsupportedPropertyReferenceUsage>
<errorLevel type="suppress">
<file name="src/Form/Extension/AbstractFileTypeExtension.php"/>
Expand Down Expand Up @@ -100,12 +86,12 @@
</errorLevel>
</MixedReturnStatement>

<InvalidArgument>
<MixedArgumentTypeCoercion>
<errorLevel type="suppress">
<file name="src/Twig/HighlightExtension.php" />
<referencedFunction name="exportPhp"/>
<file name="src/Model/TaskComputeQuery.php" />
<referencedFunction name="updateItems" />
</errorLevel>
</InvalidArgument>
</MixedArgumentTypeCoercion>
</issueHandlers>

<plugins>
Expand Down
2 changes: 0 additions & 2 deletions src/Chart/AbstractHighchart.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@

/**
* Extends the Highchart with method shortcuts.
*
* @psalm-suppress PropertyNotSetInConstructor
*/
class AbstractHighchart extends Highchart implements ServiceSubscriberInterface
{
Expand Down
2 changes: 0 additions & 2 deletions src/Chart/MonthChart.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
/**
* Chart to display calculations by month.
*
* @psalm-suppress PropertyNotSetInConstructor
*
* @psalm-import-type CalculationByMonthType from CalculationRepository
*/
class MonthChart extends AbstractHighchart
Expand Down
2 changes: 0 additions & 2 deletions src/Chart/StateChart.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
* Chart to display calculations by state.
*
* @psalm-import-type QueryCalculationType from CalculationStateRepository
*
* @psalm-suppress PropertyNotSetInConstructor
*/
class StateChart extends AbstractHighchart
{
Expand Down
5 changes: 5 additions & 0 deletions src/Faker/CustomCompany.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
*/
class CustomCompany extends \Faker\Provider\fr_CH\Company
{
/**
* @psalm-var mixed
*
* @phpstan-var string[]
*/
protected static $formats = [
'{{lastName}} {{companySuffix}}',
'{{lastName}} {{firstName}} {{companySuffix}}',
Expand Down
5 changes: 1 addition & 4 deletions src/Model/TaskComputeQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,8 @@ public function setQuantity(float $quantity): self
return $this;
}

/**
* @psalm-suppress MixedArgumentTypeCoercion
*/
private function updateItems(): void
{
$this->items = $this->task->getItems()->map(static fn (TaskItem $item) => (int) $item->getId())->toArray();
$this->items = $this->task->getItems()->map(static fn (TaskItem $item): int => (int) $item->getId())->toArray();
}
}
4 changes: 2 additions & 2 deletions src/Twig/HighlightExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
class HighlightExtension extends AbstractExtension
{
/**
* @const array<non-empty-string, non-empty-string>
* @const array<non-empty-string, string>
*/
private const PHP_PATTERNS = [
'/title="(.*?)"/i' => '',
Expand Down Expand Up @@ -84,7 +84,7 @@ private function exportPhp(Environment $env, mixed $variable, string $id = ''):
if (!\is_string($content)) {
return null;
}
$content = StringUtils::pregReplace(self::PHP_PATTERNS, $content); // @phpstan-ignore-line
$content = StringUtils::pregReplace(self::PHP_PATTERNS, $content);
if ('' !== $id) {
$content = (string) \preg_replace('/highlight-php-\d+/', $id, $content);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Utils/StringUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ public static function isString(?string $str): bool
*
* @phpstan-return ($subject is string ? string : string[])
*
* @psalm-param array<non-empty-string, non-empty-string> $values
* @psalm-param array<non-empty-string, string> $values
*/
public static function pregReplace(array $values, string|array $subject): string|array
{
Expand Down
4 changes: 0 additions & 4 deletions src/Validator/Captcha.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@

/**
* Captcha contraint.
*
* @Annotation
*
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
*/
#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
class Captcha extends Constraint
Expand Down
4 changes: 0 additions & 4 deletions src/Validator/Password.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@

/**
* Password constraint.
*
* @Annotation
*
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
*/
#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
class Password extends Constraint
Expand Down
4 changes: 0 additions & 4 deletions src/Validator/Recaptcha.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@

/**
* Google reCaptcha contraint.
*
* @Annotation
*
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
*/
#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
class Recaptcha extends Constraint
Expand Down
4 changes: 0 additions & 4 deletions src/Validator/Strength.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@

/**
* Strength constraint.
*
* @Annotation
*
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
*/
#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
class Strength extends Constraint
Expand Down

0 comments on commit 75e421a

Please sign in to comment.