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

[MAINTENANCE] Reorder keywords and abstract functions in AbstractDocument class #1079

Merged
merged 5 commits into from
Nov 7, 2023

Conversation

beatrycze-volk
Copy link
Collaborator

No description provided.

@beatrycze-volk
Copy link
Collaborator Author

It is necessary to trigger tests again as changes in the commit couldn't cause the failure.

@sebastian-meyer
Copy link
Member

Beware: The _get* methods in AbstractDocument, MetsDocument and IiifManifest are used by the magic getter method (see AbstractDocument->__get()! Renaming those methods means that a lot of protected class members are no longer accessible (which most likely causes the tests to fail).
On the other hand, simply changing the magic getter method would make a lot of purposely protected class members accessible as well. So we have to distinguish magic getter methods from "normal" getSomething() methods.

I understand that using a preceding underscore is deprecated and even disallowed by PSR-12 coding styles. I already discussed this issue with @frank-ulrich-weber. Maybe we can find some other unique prefix to use for those getter methods? Something like magicGetSomething()?

@sebastian-meyer sebastian-meyer added the 🛠 maintenance A task to keep the code up-to-date and manageable. label Nov 4, 2023
@beatrycze-volk
Copy link
Collaborator Author

Beware: The _get* methods in AbstractDocument, MetsDocument and IiifManifest are used by the magic getter method (see AbstractDocument->__get()! Renaming those methods means that a lot of protected class members are no longer accessible (which most likely causes the tests to fail). On the other hand, simply changing the magic getter method would make a lot of purposely protected class members accessible as well. So we have to distinguish magic getter methods from "normal" getSomething() methods.

I understand that using a preceding underscore is deprecated and even disallowed by PSR-12 coding styles. I already discussed this issue with @frank-ulrich-weber. Maybe we can find some other unique prefix to use for those getter methods? Something like magicGetSomething()?

I'm fine with reverting this last change if the Codacy rules are getting disabled. I'm also fine with rename to some other like proposed by you. So tell me which way you prefer and I will adjust this PR.

@sebastian-meyer
Copy link
Member

I think the best option would be to rename all _get* methods to magicGet* and change AbstractDocument->__get() accordingly. This way we'd fulfill all PSR-12 requirements checked by Codacy and still distinguish between magic and normal getter methods.

@beatrycze-volk
Copy link
Collaborator Author

Issues
======
+ Solved 72
- Added 1

Protected method name "AbstractDocument::magicGetCPid" is not in camel caps format

@sebastian-meyer
Copy link
Member

That's fine! I'll add an exception in the Codacy rules.

@sebastian-meyer sebastian-meyer merged commit dfdbabe into kitodo:master Nov 7, 2023
6 checks passed
@beatrycze-volk beatrycze-volk deleted the reorder branch November 7, 2023 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🛠 maintenance A task to keep the code up-to-date and manageable.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants