You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Reader: Move $handle to subclasses as its an implementation
that the abstract class has no use for (also, Reader\PHP doesn't
need it). Also stop unset'ing it and assign null instead, to address
Phan warnings.
* Reader: Remove constructor from the shared interface. After
construction, the reader can be passed around without typing to
a specific implementation, but the constructor itself cannot
be substituted since the caller can't decide which class is right,
plus readers like Reader\PHP take an array as parameter instead
of a filename. This solves a Phan warning about incompatible
constructors in the implementation of `abstract public __construct`.
* Cli: Rename internal $argv parameter to $args because it seems
our Phan SecurityCheckPlugin is treating this special and is
refusing to untaint it, thus yielding security warnings in a way
we can't correct.
* Writer: Similarly move $handle to subclasses. Unlike Reader,
the abstract Writer did actually reference $handle, namely
in the destructor method to automatically call close(), but only
if it wasn't called already, based on $handle being null.
Rewrite this by having the destructor always call close(), and
making close() safe to call repeatedly. Previously if close()
was called twice, the second one would fail due to only 1 of the
statements being conditional on $handle, the rest would fail.
The close methods are not entirely conditional on $handle.
This change is covered by tests, simplifying only the destructor
without changing close() leads to failing tests (as expected).
Change-Id: I93ed8dd17daaadfc62173938abd7686d7753715a
0 commit comments