Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2889110
ArcanistCommentStyleXHPASTLinterRule.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
989 B
Referenced Files
None
Subscribers
None
ArcanistCommentStyleXHPASTLinterRule.php
View Options
<?php
final
class
ArcanistCommentStyleXHPASTLinterRule
extends
ArcanistXHPASTLinterRule
{
const
ID
=
18
;
public
function
getLintName
(
)
{
return
pht
(
'Comment Style'
)
;
}
public
function
process
(
XHPASTNode
$root
)
{
foreach
(
$root
->
selectTokensOfType
(
'T_COMMENT'
)
as
$comment
)
{
$value
=
$comment
->
getValue
(
)
;
if
(
$value
[
0
]
!==
'#'
)
{
continue
;
}
// Don't warn about PHP comment directives. In particular, we need
// to use "#[\ReturnTypeWillChange]" to implement "Iterator" in a way
// that is compatible with PHP 8.1 and older versions of PHP prior
// to the introduction of return types. See T13588.
if
(
preg_match
(
'/^#\\[\\\\/'
,
$value
)
)
{
continue
;
}
$this
->
raiseLintAtOffset
(
$comment
->
getOffset
(
)
,
pht
(
'Use `%s` single-line comments, not `%s`.'
,
'//'
,
'#'
)
,
'#'
,
preg_match
(
'/^#\S/'
,
$value
)
?
'// '
:
'//'
)
;
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Jan 19 2025, 11:28 (5 w, 13 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1114397
Default Alt Text
ArcanistCommentStyleXHPASTLinterRule.php (989 B)
Attached To
Mode
rARC Arcanist
Attached
Detach File
Event Timeline
Log In to Comment