Add doc-typehints to class properties found by the PropertyDocumentation
sniff to improve the documentation.
Once the sniff is enabled it avoids that new code is missing type
declarations. This is focused on documentation and does not change code.
Change-Id: Idf17719c875466810313f0fbbf16bc67f3e40059
* Switch out raw Exceptions, mostly for InvalidArgumentExceptions.
* Fake exceptions triggered to give Monolog a backtrace are for
some reason "traditionally" RuntimeExceptions, instead, so we
continue to use that pattern in remaining locations.
* Just entirely give up on PostgresResultWrapper's resource vs. object mess.
* Drop now-unneeded false positive hits.
Change-Id: Id183ab60994cd9c6dc80401d4ce4de0ddf2b3da0
Also make the error thrown by ConditionalHeaderUtil slightly more
obvious where the upstream content ends and the context starts.
Bug: T350852
Change-Id: Ia76c0974487f151c3ca37fba2c666143bd435843
Patch Ifa7a9bc replaced some longer `=== null` constructs with the
new ??= operator we have since PHP 7.4. However, some of these can be
simplified even more with the ?? operator we have since PHP 7.0.
Follow-Up: Ifa7a9bc7b2ec415ad7ecb23f4c1776f51f58fd6b
Change-Id: I7b05e723810558bb5437adc97eab54ca04d38c06
The relevant section in the RFC says the following:
> If the field-value is "*", the condition is false if the origin
> server has a current representation for the target resource.
> An origin server that evaluates an If-None-Match condition MUST NOT
> perform the requested method if the condition evaluates to false;
> instead, the origin server MUST respond with either a) the 304 (Not
> Modified) status code if the request method is GET or HEAD or b) the
> 412 (Precondition Failed) status code for all other request methods.
https://httpwg.org/specs/rfc9110.html
Bug: T319382
Change-Id: Ieb3269d61de42242602ec9c46e19c4f2c3b37f6e
This changes handling of the If-Match header so a weak ETag coming from
the client may match a strong ETag generated by the handler.
This is needed because ETags may get "weakened" on the way to the client
by proxies and middleware, e.g. Varnish applying compression, see
<https://varnish-cache.org/docs/6.0/users-guide/compression.html>.
This behavior is technically a violation of RFC 7232 section 3.1, but it
should actually be safe: A client sending a weak ETag is still ok with
getting a strong match, and a handler that generates a strong ETag knows
that it can rely on strong semantics holding, even if the tag sent by
the client is weak.
Bug: T310710
Bug: T238849
Change-Id: I2a604f2f46719a5f74ddac1b1fa58c8a36910240
* Some functions accept only string, cast ints and floats to string
* After preg_matches or explode() casts numbers to int to do maths
* Cast unix timestamps to int to do maths
* Cast return values from timestamp format function to int
* Cast bitwise operator to bool when needed as bool
* php internal functions like floor/round/ceil documented to return
float, most cases the result is used as int, added casts
Found by phan strict checks
Change-Id: Icb2de32107f43817acc45fe296fb77acf65c1786
All errors currently seen in Travis:
* Function ReflectionType::__toString() is deprecated
* Trying to access array offset on value of type null
* Array and string offset access syntax with curly braces is
deprecated
Bug: T233012
Change-Id: I9619fcae5dd8b633f8c579b924aec311343da880
* Added ConditionalHeaderUtil, a conditional request helper class meant
for composition into Handler. I evaluated the composer package
micheh/psr7-cache for this role but I decided that I prefer DIY
code rather than some rather ugly glue.
* Check conditional request headers prior to entry into
Handler::execute(). Contrary to what was previously documented, use
the results of getLastModified() and getETag() to set headers in the
response. This is convenient and can be overridden in the Handler if
desired by overriding a one-line function.
* Instead of locking up header parsing inside ConditionalHeaderUtil as
was done in micheh/psr7-cache, make a start on a new reusable header
parsing framework, with recursive descent parsers for HTTP-date and
IfNoneMatch.
Change-Id: I260809081cad7701df8620ab03834158670d4230