Skip to content
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

Closed
wants to merge 4 commits into from
Closed

Fix PHPStan and enable it in CI #257

wants to merge 4 commits into from

Conversation

vasilvestre
Copy link
Contributor

@vasilvestre vasilvestre commented Mar 28, 2021

Q A
Bug fix? no
New feature? no
BC breaks? no
Fixed tickets #255

Help wanted

  • There's some design issue with type, how should we handle this ?
  • phpstan/phpstan-symfony should fix command argument type problems but it do not

@@ -72,7 +72,7 @@ public function importAction(Request $request): RedirectResponse
}
$referer = $request->headers->get('referer');

return new RedirectResponse($referer);
return new RedirectResponse($referer ?? '');
Copy link
Contributor Author

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
Copy link
Contributor Author

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

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.

Copy link
Contributor Author

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 ?

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) {
Copy link
Contributor Author

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.

@vasilvestre vasilvestre closed this Oct 6, 2022
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