Completed
Push — php70 ( 83abde...b6aa8a )
by Wim
05:28 queued 02:49
created

ForbiddenParenthesisAroundFunctionParametersSniffTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 63.64 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 14
loc 22
rs 10
wmc 1
lcom 1
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A testSettingTestVersion() 14 14 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
/**
3
 * Parentheses around function parameters throws warning in PHP 7.0  
4
 *
5
 * @package PHPCompatibility
6
 */
7
8
9
/**
10
 * Parentheses around function parameters throws warning in PHP 7.0
11
 *
12
 * @uses BaseSniffTest
13
 * @package PHPCompatibility
14
 * @author Jansen Price <[email protected]>
15
 */
16
class ForbiddenParenthesisAroundFunctionParametersSniffTest extends BaseSniffTest
17
{
18
    /**
19
     * testSettingTestVersion
20
     *
21
     * @return void
22
     */
23 View Code Duplication
    public function testSettingTestVersion()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
24
    {
25
        $file = $this->sniffFile('sniff-examples/forbidden_parenthesis_around_function_parameters.php', '5.6');
26
        $this->assertNoViolation($file, 3);
27
        $this->assertNoViolation($file, 5);
28
        $this->assertNoViolation($file, 7);
29
        $this->assertNoViolation($file, 9);
30
        
31
        $file = $this->sniffFile('sniff-examples/forbidden_parenthesis_around_function_parameters.php', '7.0');
32
        $this->assertWarning($file, 3, 'Parentheses around function parameters throws warning in PHP 7.0');
33
        $this->assertWarning($file, 5, 'Parentheses around function parameters throws warning in PHP 7.0');
34
        $this->assertWarning($file, 7, 'Parentheses around function parameters throws warning in PHP 7.0');
35
        $this->assertNoViolation($file, 9);
36
    }
37
}
38
39