Skip to content

Commit e8358b6

Browse files
authored
Ensure all constants have explicit visibility modifiers (#919)
1 parent f7c99d2 commit e8358b6

File tree

7 files changed

+80
-81
lines changed

7 files changed

+80
-81
lines changed

phpcs.xml.dist

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
<rule ref="Doctrine">
1818
<!-- To fix -->
1919
<exclude name="PSR2.Methods.MethodDeclaration.Underscore" />
20-
<exclude name="SlevomatCodingStandard.Classes.ClassConstantVisibility.MissingConstantVisibility" />
2120
<exclude name="SlevomatCodingStandard.PHP.RequireExplicitAssertion.RequiredExplicitAssertion" />
2221
<exclude name="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingAnyTypeHint" />
2322
<exclude name="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint" />

src/Executor/Promise/Adapter/SyncPromise.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
*/
2727
class SyncPromise
2828
{
29-
const PENDING = 'pending';
30-
const FULFILLED = 'fulfilled';
31-
const REJECTED = 'rejected';
29+
public const PENDING = 'pending';
30+
public const FULFILLED = 'fulfilled';
31+
public const REJECTED = 'rejected';
3232

3333
/** @var SplQueue */
3434
public static $queue;

src/Language/AST/NodeKind.php

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -8,69 +8,69 @@ class NodeKind
88
{
99
// constants from language/kinds.js:
1010

11-
const NAME = 'Name';
11+
public const NAME = 'Name';
1212
// Document
1313

14-
const DOCUMENT = 'Document';
15-
const OPERATION_DEFINITION = 'OperationDefinition';
16-
const VARIABLE_DEFINITION = 'VariableDefinition';
17-
const VARIABLE = 'Variable';
18-
const SELECTION_SET = 'SelectionSet';
19-
const FIELD = 'Field';
20-
const ARGUMENT = 'Argument';
14+
public const DOCUMENT = 'Document';
15+
public const OPERATION_DEFINITION = 'OperationDefinition';
16+
public const VARIABLE_DEFINITION = 'VariableDefinition';
17+
public const VARIABLE = 'Variable';
18+
public const SELECTION_SET = 'SelectionSet';
19+
public const FIELD = 'Field';
20+
public const ARGUMENT = 'Argument';
2121
// Fragments
2222

23-
const FRAGMENT_SPREAD = 'FragmentSpread';
24-
const INLINE_FRAGMENT = 'InlineFragment';
25-
const FRAGMENT_DEFINITION = 'FragmentDefinition';
23+
public const FRAGMENT_SPREAD = 'FragmentSpread';
24+
public const INLINE_FRAGMENT = 'InlineFragment';
25+
public const FRAGMENT_DEFINITION = 'FragmentDefinition';
2626
// Values
2727

28-
const INT = 'IntValue';
29-
const FLOAT = 'FloatValue';
30-
const STRING = 'StringValue';
31-
const BOOLEAN = 'BooleanValue';
32-
const ENUM = 'EnumValue';
33-
const NULL = 'NullValue';
34-
const LST = 'ListValue';
35-
const OBJECT = 'ObjectValue';
36-
const OBJECT_FIELD = 'ObjectField';
28+
public const INT = 'IntValue';
29+
public const FLOAT = 'FloatValue';
30+
public const STRING = 'StringValue';
31+
public const BOOLEAN = 'BooleanValue';
32+
public const ENUM = 'EnumValue';
33+
public const NULL = 'NullValue';
34+
public const LST = 'ListValue';
35+
public const OBJECT = 'ObjectValue';
36+
public const OBJECT_FIELD = 'ObjectField';
3737
// Directives
3838

39-
const DIRECTIVE = 'Directive';
39+
public const DIRECTIVE = 'Directive';
4040
// Types
4141

42-
const NAMED_TYPE = 'NamedType';
43-
const LIST_TYPE = 'ListType';
44-
const NON_NULL_TYPE = 'NonNullType';
42+
public const NAMED_TYPE = 'NamedType';
43+
public const LIST_TYPE = 'ListType';
44+
public const NON_NULL_TYPE = 'NonNullType';
4545
// Type System Definitions
4646

47-
const SCHEMA_DEFINITION = 'SchemaDefinition';
48-
const OPERATION_TYPE_DEFINITION = 'OperationTypeDefinition';
47+
public const SCHEMA_DEFINITION = 'SchemaDefinition';
48+
public const OPERATION_TYPE_DEFINITION = 'OperationTypeDefinition';
4949
// Type Definitions
5050

51-
const SCALAR_TYPE_DEFINITION = 'ScalarTypeDefinition';
52-
const OBJECT_TYPE_DEFINITION = 'ObjectTypeDefinition';
53-
const FIELD_DEFINITION = 'FieldDefinition';
54-
const INPUT_VALUE_DEFINITION = 'InputValueDefinition';
55-
const INTERFACE_TYPE_DEFINITION = 'InterfaceTypeDefinition';
56-
const UNION_TYPE_DEFINITION = 'UnionTypeDefinition';
57-
const ENUM_TYPE_DEFINITION = 'EnumTypeDefinition';
58-
const ENUM_VALUE_DEFINITION = 'EnumValueDefinition';
59-
const INPUT_OBJECT_TYPE_DEFINITION = 'InputObjectTypeDefinition';
51+
public const SCALAR_TYPE_DEFINITION = 'ScalarTypeDefinition';
52+
public const OBJECT_TYPE_DEFINITION = 'ObjectTypeDefinition';
53+
public const FIELD_DEFINITION = 'FieldDefinition';
54+
public const INPUT_VALUE_DEFINITION = 'InputValueDefinition';
55+
public const INTERFACE_TYPE_DEFINITION = 'InterfaceTypeDefinition';
56+
public const UNION_TYPE_DEFINITION = 'UnionTypeDefinition';
57+
public const ENUM_TYPE_DEFINITION = 'EnumTypeDefinition';
58+
public const ENUM_VALUE_DEFINITION = 'EnumValueDefinition';
59+
public const INPUT_OBJECT_TYPE_DEFINITION = 'InputObjectTypeDefinition';
6060
// Type Extensions
6161

62-
const SCALAR_TYPE_EXTENSION = 'ScalarTypeExtension';
63-
const OBJECT_TYPE_EXTENSION = 'ObjectTypeExtension';
64-
const INTERFACE_TYPE_EXTENSION = 'InterfaceTypeExtension';
65-
const UNION_TYPE_EXTENSION = 'UnionTypeExtension';
66-
const ENUM_TYPE_EXTENSION = 'EnumTypeExtension';
67-
const INPUT_OBJECT_TYPE_EXTENSION = 'InputObjectTypeExtension';
62+
public const SCALAR_TYPE_EXTENSION = 'ScalarTypeExtension';
63+
public const OBJECT_TYPE_EXTENSION = 'ObjectTypeExtension';
64+
public const INTERFACE_TYPE_EXTENSION = 'InterfaceTypeExtension';
65+
public const UNION_TYPE_EXTENSION = 'UnionTypeExtension';
66+
public const ENUM_TYPE_EXTENSION = 'EnumTypeExtension';
67+
public const INPUT_OBJECT_TYPE_EXTENSION = 'InputObjectTypeExtension';
6868
// Directive Definitions
6969

70-
const DIRECTIVE_DEFINITION = 'DirectiveDefinition';
70+
public const DIRECTIVE_DEFINITION = 'DirectiveDefinition';
7171

7272
// Type System Extensions
73-
const SCHEMA_EXTENSION = 'SchemaExtension';
73+
public const SCHEMA_EXTENSION = 'SchemaExtension';
7474

7575
/** @var string[] */
7676
public static $classMap = [

src/Language/DirectiveLocation.php

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99
*/
1010
class DirectiveLocation
1111
{
12-
const QUERY = 'QUERY';
13-
const MUTATION = 'MUTATION';
14-
const SUBSCRIPTION = 'SUBSCRIPTION';
15-
const FIELD = 'FIELD';
16-
const FRAGMENT_DEFINITION = 'FRAGMENT_DEFINITION';
17-
const FRAGMENT_SPREAD = 'FRAGMENT_SPREAD';
18-
const INLINE_FRAGMENT = 'INLINE_FRAGMENT';
19-
const VARIABLE_DEFINITION = 'VARIABLE_DEFINITION';
12+
public const QUERY = 'QUERY';
13+
public const MUTATION = 'MUTATION';
14+
public const SUBSCRIPTION = 'SUBSCRIPTION';
15+
public const FIELD = 'FIELD';
16+
public const FRAGMENT_DEFINITION = 'FRAGMENT_DEFINITION';
17+
public const FRAGMENT_SPREAD = 'FRAGMENT_SPREAD';
18+
public const INLINE_FRAGMENT = 'INLINE_FRAGMENT';
19+
public const VARIABLE_DEFINITION = 'VARIABLE_DEFINITION';
2020

21-
const EXECUTABLE_LOCATIONS = [
21+
public const EXECUTABLE_LOCATIONS = [
2222
self::QUERY => self::QUERY,
2323
self::MUTATION => self::MUTATION,
2424
self::SUBSCRIPTION => self::SUBSCRIPTION,
@@ -29,19 +29,19 @@ class DirectiveLocation
2929
self::VARIABLE_DEFINITION => self::VARIABLE_DEFINITION,
3030
];
3131

32-
const SCHEMA = 'SCHEMA';
33-
const SCALAR = 'SCALAR';
34-
const OBJECT = 'OBJECT';
35-
const FIELD_DEFINITION = 'FIELD_DEFINITION';
36-
const ARGUMENT_DEFINITION = 'ARGUMENT_DEFINITION';
37-
const IFACE = 'INTERFACE';
38-
const UNION = 'UNION';
39-
const ENUM = 'ENUM';
40-
const ENUM_VALUE = 'ENUM_VALUE';
41-
const INPUT_OBJECT = 'INPUT_OBJECT';
42-
const INPUT_FIELD_DEFINITION = 'INPUT_FIELD_DEFINITION';
32+
public const SCHEMA = 'SCHEMA';
33+
public const SCALAR = 'SCALAR';
34+
public const OBJECT = 'OBJECT';
35+
public const FIELD_DEFINITION = 'FIELD_DEFINITION';
36+
public const ARGUMENT_DEFINITION = 'ARGUMENT_DEFINITION';
37+
public const IFACE = 'INTERFACE';
38+
public const UNION = 'UNION';
39+
public const ENUM = 'ENUM';
40+
public const ENUM_VALUE = 'ENUM_VALUE';
41+
public const INPUT_OBJECT = 'INPUT_OBJECT';
42+
public const INPUT_FIELD_DEFINITION = 'INPUT_FIELD_DEFINITION';
4343

44-
const TYPE_SYSTEM_LOCATIONS = [
44+
public const TYPE_SYSTEM_LOCATIONS = [
4545
self::SCHEMA => self::SCHEMA,
4646
self::SCALAR => self::SCALAR,
4747
self::OBJECT => self::OBJECT,
@@ -55,7 +55,7 @@ class DirectiveLocation
5555
self::INPUT_FIELD_DEFINITION => self::INPUT_FIELD_DEFINITION,
5656
];
5757

58-
const LOCATIONS = self::EXECUTABLE_LOCATIONS + self::TYPE_SYSTEM_LOCATIONS;
58+
public const LOCATIONS = self::EXECUTABLE_LOCATIONS + self::TYPE_SYSTEM_LOCATIONS;
5959

6060
public static function has(string $name): bool
6161
{

src/Type/Introspection.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@
3434

3535
class Introspection
3636
{
37-
const SCHEMA_FIELD_NAME = '__schema';
38-
const TYPE_FIELD_NAME = '__type';
39-
const TYPE_NAME_FIELD_NAME = '__typename';
37+
public const SCHEMA_FIELD_NAME = '__schema';
38+
public const TYPE_FIELD_NAME = '__type';
39+
public const TYPE_NAME_FIELD_NAME = '__typename';
4040

4141
/** @var array<string, mixed> */
4242
private static $map = [];

src/Type/TypeKind.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66

77
class TypeKind
88
{
9-
const SCALAR = 'SCALAR';
10-
const OBJECT = 'OBJECT';
11-
const INTERFACE = 'INTERFACE';
12-
const UNION = 'UNION';
13-
const ENUM = 'ENUM';
14-
const INPUT_OBJECT = 'INPUT_OBJECT';
15-
const LIST = 'LIST';
16-
const NON_NULL = 'NON_NULL';
9+
public const SCALAR = 'SCALAR';
10+
public const OBJECT = 'OBJECT';
11+
public const INTERFACE = 'INTERFACE';
12+
public const UNION = 'UNION';
13+
public const ENUM = 'ENUM';
14+
public const INPUT_OBJECT = 'INPUT_OBJECT';
15+
public const LIST = 'LIST';
16+
public const NON_NULL = 'NON_NULL';
1717
}

src/Utils/SchemaExtender.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343

4444
class SchemaExtender
4545
{
46-
const SCHEMA_EXTENSION = 'SchemaExtension';
46+
public const SCHEMA_EXTENSION = 'SchemaExtension';
4747

4848
/** @var Type[] */
4949
protected static $extendTypeCache;

0 commit comments

Comments
 (0)