Completed
Branch feature/scrutinizer-run-tests (072b5a)
by Juliette
10:12
created

NewFunctionArrayDereferencingSniffTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

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
 * New function array dereferencing sniff test file
4
 *
5
 * @package PHPCompatibility
6
 */
7
8
9
/**
10
 * New function array dereferencing sniff tests
11
 *
12
 * @uses BaseSniffTest
13
 * @package PHPCompatibility
14
 * @author Wim Godden <[email protected]>
15
 */
16
class NewFunctionArrayDereferencingSniffTest extends BaseSniffTest
17
{
18
    /**
19
     * testArrayDereferencing
20
     *
21
     * @return void
22
     */
23
    public function testArrayDereferencing()
24
    {
25
        $file = $this->sniffFile('sniff-examples/new_function_array_dereferencing.php', '5.3');
26
        $this->assertError($file, 3, 'Function array dereferencing is not present in PHP version 5.3 or earlier');
27
        
28
        $file = $this->sniffFile('sniff-examples/new_function_array_dereferencing.php', '5.4');
29
        $this->assertNoViolation($file, 3);
30
    }
31
}
32