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

Create CompareApi interface #54

Merged
merged 1 commit into from
Apr 28, 2018
Merged

Conversation

ntzm
Copy link
Contributor

@ntzm ntzm commented Apr 28, 2018

Closes #28

use function array_map;
use function sprintf;

class ClassComparator implements Comparator
Copy link
Member

Choose a reason for hiding this comment

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

Should be final now


class Comparator
interface Comparator
Copy link
Member

Choose a reason for hiding this comment

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

I think this should be named ApiComparator or such.

Copy link
Member

Choose a reason for hiding this comment

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

Since there's only a single method, what do you think of using __invoke and naming this CompareApi or such?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, I think it follows the rest of the classes nicely. What do you think about CompareClass naming? I'm not sure about it

$this->interfaceBasedComparisons = $interfaceBasedComparisons;
$this->traitBasedComparisons = $traitBasedComparisons;
}

/**
* @param ClassReflector $definedSymbols containing only defined symbols in the compared API
Copy link
Member

Choose a reason for hiding this comment

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

I think I messed up the description here. The idea is that $definedSymbols is the subset of symbols we want to check

Copy link
Member

Choose a reason for hiding this comment

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

The $newSourcesWithDependencies is also wrong - my C&P mistake, sorry :-\

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated, any better?

@ntzm ntzm force-pushed the comparator-interface branch from ab6b62d to 3cd9449 Compare April 28, 2018 14:48
@ntzm ntzm changed the title Create Comparator interface Create CompareApi interface Apr 28, 2018
@ntzm ntzm force-pushed the comparator-interface branch from 3cd9449 to 0d61716 Compare April 28, 2018 15:19
Copy link
Member

@Ocramius Ocramius left a comment

Choose a reason for hiding this comment

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

Besides the plural naming, this looks good now, thanks!

@@ -67,7 +67,7 @@ function (string $installationPath) use ($composerIo) : Installer {
},
$astLocator
),
new Comparator(
new CompareClass(
Copy link
Member

Choose a reason for hiding this comment

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

Probably want to use CompareClasses, since the API works with multiple classes (plural)

@ntzm ntzm force-pushed the comparator-interface branch from 0d61716 to daa10be Compare April 28, 2018 15:51
@Ocramius Ocramius added this to the 0.0.1 milestone Apr 28, 2018
Copy link
Member

@Ocramius Ocramius left a comment

Choose a reason for hiding this comment

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

Awesome, thanks 👍

@Ocramius Ocramius merged commit 519c828 into Roave:master Apr 28, 2018
@ntzm ntzm deleted the comparator-interface branch April 29, 2018 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants