Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F22419784
ArcanistUnnecessaryFinalModifierXHPASTLinterRule.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
ArcanistUnnecessaryFinalModifierXHPASTLinterRule.php
View Options
<?php
final
class
ArcanistUnnecessaryFinalModifierXHPASTLinterRule
extends
ArcanistXHPASTLinterRule
{
const
ID
=
55
;
public
function
getLintName
()
{
return
pht
(
'Unnecessary Final Modifier'
);
}
public
function
getLintSeverity
()
{
return
ArcanistLintSeverity
::
SEVERITY_ADVICE
;
}
public
function
process
(
XHPASTNode
$root
)
{
$classes
=
$root
->
selectDescendantsOfType
(
'n_CLASS_DECLARATION'
);
foreach
(
$classes
as
$class
)
{
$attributes
=
$class
->
getChildOfType
(
0
,
'n_CLASS_ATTRIBUTES'
);
$is_final
=
false
;
foreach
(
$attributes
->
getChildren
()
as
$attribute
)
{
if
(
$attribute
->
getConcreteString
()
==
'final'
)
{
$is_final
=
true
;
break
;
}
}
if
(!
$is_final
)
{
continue
;
}
$methods
=
$class
->
selectDescendantsOfType
(
'n_METHOD_DECLARATION'
);
foreach
(
$methods
as
$method
)
{
$attributes
=
$method
->
getChildOfType
(
0
,
'n_METHOD_MODIFIER_LIST'
);
foreach
(
$attributes
->
getChildren
()
as
$attribute
)
{
if
(
$attribute
->
getConcreteString
()
==
'final'
)
{
$this
->
raiseLintAtNode
(
$attribute
,
pht
(
'Unnecessary `%s` modifier in `%s` class.'
,
'final'
,
'final'
));
}
}
}
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Nov 28, 02:23 (1 d, 16 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1212693
Default Alt Text
ArcanistUnnecessaryFinalModifierXHPASTLinterRule.php (1 KB)
Attached To
Mode
R118 Arcanist - fork
Attached
Detach File
Event Timeline