@@ -23,13 +23,22 @@ class SubversionPropertiesSniff implements Sniff
23
23
* exact value the property should have or NULL if the
24
24
* property should just be set but the value is not fixed.
25
25
*
26
- * @var array
26
+ * @var array<string, string>
27
27
*/
28
- protected $ properties = [
28
+ protected const REQUIRED_PROPERTIES = [
29
29
'svn:keywords ' => 'Author Id Revision ' ,
30
30
'svn:eol-style ' => 'native ' ,
31
31
];
32
32
33
+ /**
34
+ * The Subversion properties that should be set.
35
+ *
36
+ * @var array<string, string>
37
+ *
38
+ * @deprecated 4.0.0 Use the SubversionPropertiesSniff::REQUIRED_PROPERTIES constant instead.
39
+ */
40
+ protected $ properties = self ::REQUIRED_PROPERTIES ;
41
+
33
42
34
43
/**
35
44
* Returns an array of tokens this test wants to listen for.
@@ -61,10 +70,10 @@ public function process(File $phpcsFile, $stackPtr)
61
70
return $ phpcsFile ->numTokens ;
62
71
}
63
72
64
- $ allProperties = ($ properties + $ this -> properties );
73
+ $ allProperties = ($ properties + static :: REQUIRED_PROPERTIES );
65
74
foreach ($ allProperties as $ key => $ value ) {
66
75
if (isset ($ properties [$ key ]) === true
67
- && isset ($ this -> properties [$ key ]) === false
76
+ && isset (static :: REQUIRED_PROPERTIES [$ key ]) === false
68
77
) {
69
78
$ error = 'Unexpected Subversion property "%s" = "%s" ' ;
70
79
$ data = [
@@ -76,25 +85,25 @@ public function process(File $phpcsFile, $stackPtr)
76
85
}
77
86
78
87
if (isset ($ properties [$ key ]) === false
79
- && isset ($ this -> properties [$ key ]) === true
88
+ && isset (static :: REQUIRED_PROPERTIES [$ key ]) === true
80
89
) {
81
90
$ error = 'Missing Subversion property "%s" = "%s" ' ;
82
91
$ data = [
83
92
$ key ,
84
- $ this -> properties [$ key ],
93
+ static :: REQUIRED_PROPERTIES [$ key ],
85
94
];
86
95
$ phpcsFile ->addError ($ error , $ stackPtr , 'Missing ' , $ data );
87
96
continue ;
88
97
}
89
98
90
99
if ($ properties [$ key ] !== null
91
- && $ properties [$ key ] !== $ this -> properties [$ key ]
100
+ && $ properties [$ key ] !== static :: REQUIRED_PROPERTIES [$ key ]
92
101
) {
93
102
$ error = 'Subversion property "%s" = "%s" does not match "%s" ' ;
94
103
$ data = [
95
104
$ key ,
96
105
$ properties [$ key ],
97
- $ this -> properties [$ key ],
106
+ static :: REQUIRED_PROPERTIES [$ key ],
98
107
];
99
108
$ phpcsFile ->addError ($ error , $ stackPtr , 'NoMatch ' , $ data );
100
109
}
0 commit comments