zephir
zephir copied to clipboard
How can i avoid this warning : Variable "xxxx" assigned but not used
Hi,
I wrote this method which works correctly:
public function getWords(array strings) -> array {
var pdo = this->pdo;
var words = array_map(function(a) use (pdo) {
let a = preg_replace("/^(j|m|s|t|l|qu|c|d|n)\'$/i", "$1e", a);
return pdo->quote(trim(mb_strtolower(a)));
}, strings);
return words;
}
But I get this warning when compiling :
Warning: Variable "pdo" assigned but not used in Nlp\Dictionary\Dictionary::getWords in C:\var\www\html\phpext\nlp\nlp\Dictionary\dictionary.zep on line 306 [unused-variable]
var pdo = this->pdo;
---------------------^
How to avoid it?
as you can see, the variable 'pdo' is used in the use language construct ... function(a) use (pdo)
Thanks for your help
Hello,
It's a minor issue we should to deal. Right now you can safely ignore this warning.
Another option is to use -Wunused-variable
flag.
Hi,
Thank you for your reply
Ok, I will ignore this warning. I don't want to use the -Wunused-variable
flag.
Thank you for not closing this issue until it is resolved.