Skip to editor
Psalm
Docs
Playground
Plugins
Blog
Paid support
Share
Fix issues
Show original
PHP
Settings
<?php class Foo { /** * @psalm-readonly-allow-private-mutation */ public int $a = 1; /** * @psalm-readonly-allow-private-mutation */ public string $b; /** * @psalm-readonly-allow-private-mutation */ public array $c = ["foo"]; /** * @psalm-readonly-allow-private-mutation */ public object $d; public function __construct() { $this->b = "foo"; } } $foo = new Foo(); $foo->a = 2; // EXCEPTION: property a has already been initialized $foo->b = "bar"; // EXCEPTION: property b has already been initialized $foo->c[] = "bar"; // EXCEPTION: arrays can't be modified $foo->d = new Foo(); // SUCCESS: property d hasn't been initialized before $foo->d->foo = "foo";
Issues
Types
idle
Saved Feb 20 2020 00:10 UTC
⌘/Ctrl+Enter
run
⌘/Ctrl+S
share
F8
/
⇧F8
next/prev issue