Completed
Push — php70 ( 2dfe02...4ff9ba )
by Wim
02:51
created

DeprecatedPHP4StyleConstructorsSniffTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A testIsDeprecated() 8 8 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
 * Default timezone sniff test file
4
 *
5
 * @package PHPCompatibility
6
 */
7
8
/**
9
 * Default timezone required sniff test
10
 *
11
 * @uses BaseSniffTest
12
 * @package PHPCompatibility
13
 * @author Koen Eelen <[email protected]>
14
 */
15 View Code Duplication
class DeprecatedPHP4StyleConstructorsSniffTest extends BaseSniffTest
0 ignored issues
show
Duplication introduced by
This class 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...
16
{
17
    /**
18
     * Test PHP4 style constructors
19
     *
20
     * @return void
21
     */
22
    public function testIsDeprecated()
23
    {
24
        $file = $this->sniffFile('sniff-examples/deprecated_php4style_constructors.php', '5.6');
25
        $this->assertNoViolation($file, 3);
26
27
        $file = $this->sniffFile('sniff-examples/deprecated_php4style_constructors.php', '7.0');
28
        $this->assertError($file, 3, 'Deprecated PHP4 style constructor are not supported since PHP7');
29
    }
30
}
31