-
Notifications
You must be signed in to change notification settings - Fork 83
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
Fix PHPStan and enable it in CI #257
Conversation
@@ -72,7 +72,7 @@ public function importAction(Request $request): RedirectResponse | |||
} | |||
$referer = $request->headers->get('referer'); | |||
|
|||
return new RedirectResponse($referer); | |||
return new RedirectResponse($referer ?? ''); |
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.
I'm really not sure about this one
reportUnmatchedIgnoredErrors: false | ||
checkMissingIterableValueType: false | ||
|
||
symfony: | ||
console_application_loader: src/FOSSyliusImportExportPlugin.php |
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.
@ondrejmirtes do you understand the error ? This seems related to phpstan/phpstan-symfony#46
Fatal error: Uncaught Error: Call to a member function all() on int in /home/ubuntu/projects/SyliusImportExportPlugin/vendor/phpstan/phpstan-symfony/src/Symfony/ConsoleApplicationResolver.php:56
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.
Yes, you're loading this file: https://github.com/FriendsOfSylius/SyliusImportExportPlugin/blob/master/src/FOSSyliusImportExportPlugin.php which isn't a script returning Application instance but just a file with a class that doesn't return anything.
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.
Yes, you're loading this file: https://github.com/FriendsOfSylius/SyliusImportExportPlugin/blob/master/src/FOSSyliusImportExportPlugin.php which isn't a script returning Application instance but just a file with a class that doesn't return anything.
In case of library, how should this be handled please ?
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.
You need a file that looks like this:
<?php
$app = new Application();
$app->add(new MyCommand());
return $app;
@@ -42,6 +42,12 @@ public function __construct( | |||
*/ | |||
public function setExportFile(string $filename): void | |||
{ | |||
if (null === $this->writer) { |
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.
JSONResource Exporter do not require this writer and just didn't called the parent construct (this one)
I modified a bit code and services but I'm not sure this is the best way to solve this.
Help wanted