title: Visual Studio Code PHP Intelephense gets errors which aren't
body: <p>I'm working on a Symfony 4 project using Visual Studio Code with Intelephense.</p>
  <p>Intelephense gets errors which aren't. There are some examples:</p>
  <blockquote>
  <p>Undefined method 'uasort'.</p>
  </blockquote>
  <p>This error corresponding to this code:</p>
  <pre class="lang-php prettyprint-override"><code>// Collection creation of seasons used in the periods 
  $seasons = new ArrayCollection();
  $sortedSeasons = new ArrayCollection();
      
  //Search seasons used by periods
  foreach ($advert-&gt;getPeriods() as $period) 
  {
      $season = $period-&gt;getSeason();
      if (! $seasons-&gt;contains($season)) 
      {
          $seasons-&gt;add($season);
      }
  }
      
  // Sort seasons by ascending cost 
  $iterator = $seasons-&gt;getIterator();
  $iterator-&gt;uasort(function ($a, $b) {
      return $a-&gt;getCost() &lt;=&gt; $b-&gt;getCost();
  });
  </code></pre>
  <p>An other example:</p>
  <blockquote>
  <p>Undefined method 'getAdvertMinPrice'.</p>
  </blockquote>
  <pre class="lang-php prettyprint-override"><code>$minPrices = $this-&gt;getDoctrine()-&gt;getRepository(Price::class)-&gt;getAdvertMinPrice($advert);
  </code></pre>
  <p>However, the method exists in the PriceRepository:</p>
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  namespace App\Repository\advert;
  
  use App\Entity\advert\Price;
  use Symfony\Bridge\Doctrine\RegistryInterface;
  use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
      
  /**
   * @method Price|null find($id, $lockMode = null, $lockVersion = null)
   * @method Price|null findOneBy(array $criteria, array $orderBy = null)
   * @method Price[]    findAll()
   * @method Price[]    findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
   */
  class PriceRepository extends ServiceEntityRepository
  {
      public function __construct(RegistryInterface $registry)
      {
          parent::__construct($registry, Price::class);
      }
      
     /**
      * Get the minimum price from an advert
      *
      * @param [type] $advert
      * @return Price[]
      */ 
      public function getAdvertMinPrice($advert): array
      {
          return $this-&gt;createQueryBuilder('p')
              -&gt;andWhere('p.price = (
                              SELECT MIN(p2.price)
                              FROM ' . $this-&gt;_entityName . ' p2
                              WHERE p2.advert = :val
                          )'
                         )
              -&gt;setParameter('val', $advert)
              -&gt;getQuery()
              -&gt;getResult()
              ;
          }
      }
  </code></pre>
  <p>There is the Price name space:</p>
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  
  namespace App\Entity\advert;
  
  use App\Entity\advert\Advert;
  use App\Entity\advert\Period;
  use App\Entity\backend\Season;
  use App\Entity\backend\Duration;
  use Doctrine\ORM\Mapping as ORM;
  use Doctrine\Common\Collections\Collection;
  use Doctrine\Common\Collections\ArrayCollection;
  use Symfony\Component\Validator\Constraints as Assert;
  use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  
  /**
   * @ORM\Entity(repositoryClass=&quot;App\Repository\advert\PriceRepository&quot;)
   * 
   * @UniqueEntity(
   *     fields={&quot;duration&quot;, &quot;season&quot;},
   *     message=&quot;A price already exists for this season and this duration.&quot;
   * )
   */
  class Price
  {
  </code></pre>
  <p>And the use command in the file where I have the problem:</p>
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  
  namespace App\Controller\advert;
  
  use App\Entity\backend\VAT;
  use App\Entity\advert\Price;
  </code></pre>
  <p>I don't understand where is the problem. I have searched for days without result.</p>
  <p>Somebody would have an idea about this problem origin?</p>