Skip to content

Commit

Permalink
Update the PHPStan baseline (#7117)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-schranz authored Jul 6, 2023
1 parent a605afe commit ff0fc4f
Show file tree
Hide file tree
Showing 7 changed files with 146 additions and 68 deletions.
186 changes: 123 additions & 63 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -8151,7 +8151,7 @@ parameters:
path: src/Sulu/Bundle/ContactBundle/Contact/ContactManager.php

-
message: "#^Parameter \\#1 \\$contact of method Sulu\\\\Bundle\\\\ContactBundle\\\\Contact\\\\ContactManager\\:\\:getApiObject\\(\\) expects Sulu\\\\Bundle\\\\ContactBundle\\\\Entity\\\\ContactInterface, object given\\.$#"
message: "#^Parameter \\#1 \\$contact of method Sulu\\\\Bundle\\\\ContactBundle\\\\Contact\\\\ContactManager\\:\\:getApiObject\\(\\) expects Sulu\\\\Bundle\\\\ContactBundle\\\\Entity\\\\ContactInterface, mixed given\\.$#"
count: 1
path: src/Sulu/Bundle/ContactBundle/Contact/ContactManager.php

Expand Down Expand Up @@ -8195,6 +8195,11 @@ parameters:
count: 1
path: src/Sulu/Bundle/ContactBundle/Contact/ContactManager.php

-
message: "#^Parameter \\#2 \\$array of function array_map expects array, mixed given\\.$#"
count: 1
path: src/Sulu/Bundle/ContactBundle/Contact/ContactManager.php

-
message: "#^Parameter \\#2 \\$avatar of method Sulu\\\\Bundle\\\\ContactBundle\\\\Contact\\\\ContactManager\\:\\:setAvatar\\(\\) expects array, string\\|null given\\.$#"
count: 1
Expand Down Expand Up @@ -9596,7 +9601,7 @@ parameters:
path: src/Sulu/Bundle/ContactBundle/Entity/AccountRepository.php

-
message: "#^Method Sulu\\\\Bundle\\\\ContactBundle\\\\Entity\\\\AccountRepository\\:\\:findByFilters\\(\\) should return array\\<object\\> but returns mixed\\.$#"
message: "#^Method Sulu\\\\Bundle\\\\ContactBundle\\\\Entity\\\\AccountRepository\\:\\:findByFilters\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
count: 1
path: src/Sulu/Bundle/ContactBundle/Entity/AccountRepository.php

Expand Down Expand Up @@ -9895,6 +9900,11 @@ parameters:
count: 1
path: src/Sulu/Bundle/ContactBundle/Entity/ContactRepository.php

-
message: "#^Method Sulu\\\\Bundle\\\\ContactBundle\\\\Entity\\\\ContactRepository\\:\\:findByFilters\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
count: 1
path: src/Sulu/Bundle/ContactBundle/Entity/ContactRepository.php

-
message: "#^Method Sulu\\\\Bundle\\\\ContactBundle\\\\Entity\\\\ContactRepository\\:\\:findByFiltersIds\\(\\) has parameter \\$entityAlias with no type specified\\.$#"
count: 1
Expand Down Expand Up @@ -11495,11 +11505,6 @@ parameters:
count: 1
path: src/Sulu/Bundle/ContactBundle/Util/IndexComparator.php

-
message: "#^Parameter \\#2 \\$string2 of function strnatcmp expects string, int\\<0, max\\>\\|string given\\.$#"
count: 1
path: src/Sulu/Bundle/ContactBundle/Util/IndexComparator.php

-
message: "#^Method Sulu\\\\Bundle\\\\ContactBundle\\\\Util\\\\IndexComparatorInterface\\:\\:compare\\(\\) has parameter \\$a with no type specified\\.$#"
count: 1
Expand Down Expand Up @@ -16805,6 +16810,26 @@ parameters:
count: 1
path: src/Sulu/Bundle/MediaBundle/Entity/MediaDataProviderRepository.php

-
message: "#^Method Sulu\\\\Bundle\\\\MediaBundle\\\\Entity\\\\MediaDataProviderRepository\\:\\:parentFindByFilters\\(\\) has parameter \\$filters with no value type specified in iterable type array\\.$#"
count: 1
path: src/Sulu/Bundle/MediaBundle/Entity/MediaDataProviderRepository.php

-
message: "#^Method Sulu\\\\Bundle\\\\MediaBundle\\\\Entity\\\\MediaDataProviderRepository\\:\\:parentFindByFilters\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
count: 1
path: src/Sulu/Bundle/MediaBundle/Entity/MediaDataProviderRepository.php

-
message: "#^Parameter \\#1 \\$callback of function array_map expects \\(callable\\(mixed\\)\\: mixed\\)\\|null, Closure\\(Sulu\\\\Bundle\\\\MediaBundle\\\\Entity\\\\Media\\)\\: Sulu\\\\Bundle\\\\MediaBundle\\\\Api\\\\Media given\\.$#"
count: 1
path: src/Sulu/Bundle/MediaBundle/Entity/MediaDataProviderRepository.php

-
message: "#^Parameter \\#2 \\$array of function array_map expects array, mixed given\\.$#"
count: 1
path: src/Sulu/Bundle/MediaBundle/Entity/MediaDataProviderRepository.php

-
message: "#^Cannot access offset 1 on mixed\\.$#"
count: 1
Expand Down Expand Up @@ -17580,16 +17605,6 @@ parameters:
count: 1
path: src/Sulu/Bundle/MediaBundle/Media/ImageConverter/Focus/Focus.php

-
message: "#^Cannot call method layers\\(\\) on mixed\\.$#"
count: 1
path: src/Sulu/Bundle/MediaBundle/Media/ImageConverter/ImagineImageConverter.php

-
message: "#^Cannot clone non\\-object variable \\$layer of type mixed\\.$#"
count: 1
path: src/Sulu/Bundle/MediaBundle/Media/ImageConverter/ImagineImageConverter.php

-
message: "#^Empty catch block\\. If you are sure this is meant to be empty, please add a \"// @ignoreException\" comment in the catch block\\.$#"
count: 1
Expand Down Expand Up @@ -17660,11 +17675,6 @@ parameters:
count: 1
path: src/Sulu/Bundle/MediaBundle/Media/ImageConverter/ImagineImageConverter.php

-
message: "#^Method Sulu\\\\Bundle\\\\MediaBundle\\\\Media\\\\ImageConverter\\\\ImagineImageConverter\\:\\:modifyAllLayers\\(\\) should return Imagine\\\\Image\\\\ImageInterface but returns mixed\\.$#"
count: 1
path: src/Sulu/Bundle/MediaBundle/Media/ImageConverter/ImagineImageConverter.php

-
message: "#^Method Sulu\\\\Bundle\\\\MediaBundle\\\\Media\\\\ImageConverter\\\\MediaImageExtractorInterface\\:\\:extract\\(\\) invoked with 2 parameters, 1 required\\.$#"
count: 1
Expand Down Expand Up @@ -31325,11 +31335,6 @@ parameters:
count: 1
path: src/Sulu/Bundle/SecurityBundle/Controller/UserController.php

-
message: "#^Access to an undefined property object\\:\\:\\$nodeValue\\.$#"
count: 2
path: src/Sulu/Bundle/SecurityBundle/DataFixtures/ORM/LoadSecurityTypes.php

-
message: "#^Argument of an invalid type DOMNodeList\\<DOMNode\\>\\|false supplied for foreach, only iterables are supported\\.$#"
count: 1
Expand Down Expand Up @@ -43065,11 +43070,6 @@ parameters:
count: 1
path: src/Sulu/Component/Content/Document/Subscriber/WorkflowStageSubscriber.php

-
message: "#^Cannot call method setValue\\(\\) on mixed\\.$#"
count: 2
path: src/Sulu/Component/Content/Document/Subscriber/WorkflowStageSubscriber.php

-
message: "#^Method Sulu\\\\Component\\\\Content\\\\Document\\\\Subscriber\\\\WorkflowStageSubscriber\\:\\:setNodeWorkflowStageToTestForCopy\\(\\) has no return type specified\\.$#"
count: 1
Expand Down Expand Up @@ -44695,6 +44695,11 @@ parameters:
count: 1
path: src/Sulu/Component/Content/Metadata/ItemMetadata.php

-
message: "#^Argument of an invalid type DOMNamedNodeMap\\|null supplied for foreach, only iterables are supported\\.$#"
count: 2
path: src/Sulu/Component/Content/Metadata/Loader/AbstractLoader.php

-
message: "#^Argument of an invalid type DOMNodeList\\<DOMNode\\>\\|false supplied for foreach, only iterables are supported\\.$#"
count: 3
Expand All @@ -44705,6 +44710,11 @@ parameters:
count: 1
path: src/Sulu/Component/Content/Metadata/Loader/AbstractLoader.php

-
message: "#^Cannot access property \\$value on mixed\\.$#"
count: 4
path: src/Sulu/Component/Content/Metadata/Loader/AbstractLoader.php

-
message: "#^Cannot call method item\\(\\) on DOMNodeList\\<DOMNode\\>\\|false\\.$#"
count: 1
Expand Down Expand Up @@ -45035,6 +45045,11 @@ parameters:
count: 1
path: src/Sulu/Component/Content/Metadata/Parser/PropertiesXmlParser.php

-
message: "#^Cannot access property \\$value on mixed\\.$#"
count: 2
path: src/Sulu/Component/Content/Metadata/Parser/PropertiesXmlParser.php

-
message: "#^Cannot call method item\\(\\) on DOMNodeList\\<DOMNode\\>\\|false\\.$#"
count: 4
Expand Down Expand Up @@ -55772,7 +55787,7 @@ parameters:

-
message: "#^Parameter \\#2 \\$fieldNode of method Sulu\\\\Component\\\\Rest\\\\ListBuilder\\\\Metadata\\\\ListXmlLoader\\:\\:getField\\(\\) expects DOMElement, DOMNode given\\.$#"
count: 2
count: 4
path: src/Sulu/Component/Rest/ListBuilder/Metadata/ListXmlLoader.php

-
Expand All @@ -55785,6 +55800,11 @@ parameters:
count: 2
path: src/Sulu/Component/Rest/ListBuilder/Metadata/ListXmlLoader.php

-
message: "#^Parameter \\#2 \\$joinNode of method Sulu\\\\Component\\\\Rest\\\\ListBuilder\\\\Metadata\\\\ListXmlLoader\\:\\:getJoinMetadata\\(\\) expects DOMElement, DOMNode given\\.$#"
count: 1
path: src/Sulu/Component/Rest/ListBuilder/Metadata/ListXmlLoader.php

-
message: "#^Parameter \\#2 \\$joinsNode of method Sulu\\\\Component\\\\Rest\\\\ListBuilder\\\\Metadata\\\\ListXmlLoader\\:\\:getJoinsMetadata\\(\\) expects DOMElement, DOMNode\\|null given\\.$#"
count: 2
Expand Down Expand Up @@ -58366,37 +58386,12 @@ parameters:
path: src/Sulu/Component/SmartContent/Tests/Unit/Orm/DataProviderRepositoryTraitTest.php

-
message: "#^Method class@anonymous/src/Sulu/Component/SmartContent/Tests/Unit/Orm/DataProviderRepositoryTraitTest\\.php\\:103\\:\\:findByFilters\\(\\) has no return type specified\\.$#"
count: 1
path: src/Sulu/Component/SmartContent/Tests/Unit/Orm/DataProviderRepositoryTraitTest.php

-
message: "#^Method class@anonymous/src/Sulu/Component/SmartContent/Tests/Unit/Orm/DataProviderRepositoryTraitTest\\.php\\:103\\:\\:findByFilters\\(\\) has parameter \\$filters with no type specified\\.$#"
count: 1
path: src/Sulu/Component/SmartContent/Tests/Unit/Orm/DataProviderRepositoryTraitTest.php

-
message: "#^Method class@anonymous/src/Sulu/Component/SmartContent/Tests/Unit/Orm/DataProviderRepositoryTraitTest\\.php\\:103\\:\\:findByFilters\\(\\) has parameter \\$limit with no type specified\\.$#"
count: 1
path: src/Sulu/Component/SmartContent/Tests/Unit/Orm/DataProviderRepositoryTraitTest.php

-
message: "#^Method class@anonymous/src/Sulu/Component/SmartContent/Tests/Unit/Orm/DataProviderRepositoryTraitTest\\.php\\:103\\:\\:findByFilters\\(\\) has parameter \\$locale with no type specified\\.$#"
message: "#^Method class@anonymous/src/Sulu/Component/SmartContent/Tests/Unit/Orm/DataProviderRepositoryTraitTest\\.php\\:103\\:\\:findByFilters\\(\\) has parameter \\$filters with no value type specified in iterable type array\\.$#"
count: 1
path: src/Sulu/Component/SmartContent/Tests/Unit/Orm/DataProviderRepositoryTraitTest.php

-
message: "#^Method class@anonymous/src/Sulu/Component/SmartContent/Tests/Unit/Orm/DataProviderRepositoryTraitTest\\.php\\:103\\:\\:findByFilters\\(\\) has parameter \\$options with no type specified\\.$#"
count: 1
path: src/Sulu/Component/SmartContent/Tests/Unit/Orm/DataProviderRepositoryTraitTest.php

-
message: "#^Method class@anonymous/src/Sulu/Component/SmartContent/Tests/Unit/Orm/DataProviderRepositoryTraitTest\\.php\\:103\\:\\:findByFilters\\(\\) has parameter \\$page with no type specified\\.$#"
count: 1
path: src/Sulu/Component/SmartContent/Tests/Unit/Orm/DataProviderRepositoryTraitTest.php

-
message: "#^Method class@anonymous/src/Sulu/Component/SmartContent/Tests/Unit/Orm/DataProviderRepositoryTraitTest\\.php\\:103\\:\\:findByFilters\\(\\) has parameter \\$pageSize with no type specified\\.$#"
message: "#^Method class@anonymous/src/Sulu/Component/SmartContent/Tests/Unit/Orm/DataProviderRepositoryTraitTest\\.php\\:103\\:\\:findByFilters\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
count: 1
path: src/Sulu/Component/SmartContent/Tests/Unit/Orm/DataProviderRepositoryTraitTest.php

Expand Down Expand Up @@ -59602,12 +59597,12 @@ parameters:

-
message: "#^Cannot access property \\$nodeValue on DOMNode\\|null\\.$#"
count: 11
count: 13
path: src/Sulu/Component/Webspace/Loader/XmlFileLoader10.php

-
message: "#^Cannot call method getNamedItem\\(\\) on DOMNamedNodeMap\\|null\\.$#"
count: 8
count: 12
path: src/Sulu/Component/Webspace/Loader/XmlFileLoader10.php

-
Expand Down Expand Up @@ -59747,7 +59742,7 @@ parameters:

-
message: "#^Parameter \\#1 \\$localizationNode of method Sulu\\\\Component\\\\Webspace\\\\Loader\\\\XmlFileLoader10\\:\\:generateLocalizationFromNode\\(\\) expects DOMElement, DOMNode given\\.$#"
count: 1
count: 3
path: src/Sulu/Component/Webspace/Loader/XmlFileLoader10.php

-
Expand Down Expand Up @@ -59790,16 +59785,46 @@ parameters:
count: 1
path: src/Sulu/Component/Webspace/Loader/XmlFileLoader10.php

-
message: "#^Parameter \\#1 \\$template of class Sulu\\\\Component\\\\Webspace\\\\Loader\\\\Exception\\\\InvalidDefaultErrorTemplateException constructor expects string, string\\|null given\\.$#"
count: 1
path: src/Sulu/Component/Webspace/Loader/XmlFileLoader10.php

-
message: "#^Parameter \\#1 \\$template of class Sulu\\\\Component\\\\Webspace\\\\Loader\\\\Exception\\\\InvalidErrorTemplateException constructor expects string, string\\|null given\\.$#"
count: 1
path: src/Sulu/Component/Webspace/Loader/XmlFileLoader10.php

-
message: "#^Parameter \\#1 \\$type of method Sulu\\\\Component\\\\Webspace\\\\Environment\\:\\:setType\\(\\) expects string, string\\|null given\\.$#"
count: 1
path: src/Sulu/Component/Webspace/Loader/XmlFileLoader10.php

-
message: "#^Parameter \\#1 \\$type of method Sulu\\\\Component\\\\Webspace\\\\Webspace\\:\\:addDefaultTemplate\\(\\) expects string, string\\|null given\\.$#"
count: 1
path: src/Sulu/Component/Webspace/Loader/XmlFileLoader10.php

-
message: "#^Parameter \\#2 \\$code of class Sulu\\\\Component\\\\Webspace\\\\Exception\\\\InvalidWebspaceException constructor expects int, null given\\.$#"
count: 1
path: src/Sulu/Component/Webspace/Loader/XmlFileLoader10.php

-
message: "#^Parameter \\#2 \\$template of method Sulu\\\\Component\\\\Webspace\\\\Webspace\\:\\:addDefaultTemplate\\(\\) expects string, string\\|null given\\.$#"
count: 2
path: src/Sulu/Component/Webspace/Loader/XmlFileLoader10.php

-
message: "#^Parameter \\#2 \\$template of method Sulu\\\\Component\\\\Webspace\\\\Webspace\\:\\:addTemplate\\(\\) expects string, string\\|null given\\.$#"
count: 2
path: src/Sulu/Component/Webspace/Loader/XmlFileLoader10.php

-
message: "#^Parameter \\#2 \\$urlPattern of class Sulu\\\\Component\\\\Webspace\\\\Loader\\\\Exception\\\\InvalidUrlDefinitionException constructor expects string, string\\|null given\\.$#"
count: 1
path: src/Sulu/Component/Webspace/Loader/XmlFileLoader10.php

-
message: "#^Parameter \\#2 \\$webspace of class Sulu\\\\Component\\\\Webspace\\\\Loader\\\\Exception\\\\InvalidDefaultErrorTemplateException constructor expects int, string given\\.$#"
count: 1
Expand All @@ -59815,16 +59840,51 @@ parameters:
count: 3
path: src/Sulu/Component/Webspace/Loader/XmlFileLoader11.php

-
message: "#^Cannot access property \\$nodeValue on DOMNode\\|null\\.$#"
count: 2
path: src/Sulu/Component/Webspace/Loader/XmlFileLoader11.php

-
message: "#^Cannot call method getNamedItem\\(\\) on DOMNamedNodeMap\\|null\\.$#"
count: 2
path: src/Sulu/Component/Webspace/Loader/XmlFileLoader11.php

-
message: "#^Cannot call method item\\(\\) on DOMNodeList\\<DOMNode\\>\\|false\\.$#"
count: 1
path: src/Sulu/Component/Webspace/Loader/XmlFileLoader11.php

-
message: "#^Parameter \\#1 \\$excludedTemplate of method Sulu\\\\Component\\\\Webspace\\\\Webspace\\:\\:addExcludedTemplate\\(\\) expects string, string\\|null given\\.$#"
count: 1
path: src/Sulu/Component/Webspace/Loader/XmlFileLoader11.php

-
message: "#^Parameter \\#1 \\$resourceLocatorStrategy of method Sulu\\\\Component\\\\Webspace\\\\Webspace\\:\\:setResourceLocatorStrategy\\(\\) expects string, string\\|null given\\.$#"
count: 1
path: src/Sulu/Component/Webspace/Loader/XmlFileLoader11.php

-
message: "#^Parameter \\#1 \\$type of method Sulu\\\\Component\\\\Webspace\\\\Webspace\\:\\:addDefaultTemplate\\(\\) expects string, string\\|null given\\.$#"
count: 1
path: src/Sulu/Component/Webspace/Loader/XmlFileLoader11.php

-
message: "#^Parameter \\#1 \\$type of method Sulu\\\\Component\\\\Webspace\\\\Webspace\\:\\:addTemplate\\(\\) expects string, string\\|null given\\.$#"
count: 1
path: src/Sulu/Component/Webspace/Loader/XmlFileLoader11.php

-
message: "#^Parameter \\#2 \\$template of method Sulu\\\\Component\\\\Webspace\\\\Webspace\\:\\:addDefaultTemplate\\(\\) expects string, string\\|null given\\.$#"
count: 2
path: src/Sulu/Component/Webspace/Loader/XmlFileLoader11.php

-
message: "#^Parameter \\#2 \\$template of method Sulu\\\\Component\\\\Webspace\\\\Webspace\\:\\:addTemplate\\(\\) expects string, string\\|null given\\.$#"
count: 1
path: src/Sulu/Component/Webspace/Loader/XmlFileLoader11.php

-
message: "#^Method Sulu\\\\Component\\\\Webspace\\\\Manager\\\\Dumper\\\\PhpWebspaceCollectionDumper\\:\\:dump\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
count: 1
Expand Down
2 changes: 1 addition & 1 deletion src/Sulu/Bundle/ContactBundle/Util/IndexComparator.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ public function compare($a, $b, array $ids)
$indexA = ($index = \array_search($a, $ids)) > -1 ? $index : \PHP_INT_MAX;
$indexB = ($index = \array_search($b, $ids)) > -1 ? $index : \PHP_INT_MAX;

return \strnatcmp($indexA, $indexB);
return \strnatcmp((string) $indexA, (string) $indexB);
}
}
4 changes: 3 additions & 1 deletion src/Sulu/Bundle/DocumentManagerBundle/Session/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,9 @@ public function exportSystemView($absPath, $stream, $skipBinary, $noRecurse)
$xpath->registerNamespace('sv', 'http://www.jcp.org/jcr/sv/1.0');

foreach ($xpath->query('//sv:property[@sv:name="sulu:versions" or @sv:name="jcr:versionHistory" or @sv:name="jcr:baseVersion" or @sv:name="jcr:predecessors" or @sv:name="jcr:isCheckedOut"]') as $element) {
$element->parentNode->removeChild($element);
if ($element->parentNode) {
$element->parentNode->removeChild($element);
}
}

\fwrite($stream, $document->saveXML());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

/**
* Load security-types from xml to database.
*
* @deprecated
*/
class LoadSecurityTypes implements FixtureInterface, OrderedFixtureInterface, ContainerAwareInterface
{
Expand Down Expand Up @@ -59,6 +61,10 @@ public function load(ObjectManager $manager)
}
}

if (!$typeId || !$typeName) {
continue;
}

$securityType = (\array_key_exists($typeId, $present)) ? $present[$typeId] : new SecurityType();
$securityType->setId($typeId);
$securityType->setName($typeName);
Expand Down
Loading

0 comments on commit ff0fc4f

Please sign in to comment.