- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 Visual Studio Code 和 Intelephense 处理一个 Symfony 4 项目。
Intelephense 得到的错误不是。有一些例子:
Undefined method 'uasort'.
// Collection creation of seasons used in the periods
$seasons = new ArrayCollection();
$sortedSeasons = new ArrayCollection();
//Search seasons used by periods
foreach ($advert->getPeriods() as $period)
{
$season = $period->getSeason();
if (! $seasons->contains($season))
{
$seasons->add($season);
}
}
// Sort seasons by ascending cost
$iterator = $seasons->getIterator();
$iterator->uasort(function ($a, $b) {
return $a->getCost() <=> $b->getCost();
});
另一个例子:
Undefined method 'getAdvertMinPrice'.
$minPrices = $this->getDoctrine()->getRepository(Price::class)->getAdvertMinPrice($advert);
但是,该方法存在于 PriceRepository 中:
<?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->createQueryBuilder('p')
->andWhere('p.price = (
SELECT MIN(p2.price)
FROM ' . $this->_entityName . ' p2
WHERE p2.advert = :val
)'
)
->setParameter('val', $advert)
->getQuery()
->getResult()
;
}
}
有价格命名空间:
<?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="App\Repository\advert\PriceRepository")
*
* @UniqueEntity(
* fields={"duration", "season"},
* message="A price already exists for this season and this duration."
* )
*/
class Price
{
以及我遇到问题的文件中的 use 命令:
<?php
namespace App\Controller\advert;
use App\Entity\backend\VAT;
use App\Entity\advert\Price;
我不明白问题出在哪里。我已经搜索了几天没有结果。
最佳答案
简单地重新加载窗口(VSCode)通常可以解决问题。无需重新安装扩展程序。
要重新加载 vscode 打开命令面板( F1
)并选择 Developer: Reload Window
.这相当于重新启动编辑器。
关于php - Visual Studio Code PHP Intelephense 收到错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59444350/
我正在使用 VScode (v1.56) 开发一个 PHP (v7.0.33) 项目。我最近安装了 VSCode 的扩展 Intelephense (v1.7.1) 并开始按照 Intelephens
我使用 Visual Studio Code 作为我的编辑器,使用 Intelephense 作为我的 PHP 格式化程序。它在大多数情况下运行良好,但 Intelephense 以多种方式更改了我的
这段代码触发了我的编辑器的错误提示: /** * Connect to database */ public function link() { global $config; mysql
Intelephense 显示错误,如“未知类型”和“未知函数”,但我不知道如何修复它们。 我的项目(一个 TYPO3 Composer 安装)有一个“公共(public)”文件夹,这就是为什么我通过
我在代码中使用 Memcached,它显示了这一点: error: "Undefined type 'Memcached'." 如何禁用此错误? 版本使用: VScode 1.41 PHP Intel
我正在使用 Visual Studio Code 和 Intelephense 处理一个 Symfony 4 项目。 Intelephense 得到的错误不是。有一些例子: Undefined met
在我今天得到的 PHP Intelephense 最新更新之后,intelephense 不断显示我的路线(以及其他类)的 undefined symbol 的错误,以前没有类似的错误,这让我很困扰。
我一直致力于学习laravel。我将 Homestead 与 virtualbox 结合使用 - 我的 IDE 是 vscode。在我的 IDE 中,我一直在无意义的事情下得到“问题线”......见
我试图用VSCode扩展Intelephense更好地完成,有些事情没有意义。下面是一些示例代码:。在滚动浏览所有全局符号和方法之后,我在$Client->getCatalogApi()上得到了完成。
获取预期类型“对象”。在 PHP MVC 项目中发现 'void'.intelephense(1006) 问题。我在此处附上了相关的代码和源代码(youtube)。如果有人能解释发生了什么,我们将不胜
获取预期类型“对象”。在 PHP MVC 项目中发现 'void'.intelephense(1006) 问题。我在此处附上了相关的代码和源代码(youtube)。如果有人能解释发生了什么,我们将不胜
我是一名优秀的程序员,十分优秀!