Skip to content

How to resolve static analysis error for QueryAdapter/AdapterInterface #62

Closed Answered by mustanggb
mustanggb asked this question in Q&A
Discussion options

You must be logged in to vote

Okay, might have found the answer, Psalm doesn't like templates being used in static functions: vimeo/psalm#7507 (comment)

So should be able to fix it with something like:

      /**
       * @param AdapterInterface<T> $adapter
+      * @psalm-param AdapterInterface<mixed> $adapter
       *
       * @return self<T>
       */
      public static function createForCurrentPageWithMaxPerPage(AdapterInterface $adapter, int $currentPage, int $maxPerPage): self
      {
          $pagerfanta = new self($adapter);
          $pagerfanta->setMaxPerPage($maxPerPage);
          $pagerfanta->setCurrentPage($currentPage);
  
          return $pagerfanta;
      }

If it's okay I created a pull request: Ba…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@mbabker
Comment options

@mustanggb
Comment options

@mustanggb
Comment options

Answer selected by mbabker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #61 on March 01, 2024 15:10.