Skip to content

PHPStan 0.12.4 compatibility updates#2575

Merged
TomasVotruba merged 3 commits intorectorphp:masterfrom
ondrejmirtes:fixes
Jan 6, 2020
Merged

PHPStan 0.12.4 compatibility updates#2575
TomasVotruba merged 3 commits intorectorphp:masterfrom
ondrejmirtes:fixes

Conversation

@ondrejmirtes
Copy link
Copy Markdown
Contributor

No description provided.

@ondrejmirtes
Copy link
Copy Markdown
Contributor Author

There are still some failures which I don't what caused them.

@TomasVotruba
Copy link
Copy Markdown
Member

Wow, thanks a lot Ondřej!
You just save me lot of work, since I'd have to go through all the new commits on PHPStan.

I'll look at it after lunch.

@TomasVotruba
Copy link
Copy Markdown
Member

TomasVotruba commented Jan 6, 2020

The ECS is fail is related to coding standard. It can be fixed with:

composer fix-cs

Important thing is that test are passing ✔️
I'll merge it as it is and resolve it locally. Thank you!

@TomasVotruba TomasVotruba merged commit cba1064 into rectorphp:master Jan 6, 2020
@TomasVotruba
Copy link
Copy Markdown
Member

I made it work except compiling of phar.

https://travis-ci.org/rectorphp/rector/jobs/633198099#L569

image

Any idea what is causing it?

@ondrejmirtes
Copy link
Copy Markdown
Contributor Author

This class is prefixed in PHPStan's PHAR. Not sure where you're referring it?

@TomasVotruba
Copy link
Copy Markdown
Member

TomasVotruba commented Jan 6, 2020

It is not. phpstan.phar cannot be used inside rector.phar, so phpstan-src is used instead.

Seems like our prefixing of PHPStan config.neon didn't work for this services. Which is weird, because it worked for 0.12.3

@TomasVotruba
Copy link
Copy Markdown
Member

Any idea what has changed since 0.12.3 that might have influence this?

@ondrejmirtes
Copy link
Copy Markdown
Contributor Author

IMHO you should take phpstan.phar, extract it using box extract and use the contents to build your PHAR. Otherwise you'd have to reimplement the same prefixing logic to have truly scoped PHAR.

This is exactly what I'm talking about - at some point you probably took my file https://github.com/phpstan/phpstan-src/blob/master/compiler/build/scoper.inc.php and reused it. But I kept changing it, see the history: https://github.com/phpstan/phpstan-src/commits/master/compiler/build/scoper.inc.php

@ondrejmirtes ondrejmirtes deleted the fixes branch January 6, 2020 13:13
@TomasVotruba
Copy link
Copy Markdown
Member

That's it, thanks!

IMHO you should take phpstan.phar, extract it using box extract and use the contents to build your PHAR.

That might work. But it would add extra step of rewriting whole PHPStan code in Rector with current phpstan prefix. I can't imagine how I'd do that in saint way.
Also it's pretty WTF behavior for further debugging, pack, unpack, reuse some code, pack again...

It would be much easier to re-use PHPStan's scope.inc.php content.
I'll copy it for now and if that happens again, I might autoamte it.

@ondrejmirtes
Copy link
Copy Markdown
Contributor Author

That might work. But it would add extra step of rewriting whole PHPStan code in Rector with current phpstan prefix.

PHPStan\\ namespace itself isn't prefixed, and you shouldn't touch PHPStan's dependencies (you shoud make them your dependencies), so I think it should be fine.

@TomasVotruba
Copy link
Copy Markdown
Member

Ah, I forgot that 🤦‍♂️

I can't imagine where would I extract the PHPStan code and how I'd merge it with Rector code. Somewhere in vendor?

@ondrejmirtes
Copy link
Copy Markdown
Contributor Author

I don’t know, you’d have to experiment on that 😊 To have everything under vendor/phpstan/phpstan (including PHPStan’s dependencies) might work.

@TomasVotruba
Copy link
Copy Markdown
Member

So I'd have to include vendor/phpstan/phsptan/vendor/autoload.php? :D
That might go to another universe very quickly 😄

I won't have time to play with this, so I'll wait for future bugs to give me the motivation

TomasVotruba added a commit that referenced this pull request Jun 26, 2022
rectorphp/rector-src@59ed848 [TypeDeclaration] Add more precise array type doc (#2575)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants