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

Use stdClass when a microformat has no properties #172

Merged
merged 3 commits into from
Apr 28, 2018

Conversation

Zegnat
Copy link
Member

@Zegnat Zegnat commented Apr 28, 2018

Fixes #171. Test based on the issue included.

The class keyword was only introduced in PHP 5.5.
@aaronpk
Copy link
Member

aaronpk commented Apr 28, 2018

Does this match the behavior as described in the readme? https://github.com/indieweb/php-mf2#generating-output-for-json-serialization-with-json-mode See also this issue which looks like the same thing but for rels #29

@Zegnat
Copy link
Member Author

Zegnat commented Apr 28, 2018

Does this match the behavior as described in the readme?

Yes, I basically copied all the code from the rels case, so it makes sure to only overwrite the empty array with stdClass when JSON mode is enabled.

@Zegnat
Copy link
Member Author

Zegnat commented Apr 28, 2018

I’ll see if I can extend to test to also test without JSON-mode, so we are sure we aren’t breaking anything…

Make sure the change does not break the non-JSON version of the output.
@Zegnat
Copy link
Member Author

Zegnat commented Apr 28, 2018

Alright, the test now covers both versions of the properties output.

We expect to get a normal (but empty) PHP array back normally so it can be iterated, unless JSON-mode has been turned on in which case we need the ability to serialise to {}.

@aaronpk aaronpk merged commit ae49928 into microformats:master Apr 28, 2018
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 this pull request may close these issues.

2 participants