includes/utils/ClassCollector.php
Function tryEndExpect
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
Open
protected function tryEndExpect( $token ) {
// @phan-suppress-next-line PhanTypeArraySuspiciousNullable
switch ( $this->startToken[0] ) {
case T_DOUBLE_COLON:
// Skip over T_CLASS after T_DOUBLE_COLON because this is something like
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method tryEndExpect
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function tryEndExpect( $token ) {
// @phan-suppress-next-line PhanTypeArraySuspiciousNullable
switch ( $this->startToken[0] ) {
case T_DOUBLE_COLON:
// Skip over T_CLASS after T_DOUBLE_COLON because this is something like
Method getClasses
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getClasses( $code ) {
$this->namespace = '';
$this->classes = [];
$this->startToken = null;
$this->alias = null;
Function getClasses
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
public function getClasses( $code ) {
$this->namespace = '';
$this->classes = [];
$this->startToken = null;
$this->alias = null;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Consider simplifying this complex logical expression. Open
Open
if ( $token === '(' ) {
// Start of a function call to class_alias()
$this->alias = [ 'target' => false, 'name' => false ];
} elseif ( $token === ',' ) {
// Record that we're past the first parameter