prismicio-community / php-kit

Community maintained development kit for Prismic and the PHP language
https://prismic.io
Other
108 stars 82 forks source link

CacheInterface methods' documentation don't specify return value #82

Closed tremby closed 9 years ago

tremby commented 9 years ago

I notice that DefaultCache returns the return value of the various APC functions used when running set, delete and clear but that the value to be returned is not documented in the interface. I'm implementing the interface and therefore don't know if I'll be complying by returning nothing -- perhaps some internal Prismic method expects a return value from these methods.

tremby commented 9 years ago

While I'm at it, I notice that the get method defines its return value as a stdClass of "the value of the entry". Should it always be a stdClass? Where are the docs on what to return if it isn't in the cache at all? (I note that CacheTest expects it to return false if nothing is found. This should certainly be documented -- I would have presumed null.)

erwan commented 9 years ago

Hi,

Yes you're right, it should be documented. We'll work on it.

tremby commented 9 years ago

In 179a833 the return value of get is now more clearly specified as null on failure, but the NoCache and DefaultCache don't comply, instead passing false on failure. http://php.net/manual/en/function.apc-fetch.php The associated test also still expects false on failure.

This ticket was also asking for specifications on what if anything the other methods should return.

tremby commented 9 years ago

@erwan, this is still an issue. This shouldn't be closed.

tremby commented 9 years ago

Additionally, the CacheTest hasn't been updated to reflect the new documentation. I'll provide pull requests.