Skip to content

[0.12.83] remembering and forgetting returned values feature doesn't take side effects into account #4797

@jacekkarczmarczyk

Description

@jacekkarczmarczyk

Bug report

This can be quite tricky. Some functions may have side effects so that remembering return value doesn't make sense if next actions mutates the state

Code snippet that reproduces the problem

if (file_exists('foo')) {
	unlink('foo');
	if (file_exists('foo')) {
		echo "File still exists although it was deleted";
	}
}

https://phpstan.org/r/61c5bd5b-dc64-4562-aa3c-49cf7de51992

Expected output

No error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions