Skip to editor
Psalm
Docs
Playground
Plugins
Blog
Paid support
Share
Fix issues
Show original
PHP
Settings
<?php declare(strict_types = 1); final readonly class MyInt { /** * @param int | numeric-string $value * @psalm-mutation-free */ public function __construct(private int | string $value) {} /** * @return int | numeric-string */ public function toInteger(): int | string { return $this->value; } } /** @psalm-mutation-free */ function addOne(MyInt $myInt): int { /** @psalm-suppress InvalidOperand */ return $myInt->toInteger() + 1; } /** @psalm-mutation-free */ function addTwo(MyInt $myInt): int { $value = $myInt->toInteger(); if (strspn((string) $value, '0123456789') === strlen((string) $value)) { /** @psalm-suppress InvalidOperand */ return $value + 2; } return 0; } /** @psalm-mutation-free */ function addThree(MyInt $myInt): int { $value = $myInt->toInteger(); /** @psalm-suppress RedundantConditionGivenDocblockType */ if (ctype_digit((string) $value)) { /** @psalm-suppress InvalidOperand */ return $value + 3; } return 0; }
Issues
Types
idle
Saved May 25 2026 23:00 UTC
⌘/Ctrl+Enter
run
⌘/Ctrl+S
share
F8
/
⇧F8
next/prev issue