0

How can I tell PHPStorm that this required file is part of a class?

Hello all!

I am trying to build a PHP Framework and I have a View object that receives what I call "chunks".

These chunks are php view files that, when rendering is needed, the View class "requires" and therefore prints.

These php chunk files uses View methods.

Problem? PHPStorm does not know what I am talking about when I call a View method from these chunks.

How I could tell PHPStorm that a file us part of a class?

I will explain myself better with examples.

(Code has been simplified for easier understanding)
view.php
    public function printChunk($name)
    {   
        require _ROOT_ . "application/views/{$this->_chunks[$name]}.php";
    }

An example Chunk.
index.php
<h1>Hello, this is a chunk. </h1>
<?php $this->printChunk('header'); ?>

2 comments

Please sign in to leave a comment.