preg_match('/f/', 'f', $matches);
Will result in $matches being reported as an undefined variable, even though it is technically defined by preg_match() in the function call. Though I'm not happy about it, it is standard. Our options are currently:
- Make specific exceptions for specific argument placements on specific functions, essentially hard-coding these types of functions, which definitely won't scale well but will have the benefit of actually working
- Wait for integration with typing information via a more thorough analysis that goes through more files, including the phpstorm stubs, and have an exception where parameters that are passed by reference are defined by the function instead
I like the second one more.