Skip to content

Commit

Permalink
Fix psalm
Browse files Browse the repository at this point in the history
  • Loading branch information
zonky2 committed Jan 18, 2023
1 parent c1713b7 commit 88bb85d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions .composer-require-checker.json
Expand Up @@ -9,6 +9,7 @@
"Contao\\ManagerPlugin\\Config\\ContainerBuilder",
"Contao\\ManagerPlugin\\Config\\ExtensionPluginInterface",
"Contao\\ManagerPlugin\\Dependency\\DependentPluginInterface",
"ContaoCommunityAlliance\\DcGeneral\\DC\\General",
"ContaoCommunityAlliance\\DcGeneral\\Contao\\Compatibility\\DcCompat",
"ContaoCommunityAlliance\\DcGeneral\\Contao\\Dca\\Palette\\LegacyPalettesParser",
"ContaoCommunityAlliance\\DcGeneral\\DataDefinition\\Definition\\DefaultPalettesDefinition",
Expand Down
16 changes: 10 additions & 6 deletions src/Listener/SubSelectPalettesListener.php
Expand Up @@ -3,7 +3,7 @@
/**
* This file is part of contao-community-alliance/meta-palettes.
*
* (c) 2015-2022 Contao Community Alliance.
* (c) 2015-2023 Contao Community Alliance.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -17,7 +17,7 @@
* @author Sven Baumann <baumann.sv@gmail.com>
* @author Ingolf Steinhardt <info@e-spin.de>
* @copyright 2013-2014 bit3 UG
* @copyright 2015-2022 Contao Community Alliance.
* @copyright 2015-2023 Contao Community Alliance.
* @license https://github.com/contao-community-alliance/meta-palettes/license LGPL-3.0-or-later
* @filesource
*/
Expand All @@ -34,6 +34,8 @@
use ContaoCommunityAlliance\DcGeneral\Data\ModelInterface;
use ContaoCommunityAlliance\MetaPalettes\MetaPalettes;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Exception;

use const E_USER_DEPRECATED;
use const E_USER_ERROR;

Expand Down Expand Up @@ -163,6 +165,8 @@ protected function triggerSubselectPaletteError($strTable, $strSelector, $arrPal
* @return mixed|null
*
* @SuppressWarnings(PHPMD.Superglobals)
*
* @throws Exception When error at schema manager.
*/
private function getValue($dataContainer, $strTable, $strSelector)
{
Expand Down Expand Up @@ -190,7 +194,7 @@ private function getValue($dataContainer, $strTable, $strSelector)

// or break, when unable to handle data container
if ($dataContainer instanceof DC_Table
&& $this->connection->getSchemaManager()->tablesExist([$dataContainer->table])
&& $this->connection->createSchemaManager()->tablesExist([$dataContainer->table])
) {
return $this->fetchValueFromDatabase($dataContainer, $strSelector);
}
Expand Down Expand Up @@ -322,6 +326,8 @@ private function applyPalette($strTable, $strSelector, $strPalette)
* @param string $strSelector Selector field name.
*
* @return mixed
*
* @throws Exception When query failed.
*/
private function fetchValueFromDatabase($dataContainer, $strSelector)
{
Expand All @@ -331,9 +337,7 @@ private function fetchValueFromDatabase($dataContainer, $strSelector)
->where('id=:value')
->setParameter('value', $dataContainer->id)
->setMaxResults(1)
->execute();

assert(! is_int($statement));
->executeQuery();

if ($statement->rowCount() === 0) {
return null;
Expand Down

0 comments on commit 88bb85d

Please sign in to comment.