OCP class throws private exception
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 36.9k
- Forks
- 5.2k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 713
Description
Talk was catching it for a while but with the Psalm5 update it started complaining:
ERROR: UndefinedClass - lib/TInitialState.php:143:13 - Class, interface or enum named OC\User\NoUserException does not exist (see https://psalm.dev/019)
} catch (NoUserException $e) {
https://github.com/nextcloud/server/blob/44a8ebdc1fa796d4f7dc453c58561b64902ca12f/lib/public/Files/IRootFolder.php#L28
https://github.com/nextcloud/server/blob/44a8ebdc1fa796d4f7dc453c58561b64902ca12f/lib/public/Files/IRootFolder.php#L42
Also extending the non public Emitter is not too good, but I'm totally fine providing a stub for that. But the OC catch I don't want to "mock".
I guess we need to make a new class, but if that extends the private one Psalm will complain again...
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Psalm5 error at lib/TInitialState.php:143 and inspect the public exception declarations referenced in lib/public/Files/IRootFolder.php. Determine how the NoUserException catch can use a public class without extending the private exception, and account for the non-public Emitter concern. Done means the intended OCP classes are available without Psalm UndefinedClass errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100