phar-io/manifest

Be able to create an `Author` without email

Closed this issue · 0 comments

Context
Create a manifest from Composer data

Consider reading the Composer schema.
We will see that only the author's name of the package is required. Email is optional !

Current behaviour
Cannot create a valid PharIo\Manifest\Author object without a valid email address.

Expected behaviour
Be able to create a valid PharIo\Manifest\Author object without Email.

Script to reproduce issue

<?php

use PharIo\Manifest\Author;
use PharIo\Manifest\AuthorCollection;
use PharIo\Manifest\Email;

$authorsCollection = new AuthorCollection();
foreach ($composerJson['authors'] as $author) {
    $authorsCollection->add(
        new Author($author['name'], new Email('john.doe@example.com')),
    );
}