Tests/Sniffs/PHP/ForbiddenSwitchWithMultipleDefaultBlocksSniffTest.php 1 location
|
@@ 31-38 (lines=8) @@
|
| 28 |
|
* |
| 29 |
|
* @return void |
| 30 |
|
*/ |
| 31 |
|
public function testForbiddenSwitchWithMultipleDefaultBlocks($line) |
| 32 |
|
{ |
| 33 |
|
$file = $this->sniffFile(self::TEST_FILE, '5.6'); |
| 34 |
|
$this->assertNoViolation($file, $line); |
| 35 |
|
|
| 36 |
|
$file = $this->sniffFile(self::TEST_FILE, '7.0'); |
| 37 |
|
$this->assertError($file, $line, 'Switch statements can not have multiple default blocks since PHP 7.0'); |
| 38 |
|
} |
| 39 |
|
|
| 40 |
|
/** |
| 41 |
|
* Data provider. |
Tests/Sniffs/PHP/NewGroupUseDeclarationsSniffTest.php 1 location
|
@@ 40-47 (lines=8) @@
|
| 37 |
|
* |
| 38 |
|
* @return void |
| 39 |
|
*/ |
| 40 |
|
public function testGroupUseDeclaration($line) |
| 41 |
|
{ |
| 42 |
|
$file = $this->sniffFile(self::TEST_FILE, '5.6'); |
| 43 |
|
$this->assertError($file, $line, 'Group use declarations are not allowed in PHP 5.6 or earlier'); |
| 44 |
|
|
| 45 |
|
$file = $this->sniffFile(self::TEST_FILE, '7.0'); |
| 46 |
|
$this->assertNoViolation($file, $line); |
| 47 |
|
} |
| 48 |
|
|
| 49 |
|
/** |
| 50 |
|
* Data provider. |
Tests/Sniffs/PHP/NewIniDirectivesSniffTest.php 1 location
|
@@ 26-33 (lines=8) @@
|
| 23 |
|
* |
| 24 |
|
* @return void |
| 25 |
|
*/ |
| 26 |
|
public function testFunctionThatShouldntBeFlagged() |
| 27 |
|
{ |
| 28 |
|
$file = $this->sniffFile(self::TEST_FILE, '5.1'); |
| 29 |
|
|
| 30 |
|
$this->assertNoViolation($file, 3); |
| 31 |
|
$this->assertNoViolation($file, 4); |
| 32 |
|
$this->assertNoViolation($file, 5); |
| 33 |
|
} |
| 34 |
|
|
| 35 |
|
|
| 36 |
|
/** |
Tests/Sniffs/PHP/NewScalarTypeDeclarationsSniffTest.php 1 location
|
@@ 30-38 (lines=9) @@
|
| 27 |
|
* |
| 28 |
|
* @return void |
| 29 |
|
*/ |
| 30 |
|
public function testScalarTypeDeclaration($type, $line) |
| 31 |
|
{ |
| 32 |
|
$file = $this->sniffFile(self::TEST_FILE, '5.6'); |
| 33 |
|
$this->assertError($file, $line, $type . ' type is not present in PHP version 5.6 or earlier'); |
| 34 |
|
|
| 35 |
|
$file = $this->sniffFile(self::TEST_FILE, '7.0'); |
| 36 |
|
$this->assertNoViolation($file, $line); |
| 37 |
|
|
| 38 |
|
} |
| 39 |
|
|
| 40 |
|
/** |
| 41 |
|
* Data provider. |