-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(psalm): Fix all @throws annotations and add missing ones #3270
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: provokateurin <kate@provokateurin.de>
Signed-off-by: provokateurin <kate@provokateurin.de>
Signed-off-by: provokateurin <kate@provokateurin.de>
Signed-off-by: provokateurin <kate@provokateurin.de>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kind of hate that Exception
is sometimes \Exception
and sometimes \OCP\DB\Exception
. I tend to never use Exception
because of that to make it clear when we throw the root one.
Also @throws
blocks should contain an explanation when the exceptions is thrown, except for self-explanatory ones like NoUserException
and InvalidArgumentException
.
And for all methods implementing an OCP interface they should not throw unless it’s permitted by the interface. But that does mean for some of them we should modify the interface instead.
For controllers I do not know the policy, are they allowed to throw, and which kind of exceptions/throwable is handled by Nextcloud core?
* @throws ContainerExceptionInterface | ||
* @throws Throwable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When does that throw Throwable? For me that should never be documented, Throwable which are not Exception are bugs to be fixed, not documented. Anything can throw a Throwable if you use it wrong.
Would also be good if those @throws
tag would include a description of when to expect a throw.
/** | ||
* @throws Exception | ||
* @throws RequestBuilderException | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be caught inside, this method is not documented as throwing in ICapability and should not throw.
use Symfony\Component\Console\Input\InputArgument; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
class Create extends Base { | ||
/** | ||
* @throws LogicException |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when? Add a description please
/** | ||
* @throws LogicException | ||
*/ | ||
public function __construct() { | ||
parent::__construct(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/** | |
* @throws LogicException | |
*/ | |
public function __construct() { | |
parent::__construct(); | |
} |
dead code
No description provided.