-
Notifications
You must be signed in to change notification settings - Fork 15
Installing along with extensions installs phpstan/phpstan as well #2
Comments
realated: fprochazka/phpstan-compiler#1 |
Extensions are an open problem right now, we've talked about this with @ondrejmirtes already. The phar has to include all the extensions (at least the official ones), to make sure they refer to the prefixed classes. But only the extensions - the extra dependencies, they should be part of your project already. My compiler already handles this case, but Ondra released it without it for now - the 0.7 was a big release already as is. |
@jiripudil Actually I think Also @fprochazka I tried to compile PHPStan with the extensions, but how do I activate them? I can't reference a |
@JanJakes this is needed: nette/di#153 |
You can try to load extensions with php phpstan.phar -a vendor/autoload.php
On Wed, 12 Jul 2017 at 17:05, Jan Škrášek ***@***.***> wrote:
@JanJakes <https://github.com/janjakes> this is needed: nette/di#153
<nette/di#153>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAGZuGMI6HGkXyEaROBPa6VJRcpjVS9nks5sNOCngaJpZM4NbMG_>
.
--
Ondřej Mirtes
|
You can! Read the readme for |
I replaced the I will probably try to turn off prefixing the |
FYI, the original compiler was meant to compile the PHAR with the extensions so you would only enable them, no additional installing. |
But that doesn’t work if you want to add other custom extensions, or
extensions that were released after the latest stable version. I’m now
trying to modify the compiler so that it doesn’t prefix PhpParser namespace.
On Sun, 12 Nov 2017 at 13:28, Filip Procházka ***@***.***> wrote:
FYI, the original compiler was meant to compile the PHAR *with the
extensions* so you would only enable them, no additional installing.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAGZuERAbINkpf-F9ccfXicIRYvuxnKcks5s1uRggaJpZM4NbMG_>
.
--
Ondřej Mirtes
|
I have good news! I just pushed a freshly compiled PHAR that should support installing along the extensions! So feel free to try it out: 5f02c1f How I verified that it works: {
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"phpstan/phpstan-shim":"^0.9",
"phpstan/phpstan-phpunit":"^0.9"
}
} results in this install log (I excluded PHPUnit dependencies):
So no With this phpstan.neon:
And this <?php
class TestCase extends \PHPUnit\Framework\TestCase
{
public function testFoo()
{
$mock = $this->createMock(Foo::class);
$mock->doFoo();
}
}
class Foo
{
} Running:
Results in:
As you can see, the type I urge everyone in this conversation to test out latest |
I've tried it with |
Thanks to everyone who tested it, seems it works. After 0.9 is out, I plan to automate this, having phpstan-shim dev-master built after every successful Travis build of the main repo + testing in the build whether it still works. |
What is the problem
provide
doesn't work as expected. Consider this:It installs both
phpstan-shim
andphpstan
. As a result, the bundled code only loads theapplication's autoloader from cwd, which, obviously, fails to load the prefixed classes.
What seems to be the cause
Looking at the docs,
provide
section talks about virtual packages, which would explain why there is one calledphpstan/phpstan
on packagist:However, Composer seems to install the real package of the same name.
What could be the solution
Maybe
replace
would do the trick instead ofprovide
?The text was updated successfully, but these errors were encountered: