PSR-0 轉換到 PSR-4

在「Send PSR-0 to the Standards Farm in the Sky」這篇文章裡作者大聲呼籲用 PSR-4 取代 PSR-0

不過 PSR-0 在 Packagist 上被廣泛使用:

As of some time a few months ago (...), of the 20,097 packages hosted on Composer, 15,668 of them use PSR-0.

PSR-0 的設計是考慮到 PHP 5.2 沒有 namespace 時所留下來的特性 (以底線為主的切割方式),在 PHP 5.5 都已經出版,而且 PHP 5.2 已經 EoL 的時候顯得有點多餘。

作者提議在 PSR-0 的文件開頭加上:

Deprecated - As of 2014-12-30 PSR-0 has been marked as deprecated. PSR-4 is now recommended as an alternative.

不過 PSR-0 的專案應該還是會跑很久?

Leave a Reply

Your email address will not be published. Required fields are marked *