-
Notifications
You must be signed in to change notification settings - Fork 78
Zend\Code\Scanner\MethodScanner does not account for scalar type declarations #56
Comments
As an aside to this, it would be nice if |
It looks like there's a related issue with classes that have a leading namespace separator. The issue is definitely with |
I've managed to create a patch to resolve the second issue, see #60. The original problem, incorrectly detecting scalar type declarations, is still an issue. |
I had to re-submit the PR as #61. |
This repository has been closed and moved to laminas/laminas-code; a new issue has been opened at laminas/laminas-code#27. |
I believe the issue is with
MethodScanner
and notParameterScanner
, as this is what is actually parsing the PHP tokens - it correctly ignores non-scalar type declarations such asarray
andcallable
. From what I can tell,string
,int
,bool
andfloat
are tokens of typeT_STRING
. As a result, the scanner believes they are classnames. This can result in classnames that simply don't exist.I'm not really sure how this can be worked around inside the scanner. As far as I can tell, no PHP version checks are performed on the code being parsed, which means there's no reliable way of detecting whether or not
string
is an actual classname in PHP <7.0 code, or a scalar type declaration in PHP >=7.0 code.Perhaps there needs to be some way to globally set the PHP version of the code being scanned?
The text was updated successfully, but these errors were encountered: