mirror of
https://github.com/wiosna-dev/common-library.git
synced 2026-03-12 09:31:51 +01:00
Fix code pointed by Psalm
This commit is contained in:
@@ -1274,7 +1274,7 @@ class Miscellaneous
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getProjectRootPath()
|
||||
public static function getProjectRootPath(): string
|
||||
{
|
||||
$projectRootPath = '';
|
||||
|
||||
@@ -1298,4 +1298,25 @@ class Miscellaneous
|
||||
|
||||
return $projectRootPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes marginal character (first or last) from given string
|
||||
*
|
||||
* @param string $string The string which should be shortened
|
||||
* @param bool $last (optional) If is set to true, last element is removed (default behaviour). Otherwise -
|
||||
* first.
|
||||
* @return null|string
|
||||
*/
|
||||
public static function removeMarginalCharacter(string $string, bool $last = true): ?string
|
||||
{
|
||||
if (empty($string)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($last) {
|
||||
return substr($string, 0, -1);
|
||||
}
|
||||
|
||||
return substr($string, 1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user