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
Improve autoloading #50
Conversation
c9e64fd
to
2b7cd12
Compare
ping @ondrejmirtes WDYT? |
@shouze @tyx Thanks, I mostly like it. I have some questions/requests:
Other issues I found will be commented in the code. |
@@ -39,6 +40,11 @@ public function getAliases(): array | |||
|
|||
protected function execute(InputInterface $input, OutputInterface $output): int | |||
{ | |||
$autoloadFile = $input->getOption('autoload-file'); | |||
if ($autoloadFile && is_file($autoloadFile)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please write $autoloadFile !== null
.
if (!is_file($composerAutoloadFile)) { | ||
$composerAutoloadFile = __DIR__ . '/../../../autoload.php'; | ||
if (is_file($autoload = getcwd() . '/vendor/autoload.php')) { | ||
require $autoload; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
require_once
No it will not. In this case you should use the new option introduced by @lvht. Without, PHPStan will pop |
f8e0610
to
1555800
Compare
It will allow people to use phpstan globally just by adding their own autoload.php with the path they want inside.
1555800
to
96e1779
Compare
ping @ondrejmirtes is it ok to you now? |
This is how I changed the README: c867e71 |
I just get back one part of the @lvht work from #48 as I was going to do the same ^^
I also added another way to customize autoloading like behat does.
The idea is to use phpstan globally on our side