https://psalm.dev/r/25bc0f9e95
```php
getContext() ? mapContext($container->getContext()) : null;
```
```
Psalm output (using commit f874740):
No issues!
```
https://psalm.dev/r/08f7a4ae06
```php
https://psalm.dev/r/0984111f90
```php
https://psalm.dev/r/c11020ef40
```php
getContext() ? mapContext($container->getContext()) : null;
}
}
/**
* @psalm-immutable
*/
final class NotWorking
{
// the only difference is this property
public null|array $ctx;
// the error would not occure if I use default value for property
// public null|array $ctx = [];
public function __construct(Container $container)
{
$this->ctx = $container->getContext() ? mapContext($container->getContext()) : null;
}
}
```
```
Psalm output (using commit f874740):
ERROR: PossiblyNullArgument - 47:60 - Argument 1 of mapContext cannot be null, possibly null value provided
```
Simple idea
Works as expected https://psalm.dev/r/25bc0f9e95
Simple example that works not correctly (on my opinion) when I use functions without objects and methods https://psalm.dev/r/08f7a4ae06
Does not work even inside class context https://psalm.dev/r/0984111f90
And finally, icing on the cake. Some strange things happen here https://psalm.dev/r/c11020ef40