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

add array support for metadata, fixes #4 #6

Merged
merged 7 commits into from
Nov 14, 2024

Conversation

tacman
Copy link
Contributor

@tacman tacman commented Nov 13, 2024

I updated the docs, attribute and tests.

It got me thinking, though, if null should be allowed as a valid metadata value.

Nonetheless, I think this fixes #4

@tacman
Copy link
Contributor Author

tacman commented Nov 13, 2024

I fixed the phpstan errors, except for one:

vendor/bin/phpstan

::error file=src/Metadata.php,line=22,col=0::Method Zenstruck\Metadata::__construct() has parameter $value with no value type specified in iterable type array.

final class Metadata
{
    public function __construct(
        /** @readonly */
        public string $key,

        /**
         * @readonly
         * @param string|bool|int|float|mixed value
         */
        public string|bool|int|float|array $value,
    ) {
    }

What should this be?

Copy link
Member

@kbond kbond left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I think my suggestions will fix phpstan.

It got me thinking, though, if null should be allowed as a valid metadata value.

Couldn't hurt but maybe wait until someone needs it.

src/Metadata.php Outdated Show resolved Hide resolved
src/Metadata.php Outdated Show resolved Hide resolved
src/Metadata.php Outdated Show resolved Hide resolved
src/Metadata/Map.php Outdated Show resolved Hide resolved
tacman and others added 4 commits November 14, 2024 06:17
Co-authored-by: Kevin Bond <[email protected]>
Co-authored-by: Kevin Bond <[email protected]>
Co-authored-by: Kevin Bond <[email protected]>
@kbond
Copy link
Member

kbond commented Nov 14, 2024

I'll take a look at fixing phpstan before merging.

@kbond
Copy link
Member

kbond commented Nov 14, 2024

Thanks @tacman!

@kbond kbond merged commit f270bf6 into zenstruck:1.x Nov 14, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

allow arrays in metadata
2 participants