Showing 20 of 30 total issues
Function getFilesToProcess
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private function getFilesToProcess(array $pathsToWeave): array
{
$filesToWeave = [];
foreach ($pathsToWeave as $pathToWeave) {
- 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 execute
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function execute(InputInterface $input, OutputInterface $output): int
{
$tracefile = $input->getOption('tracefile');
if (!is_string($tracefile)) {
return self::RETURN_CODE_ERROR;
Function parseType
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function parseType(string $type): string
{
if (isset($this->typeMapping[$type])) {
return $this->typeMapping[$type];
}
- 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 setupFileProcesser
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function setupFileProcesser(Signatures $sigs): void
{
$this->scanner = new ScannerMultiplexer();
$parametersScanner = new FunctionParametersScanner();
$functionBodyScanner = new FunctionBodyScanner();
Method generateDoc
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function generateDoc(string $func, string $class = '', array $params = [], string $namespace = ''): ?string
{
if ((!$params && ('__construct' === $func || '__destruct' === $func))
|| !$this->signatures->has($func, $class, $namespace)
) {
Consider simplifying this complex logical expression. Open
if ($token->isA(T_DOC_COMMENT)) {
$this->state = 1;
$this->raiseBuffer();
} elseif (0 === $this->state && ($this->modifiersScanner->isActive() || $token->isA(T_FUNCTION))) {
$this->state = 1;
Function generateDoc
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function generateDoc(string $func, string $class = '', array $params = [], string $namespace = ''): ?string
{
if ((!$params && ('__construct' === $func || '__destruct' === $func))
|| !$this->signatures->has($func, $class, $namespace)
) {
- 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
Function accept
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function accept(Token $token): void
{
if ($token->isA(T_FUNCTION)) {
$this->state = 1;
} elseif (1 === $this->state && '(' === $token->getText()) {
- 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
Function accept
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function accept(Token $token): void
{
if ($token->isA(T_DOC_COMMENT)) {
$this->state = 1;
$this->raiseBuffer();
- 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 __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Signatures $signatures,
ClassScanner $classScanner,
FunctionBodyScanner $functionBodyScanner,
FunctionParametersScanner $parametersScanner,
NamespaceScanner $namespaceScanner
Function scan
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function scan(string $source): TokenStream
{
//todo: track indentation
$stream = new TokenStream();
$depth = 0;
- 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
Avoid too many return
statements within this method. Open
return self::RETURN_CODE_OK;
Avoid too many return
statements within this method. Open
return 'float';
Avoid too many return
statements within this method. Open
return 'string';
Avoid too many return
statements within this method. Open
return 'int';
Function processLine
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function processLine(string $line): void
{
/** @var array<int, string> */
$entry = str_getcsv($line, "\t");
- 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
Function parseTrace
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function parseTrace(string $tracefile): Signatures
{
$sigs = new Signatures();
if (is_file($tracefile)) {
$traceFile = new SplFileObject($tracefile);
- 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
Function accept
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function accept(Token $token): void
{
if ($token->isA(T_INTERFACE) || $token->isA(T_CLASS)) {
$this->state = 1;
- 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
Function accept
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function accept(Token $token): void
{
if ($token->isA(T_FUNCTION)) {
$this->currentClassScope = $token->getDepth();
$this->state = 1;
- 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
Function transformFiles
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function transformFiles(array $filesToWeave, Signatures $sigs): void
{
$this->progressBarStart(count($filesToWeave), '<info>Updating source files …</info>');
foreach ($filesToWeave as $fileToWeave) {
- 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"