Skip to content

Commit

Permalink
Fix #523 Incorrect PHP reflection type for Memcached::cas $cas_token
Browse files Browse the repository at this point in the history
  • Loading branch information
remicollet committed Nov 14, 2022
1 parent aa4868d commit d91c958
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
10 changes: 8 additions & 2 deletions php_memcached.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,14 @@ public function touchByKey(string $server_key, string $key, int $expiration=0):
public function setMulti(array $items, int $expiration=0): bool {}
public function setMultiByKey(string $server_key, array $items, int $expiration=0): bool {}

public function cas(string $cas_token, string $key, mixed $value, int $expiration=0): bool {}
public function casByKey(string $cas_token, string $server_key, string $key, mixed $value, int $expiration=0): bool {}
/**
* @param string|int|float $cas_token
*/
public function cas($cas_token, string $key, mixed $value, int $expiration=0): bool {}

This comment has been minimized.

Copy link
@sodabrew

sodabrew Nov 14, 2022

Contributor

Why not mixed $cas_token ?

This comment has been minimized.

Copy link
@remicollet

remicollet Nov 15, 2022

Author Collaborator

This comment has been minimized.

Copy link
@remicollet

remicollet Nov 15, 2022

Author Collaborator

At some point, we should probably do a better check with TypeError / ValueError exception, but this doesn't seem OK for a quick bugfix release.

/**
* @param string|int|float $cas_token
*/
public function casByKey($cas_token, string $server_key, string $key, mixed $value, int $expiration=0): bool {}
public function add(string $key, mixed $value, int $expiration=0): bool {}
public function addByKey(string $server_key, string $key, mixed $value, int $expiration=0): bool {}
public function append(string $key, string $value): ?bool {}
Expand Down
6 changes: 3 additions & 3 deletions php_memcached_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 8cb8a18e8e09c6bfc62a51fc31d60171038500ef */
* Stub hash: 95bbd37829c87980e3a770df1e2a805e93025fbd */

ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Memcached___construct, 0, 0, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, persistent_id, IS_STRING, 1, "null")
Expand Down Expand Up @@ -91,14 +91,14 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Memcached_setMultiByKey, 0
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Memcached_cas, 0, 3, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, cas_token, IS_STRING, 0)
ZEND_ARG_INFO(0, cas_token)
ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, value, IS_MIXED, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, expiration, IS_LONG, 0, "0")
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Memcached_casByKey, 0, 4, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, cas_token, IS_STRING, 0)
ZEND_ARG_INFO(0, cas_token)
ZEND_ARG_TYPE_INFO(0, server_key, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, value, IS_MIXED, 0)
Expand Down
2 changes: 1 addition & 1 deletion php_memcached_legacy_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 8cb8a18e8e09c6bfc62a51fc31d60171038500ef */
* Stub hash: 95bbd37829c87980e3a770df1e2a805e93025fbd */

ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Memcached___construct, 0, 0, 0)
ZEND_ARG_INFO(0, persistent_id)
Expand Down

0 comments on commit d91c958

Please sign in to comment.