By default, PHPSTan considers assumes that all methods that return a
value are pure, meaning they have no side effects.
While we could configure PHPStan so it is consistent with Psalm, we do
not know how downstream projects are configured and should assume they
rely on the default behavior.
By default, PHPSTan considers assumes that all methods that return a value are pure, meaning they have no side effects.
While we could configure PHPStan so it is consistent with Psalm, we do not know how downstream projects are configured and should assume they rely on the default behavior.
See https://phpstan.org/blog/remembering-and-forgetting-returned-values
Both
moveNext()
andglimpse()
have side effects in that they modify properties, and are therefore marked as impure.