0

When run PHPStan for CakePHP3 app, Call to an undefined method errors always occurs in the lines using CakePHP3 Dynamic Finders

How do I remove errors like dynamic methods?

/**
 * @property \App\Model\Table\ArticlesTable $Articles
 */
class ArticlesController extends AppController
{
    public function view($slug = null)
    {
        $article = $this->Articles->findBySlug($slug)->firstOrFail();
        $this->set(compact('article'));
    }
------ ---------------------------------------------------------------------------- 
  Line   Controller/ArticlesController.php                                           
 ------ ---------------------------------------------------------------------------- 
  58     Call to an undefined method App\Model\Table\ArticlesTable::findBySlug().    
 ...

1 Answer 1

1

The concept of magic properties and methods is understood by PHPStan with the help of so-called class reflection extensions. See Docs for more details.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.