-
Notifications
You must be signed in to change notification settings - Fork 53
Open
Description
At the moment there is a mess in the code. How do you want to test code like:
$entityType = \go\core\orm\EntityType::findById($this->entityTypeId);
$className = $entityType->getClassName();
You cant actually use if (!$entityType) {...} because the return type is bool and entityType could be also true. Perhaps all functions returning something byId, by should return ?stratic. Sure you can create hint to fool phpstan but then you would hide real error. For example
groupoffice/www/go/core/model/Link.php
Lines 127 to 130 in 49b238c
| public function setFromEntity(string $entityName) { | |
| $e = EntityType::findByName($entityName); | |
| $this->fromEntity = $e->getName(); | |
| $this->fromEntityTypeId = $e->getId(); |
Sometimes phpstan is the hell but it really uncover real errors in the code.
I can help you with that but if I am not wrong my last PR with hints went to trash, so I dont want waste my time with sometime you dont want, need or merge. Please let me know.
Metadata
Metadata
Assignees
Labels
No labels