Eclipse PHP 垃圾邮件自 2020-06 新版本以来的新警告 [英] Eclipse PHP spams new warnings since new 2020-06 version

查看:39
本文介绍了Eclipse PHP 垃圾邮件自 2020-06 新版本以来的新警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Eclipse 中开发了一个 PHP 项目.在更新到上一个版本(2020-06)之前,我曾经没有任何警告......自从我进行此更新后,它向我发送了两个警告.

I develop a PHP project in Eclipse. Before updating to last version (2020-06), I used to had no warnings... Since I made this update, it is spamming me with two warnings.

首先是关于类文件,例如 MyClass.inc.php 中定义的 MyClass:Eclipse 说我必须将我的文件命名为MyClass.php";或将我的班级命名为 MyClass.inc ... -__________- 但我想继续将它们命名为 MyClass.inc.php !!!

First is about class files, like MyClass defined in MyClass.inc.php : Eclipse says me I must name my file "MyClass.php" or name my class MyClass.inc ... -__________- But I want to continue naming them MyClass.inc.php !!!

第二个是关于命名空间...我不使用它们,Eclipse 告诉我 <<声明的命名空间"与预期的命名空间路径\文件夹"不匹配>>(路径\文件夹是这篇文章的一个例子).

Second is about namespaces... I don't use them, and Eclipse says me that << The declared namespace "" does not match the expected namespace "path\folder" >> (path\folder is an exemple for this post).

我使用 PHP 7.4...我尝试过过滤器,但它不能正常工作(可能是我的问题),而且我没有找到如何专门禁用此警告.

I use PHP 7.4... I tried filters, but it don't work correctly (may be my bad), and I do not find how to disable this warnings specificaly.

感谢您的帮助,如果它是一个错误,我希望一些更新可以修复它T_T

Thanks for helping, I hope some update will fix it it if it's a bug T_T

推荐答案

新的命名空间验证规则虽然有效,但很麻烦.我想命名空间与目录结构不完全匹配并没有什么不寻常或错误.我正在开发一个基于 mezzio 的应用程序,这是通常的情况,因为该框架使用 composer 进行自动加载.

The new namespace validation rule, although valid, is cumbersome. I guess it's nothing unusual or wrong to have namespaces which don't exactly match the directory structure. I am working on a mezzio-based application, where this is the usual case, since the framework uses composer for autoloading.

升级后,我的项目中没有 Eclipse 不会发出警告的文件,例如:声明的命名空间App\Middleware"与预期的命名空间project\src\App\src\Middleware"不匹配.

After the upgrade there is no file in my project where Eclipse wouldn't warn that, eg.: The declared namespace "App\Middleware" does not match the expected namespace "project\src\App\src\Middleware".

此警告陈述了事实,但无论如何,在我看来,这种情况应该成为警告的理由...

This warning states the truth but by any means this case should be a reason for a warning in my opinion...

似乎有一个选项可以更改报告的级别或将问题"静音.完全:

There seems to be an option which allows to change the reported level or to mute the "problem" completely:

Preferences->PHP->Validation->Error/Warnings: Unexpected namespace name

Preferences->PHP->Validation->Error/Warnings: Unexpected namespace name

这篇关于Eclipse PHP 垃圾邮件自 2020-06 新版本以来的新警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆