@@ -49,7 +49,7 @@ class Common
4949 *
5050 * @return bool
5151 */
52- public static function isPharFile ($ path )
52+ public static function isPharFile (string $ path )
5353 {
5454 if (strpos ($ path , 'phar:// ' ) === 0 ) {
5555 return true ;
@@ -70,7 +70,7 @@ public static function isPharFile($path)
7070 *
7171 * @return boolean
7272 */
73- public static function isReadable ($ path )
73+ public static function isReadable (string $ path )
7474 {
7575 if (@is_readable ($ path ) === true ) {
7676 return true ;
@@ -97,7 +97,7 @@ public static function isReadable($path)
9797 *
9898 * @return string|false
9999 */
100- public static function realpath ($ path )
100+ public static function realpath (string $ path )
101101 {
102102 // Support the path replacement of ~ with the user's home directory.
103103 if (substr ($ path , 0 , 2 ) === '~/ ' ) {
@@ -150,7 +150,7 @@ public static function realpath($path)
150150 *
151151 * @return string
152152 */
153- public static function stripBasepath ($ path , $ basepath )
153+ public static function stripBasepath (string $ path , ? string $ basepath )
154154 {
155155 if (empty ($ basepath ) === true ) {
156156 return $ path ;
@@ -178,7 +178,7 @@ public static function stripBasepath($path, $basepath)
178178 *
179179 * @return string
180180 */
181- public static function detectLineEndings ($ contents )
181+ public static function detectLineEndings (string $ contents )
182182 {
183183 if (preg_match ("/ \r\n?| \n/ " , $ contents , $ matches ) !== 1 ) {
184184 // Assume there are no newlines.
@@ -258,7 +258,7 @@ public static function isStdinATTY()
258258 *
259259 * @return string
260260 */
261- public static function escapeshellcmd ($ cmd )
261+ public static function escapeshellcmd (string $ cmd )
262262 {
263263 $ cmd = escapeshellcmd ($ cmd );
264264
@@ -285,7 +285,7 @@ public static function escapeshellcmd($cmd)
285285 *
286286 * @return string
287287 */
288- public static function prepareForOutput ($ content , $ exclude =[])
288+ public static function prepareForOutput (string $ content , array $ exclude =[])
289289 {
290290 if (PHP_OS_FAMILY === 'Windows ' ) {
291291 if (in_array ("\r" , $ exclude , true ) === false ) {
@@ -329,7 +329,7 @@ public static function prepareForOutput($content, $exclude=[])
329329 *
330330 * @return string
331331 */
332- public static function stripColors ($ text )
332+ public static function stripColors (string $ text )
333333 {
334334 return preg_replace ('`\033\[[0-9;]+m` ' , '' , $ text );
335335
@@ -357,10 +357,10 @@ public static function stripColors($text)
357357 * @return boolean
358358 */
359359 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
364364 ) {
365365 // Check the first character first.
366366 if ($ classFormat === false ) {
@@ -428,7 +428,7 @@ public static function isCamelCaps(
428428 *
429429 * @return boolean
430430 */
431- public static function isUnderscoreName ($ name )
431+ public static function isUnderscoreName (string $ name )
432432 {
433433 // If there is whitespace in the name, it can't be valid.
434434 if (strpos ($ name , ' ' ) !== false ) {
@@ -469,7 +469,7 @@ public static function isUnderscoreName($name)
469469 *
470470 * @return string
471471 */
472- public static function suggestType ($ varType )
472+ public static function suggestType (string $ varType )
473473 {
474474 if ($ varType === '' ) {
475475 return '' ;
@@ -589,7 +589,7 @@ public static function getSniffCode($sniffClass)
589589 *
590590 * @return string
591591 */
592- public static function cleanSniffClass ($ sniffClass )
592+ public static function cleanSniffClass (string $ sniffClass )
593593 {
594594 $ newName = strtolower ($ sniffClass );
595595
0 commit comments