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

chore(deps-dev): Bump phpstan/phpstan from 1.12.0 to 1.12.5 #2766

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 2 additions & 122 deletions .phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -11855,36 +11855,6 @@ parameters:
count: 1
path: engine/Shopware/Commands/DatabaseSetupCommand.php

-
message: "#^Method Shopware\\\\Commands\\\\FirstRunWizardDisableCommand\\:\\:configure\\(\\) has no return type specified\\.$#"
count: 1
path: engine/Shopware/Commands/FirstRunWizardDisableCommand.php

-
message: "#^Query error\\: Column \"s_core_config_values\\.element_id\" expects value type int, got type mixed$#"
count: 2
path: engine/Shopware/Commands/FirstRunWizardDisableCommand.php

-
message: "#^Query error\\: Column \"s_core_config_values\\.id\" expects value type int, got type mixed~0\\|0\\.0\\|''\\|'0'\\|array\\{\\}\\|false\\|null$#"
count: 1
path: engine/Shopware/Commands/FirstRunWizardDisableCommand.php

-
message: "#^Method Shopware\\\\Commands\\\\FirstRunWizardEnableCommand\\:\\:configure\\(\\) has no return type specified\\.$#"
count: 1
path: engine/Shopware/Commands/FirstRunWizardEnableCommand.php

-
message: "#^Query error\\: Column \"s_core_config_values\\.element_id\" expects value type int, got type mixed$#"
count: 2
path: engine/Shopware/Commands/FirstRunWizardEnableCommand.php

-
message: "#^Query error\\: Column \"s_core_config_values\\.id\" expects value type int, got type mixed~0\\|0\\.0\\|''\\|'0'\\|array\\{\\}\\|false\\|null$#"
count: 1
path: engine/Shopware/Commands/FirstRunWizardEnableCommand.php

-
message: "#^Method Shopware\\\\Commands\\\\GenerateAttributesCommand\\:\\:configure\\(\\) has no return type specified\\.$#"
count: 1
Expand Down Expand Up @@ -14125,11 +14095,6 @@ parameters:
count: 1
path: engine/Shopware/Components/Cart/CartPersistService.php

-
message: "#^Query error\\: Column \"s_order_basket\\.currencyFactor\" expects value type float\\|int, got type mixed~0\\|0\\.0\\|''\\|'0'\\|array\\{\\}\\|false\\|null$#"
count: 1
path: engine/Shopware/Components/Cart/ConditionalLineItemService.php

-
message: "#^Query error\\: Column \"s_order_basket\\.sessionID\" expects value type string\\|null, got type mixed$#"
count: 1
Expand Down Expand Up @@ -17955,51 +17920,16 @@ parameters:
count: 1
path: engine/Shopware/Components/Plugin/Configuration/ReaderInterface.php

-
message: "#^Method Shopware\\\\Components\\\\Plugin\\\\CronjobSynchronizer\\:\\:addCronjob\\(\\) has no return type specified\\.$#"
count: 1
path: engine/Shopware/Components/Plugin/CronjobSynchronizer.php

-
message: "#^Method Shopware\\\\Components\\\\Plugin\\\\CronjobSynchronizer\\:\\:addCronjob\\(\\) has parameter \\$cronjob with no value type specified in iterable type array\\.$#"
count: 1
path: engine/Shopware/Components/Plugin/CronjobSynchronizer.php

-
message: "#^Method Shopware\\\\Components\\\\Plugin\\\\CronjobSynchronizer\\:\\:removeNotExistingEntries\\(\\) has no return type specified\\.$#"
count: 1
path: engine/Shopware/Components/Plugin/CronjobSynchronizer.php

-
message: "#^Method Shopware\\\\Components\\\\Plugin\\\\CronjobSynchronizer\\:\\:removeNotExistingEntries\\(\\) has parameter \\$cronjobActions with no value type specified in iterable type array\\.$#"
count: 1
path: engine/Shopware/Components/Plugin/CronjobSynchronizer.php

-
message: "#^Method Shopware\\\\Components\\\\Plugin\\\\CronjobSynchronizer\\:\\:synchronize\\(\\) has no return type specified\\.$#"
count: 1
path: engine/Shopware/Components/Plugin/CronjobSynchronizer.php

-
message: "#^Method Shopware\\\\Components\\\\Plugin\\\\CronjobSynchronizer\\:\\:synchronize\\(\\) has parameter \\$cronjobs with no value type specified in iterable type array\\.$#"
count: 1
path: engine/Shopware/Components/Plugin/CronjobSynchronizer.php

-
message: "#^Query error\\: Argument \\#1 is not a constant array, got array\\<mixed~'active', mixed\\>&hasOffsetValue\\('pluginID', int\\)$#"
count: 1
path: engine/Shopware/Components/Plugin/CronjobSynchronizer.php

-
message: "#^Query error\\: Argument \\#1 is not a constant array, got hasOffsetValue\\('end', DateTime\\)&hasOffsetValue\\('next', DateTime\\)&hasOffsetValue\\('pluginID', int\\)&non\\-empty\\-array$#"
message: "#^Query error\\: Argument \\#1 is not a constant array, got array\\<string, mixed\\>&hasOffsetValue\\('pluginID', int\\)$#"
count: 1
path: engine/Shopware/Components/Plugin/CronjobSynchronizer.php

-
message: "#^Query error\\: Column \"s_crontab\\.id\" expects value type int, got type mixed~0\\|0\\.0\\|''\\|'0'\\|array\\{\\}\\|false\\|null$#"
message: "#^Query error\\: Argument \\#1 is not a constant array, got non-empty-array\\<string, mixed\\>&hasOffsetValue\\('end', DateTime\\)&hasOffsetValue\\('next', DateTime\\)&hasOffsetValue\\('pluginID', int\\)$#"
count: 1
path: engine/Shopware/Components/Plugin/CronjobSynchronizer.php

-
message: "#^Method Shopware\\\\Components\\\\Plugin\\\\DBALConfigReader\\:\\:getByPluginName\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
Expand Down Expand Up @@ -23875,56 +23805,6 @@ parameters:
count: 1
path: engine/Shopware/Controllers/Frontend/Compare.php

-
message: "#^Method Shopware_Controllers_Frontend_Forms\\:\\:_createInputElement\\(\\) has parameter \\$element with no value type specified in iterable type array\\.$#"
count: 1
path: engine/Shopware/Controllers/Frontend/Forms.php

-
message: "#^Method Shopware_Controllers_Frontend_Forms\\:\\:_createLabelElement\\(\\) has parameter \\$element with no value type specified in iterable type array\\.$#"
count: 1
path: engine/Shopware/Controllers/Frontend/Forms.php

-
message: "#^Method Shopware_Controllers_Frontend_Forms\\:\\:_validateInput\\(\\) has parameter \\$elements with no value type specified in iterable type array\\.$#"
count: 1
path: engine/Shopware/Controllers/Frontend/Forms.php

-
message: "#^Method Shopware_Controllers_Frontend_Forms\\:\\:_validateInput\\(\\) has parameter \\$inputs with no value type specified in iterable type array\\.$#"
count: 1
path: engine/Shopware/Controllers/Frontend/Forms.php

-
message: "#^Method Shopware_Controllers_Frontend_Forms\\:\\:_validateInput\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: engine/Shopware/Controllers/Frontend/Forms.php

-
message: "#^Method Shopware_Controllers_Frontend_Forms\\:\\:getContent\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: engine/Shopware/Controllers/Frontend/Forms.php

-
message: "#^Method Shopware_Controllers_Frontend_Forms\\:\\:translateForm\\(\\) has parameter \\$fields with no value type specified in iterable type array\\.$#"
count: 1
path: engine/Shopware/Controllers/Frontend/Forms.php

-
message: "#^Property Shopware_Controllers_Frontend_Forms\\:\\:\\$_elements type has no value type specified in iterable type array\\.$#"
count: 1
path: engine/Shopware/Controllers/Frontend/Forms.php

-
message: "#^Property Shopware_Controllers_Frontend_Forms\\:\\:\\$_errors type has no value type specified in iterable type array\\.$#"
count: 1
path: engine/Shopware/Controllers/Frontend/Forms.php

-
message: "#^Property Shopware_Controllers_Frontend_Forms\\:\\:\\$_postData type has no value type specified in iterable type array\\.$#"
count: 1
path: engine/Shopware/Controllers/Frontend/Forms.php

-
message: "#^Method Shopware_Controllers_Frontend_Index\\:\\:indexAction\\(\\) has no return type specified\\.$#"
count: 1
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
"friends-of-behat/mink-extension": "2.7.5",
"php-parallel-lint/php-var-dump-check": "^0.5",
"phpstan/extension-installer": "1.4.2",
"phpstan/phpstan": "1.12.0",
"phpstan/phpstan": "1.12.5",
"phpstan/phpstan-doctrine": "1.5.3",
"phpstan/phpstan-phpunit": "1.4.0",
"phpstan/phpstan-symfony": "1.4.9",
Expand Down
12 changes: 6 additions & 6 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,18 @@ public function completer(array $context, string $smartyCode): array

if (!empty($matches)) {
foreach ($matches as $match) {
if (!isset($match['arrayName'], $match['value'])) {
continue;
}

$value = $this->getValueFromPath($context, $match['arrayName']);

if ($value === null) {
continue;
}

if (\count($value)) {
$key = array_keys($value)[0];
$context[$match['value']] = $value[$key];
if (isset($match['key'])) {
$context[$match['key']] = $key;
}
$context[$match['key']] = $key;
} else {
$context[$match['value']] = [];
if (isset($match['key'])) {
$context[$match['key']] = 0;
}
$context[$match['key']] = 0;
}
}
}
Expand Down
14 changes: 9 additions & 5 deletions engine/Shopware/Commands/FirstRunWizardDisableCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,13 @@

namespace Shopware\Commands;

use RuntimeException;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class FirstRunWizardDisableCommand extends ShopwareCommand
{
/**
* {@inheritdoc}
*/
protected function configure()
protected function configure(): void
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this would be a breaking change, strictly speaking 😬

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mh, does someone extend commands? But probably as they are not internal, it might be a BC.

{
$this
->setName('sw:firstrunwizard:disable')
Expand All @@ -46,15 +44,21 @@ protected function execute(InputInterface $input, OutputInterface $output)
{
$conn = $this->container->get(\Doctrine\DBAL\Connection::class);
$elementId = $conn->fetchColumn('SELECT id FROM s_core_config_elements WHERE name LIKE "firstRunWizardEnabled"');
$elementId = is_numeric($elementId) ? (int) $elementId : 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't false be cast to 0 anyway?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is, that this version of doctrine returns mixed|false, therefore this check. But it probably should be replaced by fetchOne (which returns mixed|false as well).

if ($elementId <= 0) {
throw new RuntimeException('Cannot find config element `firstRunWizardEnabled`');
}

$valueid = $conn->fetchColumn('SELECT id FROM s_core_config_values WHERE element_id = :elementId', ['elementId' => $elementId]);
$valueid = is_numeric($valueid) ? (int) $valueid : 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above


$data = [
'element_id' => $elementId,
'shop_id' => 1,
'value' => serialize(false),
];

if ($valueid) {
if ($valueid > 0) {
$conn->update(
's_core_config_values',
$data,
Expand Down
14 changes: 9 additions & 5 deletions engine/Shopware/Commands/FirstRunWizardEnableCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,13 @@

namespace Shopware\Commands;

use RuntimeException;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class FirstRunWizardEnableCommand extends ShopwareCommand
{
/**
* {@inheritdoc}
*/
protected function configure()
protected function configure(): void
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

{
$this
->setName('sw:firstrunwizard:enable')
Expand All @@ -46,15 +44,21 @@ protected function execute(InputInterface $input, OutputInterface $output)
{
$conn = $this->container->get(\Doctrine\DBAL\Connection::class);
$elementId = $conn->fetchColumn('SELECT id FROM s_core_config_elements WHERE name LIKE "firstRunWizardEnabled"');
$elementId = is_numeric($elementId) ? (int) $elementId : 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

I see an abstraction potential here 😁

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, I was thinking about this as well, but then we would have inherited commands and I was not sure where to place them, and then I thought, okay maybe for phpstan cleanup, it is enough to adjust it twice :D

if ($elementId <= 0) {
throw new RuntimeException('Cannot find config element `firstRunWizardEnabled`');
}

$valueid = $conn->fetchColumn('SELECT id FROM s_core_config_values WHERE element_id = :elementId', ['elementId' => $elementId]);
$valueid = is_numeric($valueid) ? (int) $valueid : 0;

$data = [
'element_id' => $elementId,
'shop_id' => 1,
'value' => serialize(true),
];

if ($valueid) {
if ($valueid > 0) {
$conn->update(
's_core_config_values',
$data,
Expand Down
7 changes: 1 addition & 6 deletions engine/Shopware/Components/AddLinkHeaderSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
use Enlight_Event_EventArgs;
use Psr\Link\LinkProviderInterface;
use Symfony\Component\WebLink\HttpHeaderSerializer;
use Traversable;

class AddLinkHeaderSubscriber implements SubscriberInterface
{
Expand Down Expand Up @@ -88,11 +87,7 @@ public function onDispatchLoopShutdown(Enlight_Event_EventArgs $args): void
}

$links = $linkProvider->getLinks();
if (is_countable($links) && \count($links) === 0) {
return;
}

if ($links instanceof Traversable && iterator_count($links) === 0) {
if (is_countable($links) && \count($links) === 0 || iterator_count($links) === 0) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function __construct(

public function addConditionalLineItem(string $name, string $orderNumber, float $price, float $tax, int $mode): void
{
$currencyFactor = empty($this->system->sCurrency['factor']) ? 1 : $this->system->sCurrency['factor'];
$currencyFactor = empty($this->system->sCurrency['factor']) ? 1 : (float) $this->system->sCurrency['factor'];
$taxFree = empty($this->system->sUSERGROUPDATA['tax']) && !empty($this->system->sUSERGROUPDATA['id']);
$sessionId = $this->session->get('sessionId');

Expand Down
15 changes: 10 additions & 5 deletions engine/Shopware/Components/Plugin/CronjobSynchronizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ public function __construct(Connection $connection)
}

/**
* @param array<array<string, mixed>> $cronjobs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

really fancy would be an object shape annotation of the array 😇

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I will look into it, I still need to adjust the code, that the pipeline for php 7.4 still works :-)

*
* @throws InvalidArgumentException
*
* @return void
*/
public function synchronize(Plugin $plugin, array $cronjobs)
{
Expand All @@ -53,9 +57,9 @@ public function synchronize(Plugin $plugin, array $cronjobs)
}

/**
* @param array $cronjob
* @param array<string, mixed> $cronjob
*/
private function addCronjob(Plugin $plugin, $cronjob)
private function addCronjob(Plugin $plugin, $cronjob): void
{
$cronjob['pluginID'] = $plugin->getId();

Expand Down Expand Up @@ -84,7 +88,8 @@ private function addCronjob(Plugin $plugin, $cronjob)
$id = $this->connection->fetchColumn($selectStatement, $params);
}

if ($id) {
$id = is_numeric($id) ? (int) $id : 0;
if ($id !== 0) {
// Don't overwrite user cronjob state
unset($cronjob['active']);

Expand All @@ -97,9 +102,9 @@ private function addCronjob(Plugin $plugin, $cronjob)
}

/**
* @param int $pluginId
* @param array<string> $cronjobActions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param array<string> $cronjobActions
* @param list<string> $cronjobActions

*/
private function removeNotExistingEntries($pluginId, array $cronjobActions)
private function removeNotExistingEntries(int $pluginId, array $cronjobActions): void
{
$builder = $this->connection->createQueryBuilder();
$builder->delete('s_crontab');
Expand Down
Loading
Loading