Skip to content

Commit 3689d93

Browse files
Tests cleanup
Avoid spaces in `()` for function definitions and calls, rename tests for attributes being repeatable, drop tokenization tests
1 parent adfdf6b commit 3689d93

13 files changed

+26
-80
lines changed

Zend/tests/attributes/034_target_values.phpt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,26 @@ Attribute flags are all different, TARGET_ALL includes all targets
33
--FILE--
44
<?php
55

6-
function showFlag( string $name, int $value ) {
6+
function showFlag(string $name, int $value) {
77
$all = Attribute::TARGET_ALL;
88
$and = $all & $value;
99
echo "Attribute::$name = $value ($all & $value === $and)\n";
1010
}
1111

12-
showFlag( "TARGET_CLASS", Attribute::TARGET_CLASS );
13-
showFlag( "TARGET_FUNCTION", Attribute::TARGET_FUNCTION );
14-
showFlag( "TARGET_METHOD", Attribute::TARGET_METHOD );
15-
showFlag( "TARGET_PROPERTY", Attribute::TARGET_PROPERTY );
16-
showFlag( "TARGET_CLASS_CONSTANT", Attribute::TARGET_CLASS_CONSTANT );
17-
showFlag( "TARGET_PARAMETER", Attribute::TARGET_PARAMETER );
18-
showFlag( "TARGET_CONSTANT", Attribute::TARGET_CONSTANT );
19-
showFlag( "IS_REPEATABLE", Attribute::IS_REPEATABLE );
12+
showFlag("TARGET_CLASS", Attribute::TARGET_CLASS);
13+
showFlag("TARGET_FUNCTION", Attribute::TARGET_FUNCTION);
14+
showFlag("TARGET_METHOD", Attribute::TARGET_METHOD);
15+
showFlag("TARGET_PROPERTY", Attribute::TARGET_PROPERTY);
16+
showFlag("TARGET_CLASS_CONSTANT", Attribute::TARGET_CLASS_CONSTANT);
17+
showFlag("TARGET_PARAMETER", Attribute::TARGET_PARAMETER);
18+
showFlag("TARGET_CONSTANT", Attribute::TARGET_CONSTANT);
19+
showFlag("IS_REPEATABLE", Attribute::IS_REPEATABLE);
2020

2121
$all = Attribute::TARGET_CLASS | Attribute::TARGET_FUNCTION
2222
| Attribute::TARGET_METHOD | Attribute::TARGET_PROPERTY
2323
| Attribute::TARGET_CLASS_CONSTANT | Attribute::TARGET_PARAMETER
2424
| Attribute::TARGET_CONSTANT;
25-
var_dump( $all, Attribute::TARGET_ALL, $all === Attribute::TARGET_ALL );
25+
var_dump($all, Attribute::TARGET_ALL, $all === Attribute::TARGET_ALL);
2626

2727
?>
2828
--EXPECT--

Zend/tests/attributes/constants/allow_named_parameters.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ const EXAMPLE = 'Foo';
88

99
$ref = new ReflectionConstant('EXAMPLE');
1010
$attribs = $ref->getAttributes();
11-
var_dump( $attribs );
12-
var_dump( $attribs[0]->getArguments() );
11+
var_dump($attribs);
12+
var_dump($attribs[0]->getArguments());
1313

1414
?>
1515
--EXPECTF--

Zend/tests/attributes/constants/ast_export.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const WITH_GROUPED = true;
1818
#[MyAttrib(5, param: "example")]
1919
const WITH_PARAMETERS = true;
2020

21-
echo zend_test_compile_to_ast( file_get_contents( __FILE__ ) );
21+
echo zend_test_compile_to_ast(file_get_contents(__FILE__));
2222

2323
?>
2424
--EXPECT--

Zend/tests/attributes/constants/constant_redefined_addition.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ const MY_CONST = "Has attributes";
1010

1111
echo MY_CONST . "\n";
1212

13-
$reflection = new ReflectionConstant( 'MY_CONST' );
14-
var_dump( $reflection->getAttributes() )
13+
$reflection = new ReflectionConstant('MY_CONST');
14+
var_dump($reflection->getAttributes())
1515

1616
?>
1717
--EXPECTF--

Zend/tests/attributes/constants/constant_redefined_change.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ const MY_CONST = "Has attributes (2)";
1111

1212
echo MY_CONST . "\n";
1313

14-
$reflection = new ReflectionConstant( 'MY_CONST' );
15-
var_dump( $reflection->getAttributes() )
14+
$reflection = new ReflectionConstant('MY_CONST');
15+
var_dump($reflection->getAttributes())
1616

1717
?>
1818
--EXPECTF--

Zend/tests/attributes/constants/constant_redefined_removal.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ const MY_CONST = "No attributes";
1010

1111
echo MY_CONST . "\n";
1212

13-
$reflection = new ReflectionConstant( 'MY_CONST' );
14-
var_dump( $reflection->getAttributes() )
13+
$reflection = new ReflectionConstant('MY_CONST');
14+
var_dump($reflection->getAttributes())
1515

1616
?>
1717
--EXPECTF--

Zend/tests/attributes/constants/must_target_const-userland.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const EXAMPLE = 'Foo';
1111

1212
$ref = new ReflectionConstant('EXAMPLE');
1313
$attribs = $ref->getAttributes();
14-
var_dump( $attribs );
14+
var_dump($attribs);
1515
$attribs[0]->newInstance();
1616

1717
?>

Zend/tests/attributes/constants/not_repeatable-userland.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ class MyAttribute {}
1010
#[MyAttribute]
1111
const MY_CONST = true;
1212

13-
$attributes = new ReflectionConstant( 'MY_CONST' )->getAttributes();
14-
var_dump( $attributes );
13+
$attributes = new ReflectionConstant('MY_CONST')->getAttributes();
14+
var_dump($attributes);
1515
$attributes[0]->newInstance();
1616

1717
?>

Zend/tests/attributes/constants/yes_repeatable-userland.phpt renamed to Zend/tests/attributes/constants/repeatable-userland.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ class MyAttribute {}
1010
#[MyAttribute]
1111
const MY_CONST = true;
1212

13-
$attributes = new ReflectionConstant( 'MY_CONST' )->getAttributes();
14-
var_dump( $attributes );
13+
$attributes = new ReflectionConstant('MY_CONST')->getAttributes();
14+
var_dump($attributes);
1515
$attributes[0]->newInstance();
1616

1717
?>

0 commit comments

Comments
 (0)