Skip to content

#42 Discover and load dependencies via composer only after having discovered all source symbols #48

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

Merged
merged 16 commits into from
Apr 26, 2018

Conversation

Ocramius
Copy link
Member

@Ocramius Ocramius commented Apr 25, 2018

Fixes #42
Fixes #47 (done it since I was touching composer.json anyway)

@Ocramius Ocramius added this to the 0.0.1 milestone Apr 25, 2018
Copy link
Member

@asgrim asgrim left a comment

Choose a reason for hiding this comment

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

Looks fine, just a couple of comments...

composer.json Outdated
@@ -21,7 +21,8 @@
"phpunit/phpunit": "^7.0",
"doctrine/coding-standard": "^4.0",
"squizlabs/php_codesniffer": "^3.2",
"phpstan/phpstan": "^0.9.2"
"phpstan/phpstan": "^0.9.2",
"roave/security-advisories": "dev-master"
Copy link
Member

Choose a reason for hiding this comment

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

👍


namespace Composer\Autoload;

class ComposerStaticInitaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
Copy link
Member

Choose a reason for hiding this comment

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

endless screaming 😆

public function compare(ClassReflector $oldApi, ClassReflector $newApi) : Changes
{
public function compare(
ClassReflector $definedApi,
Copy link
Member

Choose a reason for hiding this comment

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

Think this needs a comment; it's not immediately obvious why (it now looks like) we're now comparing three APIs...

Just something like:

$definedApi the original API without any dependencies used as a base
$oldApi the original API but with dependencies included to allow type analysis
$newApi the new API to compare against the old

Copy link
Member Author

Choose a reason for hiding this comment

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

I will likely rename the variables to something obnoxiously clear :-)

public function compare(
ClassReflector $definedApi,
ClassReflector $oldApi,
ClassReflector $newApi
Copy link
Member

Choose a reason for hiding this comment

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

Do we not need the $newApi without dependencies? At some point we may define adding a class as a warning or something, how would we determine this?

Copy link
Member Author

@Ocramius Ocramius Apr 26, 2018

Choose a reason for hiding this comment

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

No, we need it with dependencies.

$definedApi => old classes, no dependencies - only defined symbols
$oldApi => old classes with dependencies - needed to analyse inheritance, covariance and such
$newApi => new classes with dependencies - needed to analyse inheritance, covariance and such

To make it more simple: you can't do any operations on the ReflectionClass instances without having all the dependencies. Even a simple ReflectionClass#getParentClasses() call can lead to a crash.

@asgrim
Copy link
Member

asgrim commented Apr 26, 2018

Also needs a rebase 🥃

Ocramius added 15 commits April 26, 2018 13:37
…ser install` in it via the composer installer
…sses to actually reflect by first scanning for "known API"
…for reflected symbols after the defined symbols list is known
…otherwise PHPStan reports nullability issues
…otherwise PHPStan reports nullability issues
…ty of `ReflectionClass#getProperty()` results that were asserted upon
… `$oldApi`

We are reflecting on these in order:

 1. the existing classes (`$definedApi`)
 2. the old classes (`$oldApi`)
 3. The new classes (`$newApi`)
@Ocramius Ocramius force-pushed the feature/dependency-installation branch from f756850 to a46097e Compare April 26, 2018 11:49
@Ocramius
Copy link
Member Author

@asgrim rebased/fixed/etc - if you merge this I'll try focusing on bells and whistles this evening, to make this nice and shiny for 🚢

Copy link
Member

@asgrim asgrim left a comment

Choose a reason for hiding this comment

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

LGTM :shipit:

@asgrim asgrim merged commit 29b2021 into master Apr 26, 2018
@asgrim asgrim deleted the feature/dependency-installation branch April 26, 2018 12:20
uzibhalepu added a commit to uzibhalepu/BackwardCompatibilityCheck that referenced this pull request Aug 6, 2024
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