Skip to content

Commit

Permalink
Update to psalm 5
Browse files Browse the repository at this point in the history
  • Loading branch information
franmomu committed Feb 5, 2023
1 parent 88af62c commit 06d075f
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 10 deletions.
2 changes: 0 additions & 2 deletions CacheWarmer/PersistentCollectionCacheWarmer.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use Doctrine\ODM\MongoDB\Configuration;
use Doctrine\ODM\MongoDB\DocumentManager;
use Doctrine\ODM\MongoDB\Mapping\ClassMetadata;
use Doctrine\Persistence\ManagerRegistry;
use RuntimeException;
use Symfony\Component\DependencyInjection\ContainerInterface;
Expand Down Expand Up @@ -81,7 +80,6 @@ public function warmUp($cacheDir)
$collectionGenerator = $dm->getConfiguration()->getPersistentCollectionGenerator();
$classes = $dm->getMetadataFactory()->getAllMetadata();
foreach ($classes as $metadata) {
assert($metadata instanceof ClassMetadata);
foreach ($metadata->getAssociationNames() as $fieldName) {
$mapping = $metadata->getFieldMapping($fieldName);
if (empty($mapping['collectionClass']) || in_array($mapping['collectionClass'], $generated)) {
Expand Down
6 changes: 2 additions & 4 deletions Form/Type/DocumentType.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Doctrine\ODM\MongoDB\DocumentManager;
use Doctrine\Persistence\ObjectManager;
use InvalidArgumentException;
use ReturnTypeWillChange;
use Symfony\Bridge\Doctrine\Form\ChoiceList\EntityLoaderInterface;
use Symfony\Bridge\Doctrine\Form\Type\DoctrineType;
use Symfony\Component\OptionsResolver\Options;
Expand Down Expand Up @@ -67,9 +68,8 @@ public function configureOptions(OptionsResolver $resolver)
* @internal Symfony 2.8 compatibility
*
* @return string
*
* @inheritdoc
*/
#[ReturnTypeWillChange]
public function getBlockPrefix()
{
return 'document';
Expand All @@ -79,8 +79,6 @@ public function getBlockPrefix()
* @internal Symfony 2.7 compatibility
*
* @return string
*
* @inheritdoc
*/
public function getName()
{
Expand Down
4 changes: 4 additions & 0 deletions Repository/ServiceGridFSRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@
* parent::__construct($registry, YourDocument::class);
* }
* }
*
* @template TDocument of object
* @template-extends DefaultGridFSRepository<TDocument>
*/
class ServiceGridFSRepository extends DefaultGridFSRepository implements ServiceDocumentRepositoryInterface
{
/** @use ServiceRepositoryTrait<TDocument> */
use ServiceRepositoryTrait;
}
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@
"doctrine/coding-standard": "^11.0",
"doctrine/data-fixtures": "^1.3",
"phpunit/phpunit": "^9.5.5",
"psalm/plugin-symfony": "^3.0",
"psalm/plugin-symfony": "^5.0",
"squizlabs/php_codesniffer": "^3.5",
"symfony/form": "^4.3.3|^5.0|^6.0",
"symfony/phpunit-bridge": "^6.0",
"symfony/security-bundle": "^4.4|^5.3|^6.0",
"symfony/stopwatch": "^4.4|^5.3|^6.0",
"symfony/validator": "^4.4|^5.3|^6.0",
"symfony/yaml": "^4.3.3|^5.3|^6.0",
"vimeo/psalm": "^4.30"
"vimeo/psalm": "^5.6"
},
"suggest": {
"doctrine/data-fixtures": "Load data fixtures"
Expand Down
14 changes: 12 additions & 2 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.30.0@d0bc6e25d89f649e4f36a534f330f8bb4643dd69">
<files psalm-version="5.6.0@e784128902dfe01d489c4123d69918a9f3c1eac5">
<file src="Command/LoadDataFixturesDoctrineODMCommand.php">
<UndefinedInterfaceMethod occurrences="1">
<UndefinedInterfaceMethod>
<code>ask</code>
</UndefinedInterfaceMethod>
</file>
<file src="Command/TailCursorDoctrineODMCommand.php">
<InvalidReturnType>
<code>int</code>
</InvalidReturnType>
</file>
<file src="Tests/Form/Type/GuesserTestType.php">
<MissingTemplateParam>
<code>GuesserTestType</code>
</MissingTemplateParam>
</file>
</files>
2 changes: 2 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
errorBaseline="psalm-baseline.xml"
findUnusedBaselineEntry="true"
findUnusedCode="false"
>
<plugins>
<pluginClass class="Psalm\SymfonyPsalmPlugin\Plugin"/>
Expand Down

0 comments on commit 06d075f

Please sign in to comment.