for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Spiechu\SymfonyCommonsBundle\Utils;
class StringUtils
{
/**
* @param string $string
* @param string $errorMessage
*
* @throws \InvalidArgumentException
*/
public static function assertNotEmpty(string $string, string $errorMessage = 'Empty string provided'): void
if ('' === $string) {
throw new \InvalidArgumentException($errorMessage);
}
* @param null|string $string
public static function assertNumericOrNull(?string $string, string $errorMessage = 'Parameter is not numeric'): void
if (null !== $string && !is_numeric($string)) {
* @param null[]|string[] ...$arguments
public static function assertAtLeastOneArgumentNotNull(string $errorMessage, ?string ...$arguments): void
foreach ($arguments as $argument) {
if ($argument !== null) {
return;