Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public static function validateClassName(string $className, string $errorMessage
public static function notBlank(string $value = null): string
{
if (null === $value || '' === $value) {
throw new RuntimeCommandException('This value cannot be blank');
throw new RuntimeCommandException('This value cannot be blank.');
}

return $value;
Expand Down Expand Up @@ -181,7 +181,7 @@ public static function classExists(string $className, string $errorMessage = '')
self::notBlank($className);

if (!class_exists($className)) {
$errorMessage = $errorMessage ?: sprintf('Class "%s" doesn\'t exists. Please enter existing full class name', $className);
$errorMessage = $errorMessage ?: sprintf('Class "%s" doesn\'t exist; please enter an existing full class name.', $className);

throw new RuntimeCommandException($errorMessage);
}
Expand All @@ -194,15 +194,15 @@ public static function entityExists(string $className = null, array $entities =
self::notBlank($className);

if (empty($entities)) {
throw new RuntimeCommandException('There is no registered entities. Please create entity before use this command');
throw new RuntimeCommandException('There is no registered entities; please create entity before use this command.');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this one still needs some fixing. How about:
'There are no registered entities; please create an entity before using this command.'?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯 fixed at sha: 6732a15

}

if (0 === strpos($className, '\\')) {
self::classExists($className, sprintf('Entity "%s" doesn\'t exists. Please enter existing one or create new', $className));
self::classExists($className, sprintf('Entity "%s" doesn\'t exist; please enter an existing one or create a new one.', $className));
}

if (!\in_array($className, $entities)) {
throw new RuntimeCommandException(sprintf('Entity "%s" doesn\'t exists. Please enter existing one or create new', $className));
throw new RuntimeCommandException(sprintf('Entity "%s" doesn\'t exist; please enter an existing one or create a new one.', $className));
}

return $className;
Expand All @@ -213,7 +213,7 @@ public static function classDoesNotExist($className): string
self::notBlank($className);

if (class_exists($className)) {
throw new RuntimeCommandException(sprintf('Class "%s" already exists', $className));
throw new RuntimeCommandException(sprintf('Class "%s" already exists.', $className));
}

return $className;
Expand Down