| @@ 29-40 (lines=12) @@ | ||
| 26 | * |
|
| 27 | * @return void |
|
| 28 | */ |
|
| 29 | public function testDeprecatedNewReference($line) |
|
| 30 | { |
|
| 31 | $file = $this->sniffFile(self::TEST_FILE, '5.2'); |
|
| 32 | $this->assertNoViolation($file, $line); |
|
| 33 | ||
| 34 | $file = $this->sniffFile(self::TEST_FILE, '5.3'); |
|
| 35 | $this->assertWarning($file, $line, 'Assigning the return value of new by reference is deprecated in PHP 5.3'); |
|
| 36 | ||
| 37 | $file = $this->sniffFile(self::TEST_FILE, '7.0'); |
|
| 38 | $this->assertError($file, $line, 'Assigning the return value of new by reference is deprecated in PHP 5.3 and forbidden in PHP 7.0'); |
|
| 39 | ||
| 40 | } |
|
| 41 | ||
| 42 | /** |
|
| 43 | * Data provider. |
|
| @@ 155-166 (lines=12) @@ | ||
| 152 | * |
|
| 153 | * @return void |
|
| 154 | */ |
|
| 155 | public function testHexNumericString() |
|
| 156 | { |
|
| 157 | $error = 'The behaviour of hexadecimal numeric strings was inconsistent prior to PHP 7 and support has been removed in PHP 7. Found: \'0xaa78b5\''; |
|
| 158 | ||
| 159 | $file = $this->sniffFile(self::TEST_FILE, '5.0'); |
|
| 160 | $this->assertWarning($file, 11, $error); |
|
| 161 | $this->assertNoViolation($file, 12); |
|
| 162 | ||
| 163 | $file = $this->sniffFile(self::TEST_FILE, '7.0'); |
|
| 164 | $this->assertError($file, 11, $error); |
|
| 165 | $this->assertNoViolation($file, 12); |
|
| 166 | } |
|
| 167 | ||
| 168 | } |
|
| 169 | ||
| @@ 33-43 (lines=11) @@ | ||
| 30 | * |
|
| 31 | * @return void |
|
| 32 | */ |
|
| 33 | public function testDeprecatedEModifier($line, $functionName = 'preg_replace') |
|
| 34 | { |
|
| 35 | $file = $this->sniffFile(self::TEST_FILE, '5.4'); |
|
| 36 | $this->assertNoViolation($file, $line); |
|
| 37 | ||
| 38 | $file = $this->sniffFile(self::TEST_FILE, '5.5'); |
|
| 39 | $this->assertError($file, $line, "{$functionName}() - /e modifier is deprecated since PHP 5.5"); |
|
| 40 | ||
| 41 | $file = $this->sniffFile(self::TEST_FILE, '7.0'); |
|
| 42 | $this->assertError($file, $line, "{$functionName}() - /e modifier is forbidden since PHP 7.0"); |
|
| 43 | } |
|
| 44 | ||
| 45 | /** |
|
| 46 | * dataDeprecatedEModifier |
|