PQ Flush fails due to invalid return type
robertdeboer opened this issue · comments
Steps to reproduce:
- SSH into the Magento instance
- Run
./bin/magento scandipwa:pq:flush
Actual result
The command fails with the following error:
There is an error in /app/vendor/symfony/console/Command/Command.php at line: 301
Return value of "ScandiPWA\PersistedQuery\Console\Command\PersistedQueryFlushCommand\Interceptor::execute()" must be of the type int, "null"
Expected result
The command should finish and the success message display Persisted query caches flushed (redis + varnish)
Testing details
Screenshot/Screencast
The first command shows a patch applied, the second command is with no patch applied
Versions
- ScandiPWA: 6.2.2
- Magento: 2.4.6-p2
- PHP: 8.1
- OS: Any
Additional context
I was able to remove the error by applying the following patch file locally.
diff --git a/src/Console/Command/PersistedQueryFlushCommand.php b/src/Console/Command/PersistedQueryFlushCommand.php
--- a/src/Console/Command/PersistedQueryFlushCommand.php
+++ b/src/Console/Command/PersistedQueryFlushCommand.php (date 1694446502989)
@@ -56,6 +56,8 @@
if ($this->query->clean()) {
$output->writeln('Persisted query caches flushed (redis + varnish)');
}
+
+ return 1;
}
}