@ -179,6 +179,12 @@ function (think \"new\" statements, return types etc.)."
Provide STATIC if the variable was defined as static.
Provide STATIC if the variable was defined as static.
SCOPE should be a scope token ( ` phpinspect-scope-p ' ) . "
SCOPE should be a scope token ( ` phpinspect-scope-p ' ) . "
( let ( readonly )
( when ( and ( phpinspect-word-p ( cadr scope ) )
( equal ( cadr scope ) ` ( :word " readonly " ) ) )
( setq readonly t )
( setcdr scope ( cddr scope ) ) )
( setq scope ( take 5 ( seq-filter #' phpinspect-not-comment-p scope ) ) )
( setq scope ( take 5 ( seq-filter #' phpinspect-not-comment-p scope ) ) )
( let ( variable-name type )
( let ( variable-name type )
( cond
( cond
@ -195,16 +201,18 @@ SCOPE should be a scope token (`phpinspect-scope-p')."
;; docstring.
;; docstring.
type ( phpinspect--variable-type-string-from-comment
type ( phpinspect--variable-type-string-from-comment
comment-before variable-name ) ) )
comment-before variable-name ) ) )
( t ( error ( format " Failed to determine variable from scope %s " scope ) ) ) )
( t
( setq variable-name ( cadr ( seq-find #' phpinspect-variable-p scope ) ) ) ) )
( phpinspect--log " calling resolver from index-variable-from-scope " )
( phpinspect--log " calling resolver from index-variable-from-scope " )
( phpinspect--make-variable
( phpinspect--make-variable
;; Static class variables are always prefixed with dollar signs when
;; Static class variables are always prefixed with dollar signs when
;; referenced.
;; referenced.
:readonly readonly
:name ( if static ( concat " $ " variable-name ) variable-name )
:name ( if static ( concat " $ " variable-name ) variable-name )
:scope ` ( , ( car scope ) )
:scope ` ( , ( car scope ) )
:lifetime ( when static ' ( :static ) )
:lifetime ( when static ' ( :static ) )
:type ( if type ( funcall type-resolver ( phpinspect--make-type :name type ) ) ) ) ) )
:type ( if type ( funcall type-resolver ( phpinspect--make-type :name type ) ) ) ) ) ) )
( defun phpinspect-doc-block-p ( token )
( defun phpinspect-doc-block-p ( token )
( phpinspect-token-type-p token :doc-block ) )
( phpinspect-token-type-p token :doc-block ) )