Skip to content

Commit b09fdd8

Browse files
committed
add return types
1 parent 0fca04e commit b09fdd8

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

src/Maker/MakeEntity.php

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ public function configureDependencies(DependencyBuilder $dependencies, InputInte
337337
ORMDependencyBuilder::buildDependencies($dependencies);
338338
}
339339

340-
private function askForNextField(ConsoleStyle $io, array $fields, string $entityClass, bool $isFirstField)
340+
private function askForNextField(ConsoleStyle $io, array $fields, string $entityClass, bool $isFirstField): EntityRelation|array|null
341341
{
342342
$io->writeln('');
343343

@@ -475,7 +475,7 @@ private function printAvailableTypes(ConsoleStyle $io): void
475475
],
476476
];
477477

478-
$printSection = function (array $sectionTypes) use ($io, &$allTypes) {
478+
$printSection = static function (array $sectionTypes) use ($io, &$allTypes) {
479479
foreach ($sectionTypes as $mainType => $subTypes) {
480480
unset($allTypes[$mainType]);
481481
$line = sprintf(' * <comment>%s</comment>', $mainType);
@@ -527,7 +527,7 @@ private function createEntityClassQuestion(string $questionText): Question
527527
return $question;
528528
}
529529

530-
private function askRelationDetails(ConsoleStyle $io, string $generatedEntityClass, string $type, string $newFieldName)
530+
private function askRelationDetails(ConsoleStyle $io, string $generatedEntityClass, string $type, string $newFieldName): EntityRelation
531531
{
532532
// ask the targetEntity
533533
$targetEntityClass = null;
@@ -573,15 +573,15 @@ function ($name) use ($targetClass) {
573573
);
574574
};
575575

576-
$askIsNullable = function (string $propertyName, string $targetClass) use ($io) {
576+
$askIsNullable = static function (string $propertyName, string $targetClass) use ($io) {
577577
return $io->confirm(sprintf(
578578
'Is the <comment>%s</comment>.<comment>%s</comment> property allowed to be null (nullable)?',
579579
Str::getShortClassName($targetClass),
580580
$propertyName
581581
));
582582
};
583583

584-
$askOrphanRemoval = function (string $owningClass, string $inverseClass) use ($io) {
584+
$askOrphanRemoval = static function (string $owningClass, string $inverseClass) use ($io) {
585585
$io->text([
586586
'Do you want to activate <comment>orphanRemoval</comment> on your relationship?',
587587
sprintf(
@@ -844,27 +844,27 @@ private function getPropertyNames(string $class): array
844844

845845
$reflClass = new \ReflectionClass($class);
846846

847-
return array_map(function (\ReflectionProperty $prop) {
847+
return array_map(static function (\ReflectionProperty $prop) {
848848
return $prop->getName();
849849
}, $reflClass->getProperties());
850850
}
851851

852-
/** @legacy Drop when Annotations are no longer supported */
853-
private function doesEntityUseAnnotationMapping(string $className): bool
854-
{
855-
if (!class_exists($className)) {
856-
$otherClassMetadatas = $this->doctrineHelper->getMetadata(Str::getNamespace($className).'\\', true);
857-
858-
// if we have no metadata, we should assume this is the first class being mapped
859-
if (empty($otherClassMetadatas)) {
860-
return false;
861-
}
862-
863-
$className = reset($otherClassMetadatas)->getName();
864-
}
865-
866-
return $this->doctrineHelper->isClassAnnotated($className);
867-
}
852+
// /** @legacy Drop when Annotations are no longer supported */
853+
// private function doesEntityUseAnnotationMapping(string $className): bool
854+
// {
855+
// if (!class_exists($className)) {
856+
// $otherClassMetadatas = $this->doctrineHelper->getMetadata(Str::getNamespace($className).'\\', true);
857+
//
858+
// // if we have no metadata, we should assume this is the first class being mapped
859+
// if (empty($otherClassMetadatas)) {
860+
// return false;
861+
// }
862+
//
863+
// $className = reset($otherClassMetadatas)->getName();
864+
// }
865+
//
866+
// return $this->doctrineHelper->isClassAnnotated($className);
867+
// }
868868

869869
/** @legacy Drop when Annotations are no longer supported */
870870
private function doesEntityUseAttributeMapping(string $className): bool

0 commit comments

Comments
 (0)