Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry BLIND2017-12-02 10:41:12 -0500
committerThierry BLIND2017-12-02 10:41:12 -0500
commit70fa6f6c6f2c8a63027a104619ebac66269a65c3 (patch)
treec1f0e7bfcbb076c2517d6f4db2042a0bbf83bcb8
parent22c86fe05e29e5f77fb128e8392d5a53c3918f47 (diff)
downloadorg.eclipse.pdt-70fa6f6c6f2c8a63027a104619ebac66269a65c3.tar.gz
org.eclipse.pdt-70fa6f6c6f2c8a63027a104619ebac66269a65c3.tar.xz
org.eclipse.pdt-70fa6f6c6f2c8a63027a104619ebac66269a65c3.zip
Bug 515150 - PHP documentation and source completion for mysqli_resultR5_2_0
check if parameter names (wrongly) have a dollar sign and correct old memcached doc Signed-off-by: Thierry BLIND <thierryblind@msn.com>
-rw-r--r--plugins/org.eclipse.php.core/Resources/language/generate.php11
-rw-r--r--plugins/org.eclipse.php.core/Resources/language/php71/memcached.php4
2 files changed, 10 insertions, 5 deletions
diff --git a/plugins/org.eclipse.php.core/Resources/language/generate.php b/plugins/org.eclipse.php.core/Resources/language/generate.php
index 561c26108..98df5e298 100644
--- a/plugins/org.eclipse.php.core/Resources/language/generate.php
+++ b/plugins/org.eclipse.php.core/Resources/language/generate.php
@@ -127,17 +127,22 @@ function make_funckey_from_str ($name) {
}
/**
- * Replaces all invalid characters with '_' in PHP identifier
+ * Replaces all invalid characters with '_' in PHP identifier.
+ * Can also remove dollar signs when asked to do so.
* @param $name string PHP identifier
* @param $isInPhpdoc boolean true when it's a phpdoc identifier, false otherwise
+ * @param $removeDollars boolean true when dollar signs should be removed, false otherwise
* @return string PHP identifier with stripped invalid characters
*/
-function clean_php_identifier ($name, $isInPhpdoc = false) {
+function clean_php_identifier ($name, $isInPhpdoc = false, $removeDollars = false) {
if ($isInPhpdoc) {
$name = preg_replace('/[^\$\w\\_\|\[\]]+/', '_', $name);
} else {
$name = preg_replace('/[^\$\w\\_]+/', '_', $name);
}
+ if ($removeDollars) {
+ $name = str_replace('$', '', $name);
+ }
return $name;
}
@@ -292,7 +297,7 @@ function parse_phpdoc_functions ($phpdocDir) {
for ($i = 0; $i < count($match[0]); ++$i) {
$parameter = array (
'type' => trim($match[2][$i]),
- 'name' => clean_php_identifier(trim($match[4][$i])),
+ 'name' => clean_php_identifier(trim($match[4][$i]), false, true),
);
if (preg_match ('@choice=[\'"]opt[\'"]@', $match[1][$i])) {
$parameter['isoptional'] = true;
diff --git a/plugins/org.eclipse.php.core/Resources/language/php71/memcached.php b/plugins/org.eclipse.php.core/Resources/language/php71/memcached.php
index 6b1b6b5a0..d306d7f9f 100644
--- a/plugins/org.eclipse.php.core/Resources/language/php71/memcached.php
+++ b/plugins/org.eclipse.php.core/Resources/language/php71/memcached.php
@@ -133,12 +133,12 @@ class Memcached {
* @link http://www.php.net/manual/en/memcached.get.php
* @param string $key The key of the item to retrieve.
* @param callable $cache_cb [optional] Read-through caching callback or null.
- * @param int $$flags [optional]
+ * @param int $flags [optional]
* @return mixed the value stored in the cache or false otherwise.
* The Memcached::getResultCode will return
* Memcached::RES_NOTFOUND if the key does not exist.
*/
- public function get (string $key, callable $cache_cb = null, int $$flags = null) {}
+ public function get (string $key, callable $cache_cb = null, int $flags = null) {}
/**
* Retrieve an item from a specific server

Back to the top