Skip to content

Commit 153183f

Browse files
committed
Add . to exception messages
1 parent a37b5b6 commit 153183f

5 files changed

Lines changed: 11 additions & 11 deletions

File tree

src/Doctrine/EntityRelation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function __construct(
3434
private string $inverseClass,
3535
) {
3636
if (!\in_array($type, self::getValidRelationTypes())) {
37-
throw new \Exception(\sprintf('Invalid relation type "%s"', $type));
37+
throw new \Exception(\sprintf('Invalid relation type "%s".', $type));
3838
}
3939

4040
if (self::ONE_TO_MANY === $type) {

src/Maker/MakeEntity.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen
301301
}
302302
$currentFields[] = $newFieldName;
303303
} else {
304-
throw new \Exception('Invalid value');
304+
throw new \Exception('Invalid value.');
305305
}
306306

307307
foreach ($fileManagerOperations as $path => $manipulatorOrMessage) {
@@ -827,7 +827,7 @@ private function askRelationType(ConsoleStyle $io, string $entityClass, string $
827827
$question->setAutocompleterValues(EntityRelation::getValidRelationTypes());
828828
$question->setValidator(static function ($type) {
829829
if (!\in_array($type, EntityRelation::getValidRelationTypes())) {
830-
throw new \InvalidArgumentException(\sprintf('Invalid type: use one of: %s', implode(', ', EntityRelation::getValidRelationTypes())));
830+
throw new \InvalidArgumentException(\sprintf('Invalid type, use one of: "%s"', implode('", "', EntityRelation::getValidRelationTypes())));
831831
}
832832

833833
return $type;

src/Test/MakerTestRunner.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public function modifyYamlFile(string $filename, \Closure $callback)
114114

115115
$newData = $callback($manipulator->getData());
116116
if (!\is_array($newData)) {
117-
throw new \Exception('The modifyYamlFile() callback must return the final array of data');
117+
throw new \Exception('The modifyYamlFile() callback must return the final array of data.');
118118
}
119119
$manipulator->setData($newData);
120120

src/Util/ClassSourceManipulator.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ private function addCustomGetter(string $propertyName, string $methodName, $retu
433433
break;
434434
default:
435435
// implement other cases if/when the library needs them
436-
throw new \Exception('Not implemented');
436+
throw new \Exception('Not implemented.');
437437
}
438438
}
439439

@@ -967,7 +967,7 @@ private function getClassNode(): Node\Stmt\Class_
967967
$node = $this->findFirstNode(static fn ($node) => $node instanceof Node\Stmt\Class_);
968968

969969
if (!$node) {
970-
throw new \Exception('Could not find class node');
970+
throw new \Exception('Could not find class node.');
971971
}
972972

973973
return $node;
@@ -978,7 +978,7 @@ private function getNamespaceNode(): Node\Stmt\Namespace_
978978
$node = $this->findFirstNode(static fn ($node) => $node instanceof Node\Stmt\Namespace_);
979979

980980
if (!$node) {
981-
throw new \Exception('Could not find namespace node');
981+
throw new \Exception('Could not find namespace node.');
982982
}
983983

984984
return $node;
@@ -1044,10 +1044,10 @@ private function createSingleLineCommentNode(string $comment, string $context):
10441044
switch ($context) {
10451045
case self::CONTEXT_OUTSIDE_CLASS:
10461046
// just not needed yet
1047-
throw new \Exception('not supported');
1047+
throw new \Exception('Not supported.');
10481048
case self::CONTEXT_CLASS:
10491049
// just not needed yet
1050-
throw new \Exception('not supported');
1050+
throw new \Exception('Not supported.');
10511051
case self::CONTEXT_CLASS_METHOD:
10521052
return BuilderHelpers::normalizeStmt(new Node\Expr\Variable(\sprintf('__COMMENT__VAR_%d', \count($this->pendingComments) - 1)));
10531053
default:

src/Util/YamlSourceManipulator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,7 +1000,7 @@ private function guessNextArrayTypeAndAdvance(): string
10001000
{
10011001
while (true) {
10021002
if ($this->isEOF()) {
1003-
throw new \LogicException('Could not determine array type');
1003+
throw new \LogicException('Could not determine array type.');
10041004
}
10051005

10061006
// get the next char & advance immediately
@@ -1029,7 +1029,7 @@ private function findPositionOfNextCharacter(array $chars)
10291029
$currentPosition = $this->currentPosition;
10301030
while (true) {
10311031
if ($this->isEOF($currentPosition)) {
1032-
throw new \LogicException(\sprintf('Could not find any characters: %s', implode(', ', $chars)));
1032+
throw new \LogicException(\sprintf('Could not find any characters: "%s"', implode('", "', $chars)));
10331033
}
10341034

10351035
// get the next char & advance immediately

0 commit comments

Comments
 (0)