@@ -49,7 +49,7 @@ class Common
49
49
*
50
50
* @return bool
51
51
*/
52
- public static function isPharFile ($ path )
52
+ public static function isPharFile (string $ path )
53
53
{
54
54
if (strpos ($ path , 'phar:// ' ) === 0 ) {
55
55
return true ;
@@ -70,7 +70,7 @@ public static function isPharFile($path)
70
70
*
71
71
* @return boolean
72
72
*/
73
- public static function isReadable ($ path )
73
+ public static function isReadable (string $ path )
74
74
{
75
75
if (@is_readable ($ path ) === true ) {
76
76
return true ;
@@ -97,7 +97,7 @@ public static function isReadable($path)
97
97
*
98
98
* @return string|false
99
99
*/
100
- public static function realpath ($ path )
100
+ public static function realpath (string $ path )
101
101
{
102
102
// Support the path replacement of ~ with the user's home directory.
103
103
if (substr ($ path , 0 , 2 ) === '~/ ' ) {
@@ -150,7 +150,7 @@ public static function realpath($path)
150
150
*
151
151
* @return string
152
152
*/
153
- public static function stripBasepath ($ path , $ basepath )
153
+ public static function stripBasepath (string $ path , ? string $ basepath )
154
154
{
155
155
if (empty ($ basepath ) === true ) {
156
156
return $ path ;
@@ -178,7 +178,7 @@ public static function stripBasepath($path, $basepath)
178
178
*
179
179
* @return string
180
180
*/
181
- public static function detectLineEndings ($ contents )
181
+ public static function detectLineEndings (string $ contents )
182
182
{
183
183
if (preg_match ("/ \r\n?| \n/ " , $ contents , $ matches ) !== 1 ) {
184
184
// Assume there are no newlines.
@@ -258,7 +258,7 @@ public static function isStdinATTY()
258
258
*
259
259
* @return string
260
260
*/
261
- public static function escapeshellcmd ($ cmd )
261
+ public static function escapeshellcmd (string $ cmd )
262
262
{
263
263
$ cmd = escapeshellcmd ($ cmd );
264
264
@@ -285,7 +285,7 @@ public static function escapeshellcmd($cmd)
285
285
*
286
286
* @return string
287
287
*/
288
- public static function prepareForOutput ($ content , $ exclude =[])
288
+ public static function prepareForOutput (string $ content , array $ exclude =[])
289
289
{
290
290
if (PHP_OS_FAMILY === 'Windows ' ) {
291
291
if (in_array ("\r" , $ exclude , true ) === false ) {
@@ -329,7 +329,7 @@ public static function prepareForOutput($content, $exclude=[])
329
329
*
330
330
* @return string
331
331
*/
332
- public static function stripColors ($ text )
332
+ public static function stripColors (string $ text )
333
333
{
334
334
return preg_replace ('`\033\[[0-9;]+m` ' , '' , $ text );
335
335
@@ -357,10 +357,10 @@ public static function stripColors($text)
357
357
* @return boolean
358
358
*/
359
359
public static function isCamelCaps (
360
- $ name ,
361
- $ classFormat =false ,
362
- $ visibilityPublic =true ,
363
- $ strict =true
360
+ string $ name ,
361
+ bool $ classFormat =false ,
362
+ bool $ visibilityPublic =true ,
363
+ bool $ strict =true
364
364
) {
365
365
// Check the first character first.
366
366
if ($ classFormat === false ) {
@@ -428,7 +428,7 @@ public static function isCamelCaps(
428
428
*
429
429
* @return boolean
430
430
*/
431
- public static function isUnderscoreName ($ name )
431
+ public static function isUnderscoreName (string $ name )
432
432
{
433
433
// If there is whitespace in the name, it can't be valid.
434
434
if (strpos ($ name , ' ' ) !== false ) {
@@ -469,7 +469,7 @@ public static function isUnderscoreName($name)
469
469
*
470
470
* @return string
471
471
*/
472
- public static function suggestType ($ varType )
472
+ public static function suggestType (string $ varType )
473
473
{
474
474
if ($ varType === '' ) {
475
475
return '' ;
@@ -589,7 +589,7 @@ public static function getSniffCode($sniffClass)
589
589
*
590
590
* @return string
591
591
*/
592
- public static function cleanSniffClass ($ sniffClass )
592
+ public static function cleanSniffClass (string $ sniffClass )
593
593
{
594
594
$ newName = strtolower ($ sniffClass );
595
595
0 commit comments