Skip to content
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

Inconsistent return type for \Sabre\DAVACL\PrincipalBackend\BackendInterface::findByUri #1370

Closed
come-nc opened this issue Nov 30, 2021 · 5 comments · Fixed by #1371
Closed

Comments

@come-nc
Copy link
Contributor

come-nc commented Nov 30, 2021

Hello,

See the docblock for this function:

    /**
     * Finds a principal by its URI.
     *
     * This method may receive any type of uri, but mailto: addresses will be
     * the most common.
     *
     * Implementation of this API is optional. It is currently used by the
     * CalDAV system to find principals based on their email addresses. If this
     * API is not implemented, some features may not work correctly.
     *
     * This method must return a relative principal path, or null, if the
     * principal was not found or you refuse to find it.
     *
     * @param string $uri
     * @param string $principalPrefix
     *
     * @return string
     */

The comment says that the function may return null, but then there is @return string instead of @return string|null.
We implement it as returning string|null and this triggers psalm errors in our CI.

@DeepDiver1975
Copy link
Member

As far as I can tell from implementing this interface as well: you should return and empty string instead of null.

@DeepDiver1975
Copy link
Member

  • This method must return a relative principal path, or null, if the
    • principal was not found or you refuse to find it.

doc wrong or annotation wrong? 🙈

@DeepDiver1975
Copy link
Member

ah - already taken care of: #1362

@come-nc
Copy link
Contributor Author

come-nc commented Nov 30, 2021

ah - already taken care of: #1362

In the abstract class, but not in the interface: https://github.com/sabre-io/dav/blob/master/lib/DAVACL/PrincipalBackend/BackendInterface.php#L115

@DeepDiver1975 DeepDiver1975 reopened this Nov 30, 2021
@DeepDiver1975
Copy link
Member

Feel free to submit a PR to address this - THX a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants