| @@ 16-31 (lines=16) @@ | ||
| 13 | * @package PHPCompatibility |
|
| 14 | * @author Wim Godden <[email protected]> |
|
| 15 | */ |
|
| 16 | class ForbiddenGlobalVariableVariableSniffTest extends BaseSniffTest |
|
| 17 | { |
|
| 18 | /** |
|
| 19 | * Verify that checking for a specific version works |
|
| 20 | * |
|
| 21 | * @return void |
|
| 22 | */ |
|
| 23 | public function testGlobalVariableVariable() |
|
| 24 | { |
|
| 25 | $file = $this->sniffFile('sniff-examples/forbidden_global_variable_variable.php', '5.6'); |
|
| 26 | $this->assertNoViolation($file, 3); |
|
| 27 | ||
| 28 | $file = $this->sniffFile('sniff-examples/forbidden_global_variable_variable.php', '7.0'); |
|
| 29 | $this->assertError($file, 3, "Global with variable variables are not allowed since PHP 7.0"); |
|
| 30 | } |
|
| 31 | } |
|
| 32 | ||
| @@ 16-31 (lines=16) @@ | ||
| 13 | * @package PHPCompatibility |
|
| 14 | * @author Wim Godden <[email protected]> |
|
| 15 | */ |
|
| 16 | class ForbiddenForbiddenFunctionParametersWithSameNameSniffTest extends BaseSniffTest |
|
| 17 | { |
|
| 18 | /** |
|
| 19 | * testSettingTestVersion |
|
| 20 | * |
|
| 21 | * @return void |
|
| 22 | */ |
|
| 23 | public function testSettingTestVersion() |
|
| 24 | { |
|
| 25 | $file = $this->sniffFile('sniff-examples/forbidden_function_parameters_with_same_name.php', '5.6'); |
|
| 26 | $this->assertNoViolation($file, 3); |
|
| 27 | ||
| 28 | $file = $this->sniffFile('sniff-examples/forbidden_function_parameters_with_same_name.php', '7.0'); |
|
| 29 | $this->assertError($file, 3, 'Functions can not have multiple parameters with the same name since PHP 7.0'); |
|
| 30 | } |
|
| 31 | } |
|
| 32 | ||
| 33 | ||
| @@ 15-30 (lines=16) @@ | ||
| 12 | * @package PHPCompatibility |
|
| 13 | * @author Koen Eelen <[email protected]> |
|
| 14 | */ |
|
| 15 | class DeprecatedPHP4StyleConstructorsSniffTest extends BaseSniffTest |
|
| 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 | ||