Skip to content
This repository has been archived by the owner on Nov 29, 2020. It is now read-only.

Not bundled extensions #1

Open
fprochazka opened this issue May 11, 2017 · 6 comments
Open

Not bundled extensions #1

fprochazka opened this issue May 11, 2017 · 6 comments

Comments

@fprochazka
Copy link
Owner

fprochazka commented May 11, 2017

The phar should include some "aliasing autoloader", that would alias prefixed classes back to their original, when the project doesn't have the dependency installed. This has to be really carefully done, with checking the project's autoloader instance, to not create the original problem, that this compiler aims to solve.

For example somebody installs a custom extension, that is not bundled (and therefore it doesn't contain prefixed PhpParser references) - it should still work. Now it wouldn't, because the runtime only contains the prefixed classes and the extesion wont.

@ondrejmirtes
Copy link

I solved this by turning off prefixing for PhpParser which is a fine solution because the prefixing won't be needed in the foreseeable future thanks to static reflection. For now, I think it's fine.

I plan to create a repo at phpstan organization so I will ask you after I'm done to update your README and probably archive this version of the repository.

@gnutix
Copy link

gnutix commented Nov 6, 2019

@ondrejmirtes what's the status on your latest comment ? Have solutions changed in the meantime around this issue ? (I'm facing the same one in Rector and investigating it)

@ondrejmirtes
Copy link

This is a totally obsolete thread and even the whole repository. PHPStan compiler lived at phpstan/phpstan-compiler for a while and is now inside phpstan/phpstan-src. Built from the ground up using humbug/box and humbug/php-scoper.

You can use the PHAR version of PHPStan with phpstan/phpstan-shim package, PHPStan extensions are fully compatible with it.

With PHPStan 0.12 released later this year, phpstan/phpstan will be distributed by PHAR for everyone.

@enumag
Copy link

enumag commented Nov 6, 2019

With PHPStan 0.12 released later this year, phpstan/phpstan will be distributed by PHAR for everyone.

What are the reasons behind that? It's very useful for me to sometimes open phpstan's source code to either see how it works or mess around with it occasionally to check if I can easily fix the bug I encounter (usually resulting in a bugfix PR for you). If composer installs a PHAR instead, it will be much more difficult for me to contribute.

@ondrejmirtes
Copy link

Basically the main reason is that the latest version will be usable by more people, not creating conflicts in Composer. It was discussed here: phpstan/phpstan#2074

@ondrejmirtes
Copy link

Since contributing always requires to create a small reproducing example and write a test, you should do it independently in phpstan-src directory on your hard drive. If you want to try your changes before submitting them as PR, you can compile your own PHAR and copy it over the officially installed one in the project where you use PHPStan, and run it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants