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

PhpInternalSourceLocator is not based on internal reflection anymore #470

Merged
merged 4 commits into from
May 14, 2019

Conversation

kukulich
Copy link
Collaborator

@kukulich kukulich commented May 8, 2019

No description provided.

@theofidry
Copy link
Contributor

Will give it a shot on PHP-Scoper tonight or tomorrow

@theofidry
Copy link
Contributor

Works good on my side, thanks a lot @kukulich. For reference, here is the PR: humbug/php-scoper#318

Copy link
Contributor

@theofidry theofidry left a comment

Choose a reason for hiding this comment

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

Reviewed and tested on Box with PHP-Scoper. 0 performance impact with the generated map 👌

Looking forward to see this released. Thanks a lot @kukulich for the work!

bin/generate-phpstorm-stubs-map.php Outdated Show resolved Hide resolved
bin/generate-phpstorm-stubs-map.php Outdated Show resolved Hide resolved
{
return new class($classReflection->getName()) extends NodeVisitorAbstract
return new class() extends NodeVisitorAbstract
Copy link
Contributor

Choose a reason for hiding this comment

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

One might say it's not BetterReflection but this piece is a deal-breaker currently for Box. Indeed since it is an anonymous class, this object cannot be serialized which is causing issues when leveraging parallelisation in Box. Would it be possible to move it to a dedicated class? If the API stability is a concern, it could be annotated with a @internal tag

Copy link
Member

Choose a reason for hiding this comment

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

Uhhh, that is private state of this particular object: why is this breaking Box?

@kukulich kukulich force-pushed the php-internal branch 2 times, most recently from 2617924 to d789e55 Compare May 13, 2019 21:36
src/SourceLocator/SourceStubber/PhpStormStubsMap.php Outdated Show resolved Hide resolved
bin/generate-phpstorm-stubs-map.php Outdated Show resolved Hide resolved
bin/generate-phpstorm-stubs-map.php Show resolved Hide resolved
bin/generate-phpstorm-stubs-map.php Outdated Show resolved Hide resolved
bin/generate-phpstorm-stubs-map.php Outdated Show resolved Hide resolved
bin/generate-phpstorm-stubs-map.php Outdated Show resolved Hide resolved
bin/generate-phpstorm-stubs-map.php Outdated Show resolved Hide resolved
{
return new class($classReflection->getName()) extends NodeVisitorAbstract
return new class() extends NodeVisitorAbstract
Copy link
Member

Choose a reason for hiding this comment

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

Uhhh, that is private state of this particular object: why is this breaking Box?

@theofidry
Copy link
Contributor

theofidry commented May 14, 2019 via email

@Ocramius
Copy link
Member

@theofidry that's a problem that may occur anywhere at any point in time for any of the API of BetterReflection: I don't think that should be discussed in this PR, but I'd also suggest that this should be spawned as an issue in Box itself first.

@theofidry
Copy link
Contributor

theofidry commented May 14, 2019 via email

@Ocramius
Copy link
Member

@theofidry the issue is that anonymous symbols (classes, closures) may be introduced at any time, even in patch releases.

Unless explicitly stated, services are not serializable, so there is an architectural issue there, which should not be solved in here.

@Ocramius Ocramius self-assigned this May 14, 2019
@Ocramius Ocramius added this to the 3.4.1 milestone May 14, 2019
@Ocramius Ocramius added bug and removed enhancement labels May 14, 2019
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.

Two minor comments, but otherwise 👍

bin/generate-phpstorm-stubs-map.php Outdated Show resolved Hide resolved
bin/generate-phpstorm-stubs-map.php Show resolved Hide resolved
@@ -154,6 +147,11 @@ private function assertSameClassAttributes(CoreReflectionClass $original, Reflec
$this->assertSameInterfaces($original, $stubbed);

foreach ($original->getMethods() as $method) {
// Needs fix in JetBrains/phpstorm-stubs
Copy link
Member

Choose a reason for hiding this comment

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

Can we make an issue out of this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Ouch xD

@Ocramius
Copy link
Member

Merging here.

@theofidry let's discuss a possible resolution for serialisation in a separate issue/PR

@Ocramius Ocramius merged commit 89795a1 into Roave:master May 14, 2019
@Ocramius
Copy link
Member

Thanks @kukulich!

@kukulich kukulich deleted the php-internal branch May 14, 2019 12:20
@Ocramius Ocramius modified the milestones: 3.4.1, 3.5.0 May 27, 2019
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants