开发者

Use lower-case constants for false, true, null in NetBeans

开发者 https://www.devze.com 2023-01-12 15:12 出处:网络
There is any way to set them in auto completion code in lowercase? Automatically they appear in UPPERCASE, I know t开发者_StackOverflow中文版hat constants are defined in UPPERCASE but I prefer lowerca

There is any way to set them in auto completion code in lowercase? Automatically they appear in UPPERCASE, I know t开发者_StackOverflow中文版hat constants are defined in UPPERCASE but I prefer lowercase for them.


I found the next in C:\Program Files\NetBeans 6.9.1\php\phpstubs\phpruntime\Core.php

define ('LOG_PERROR', 32);
define ('TRUE', true);
define ('FALSE', false);
define ('NULL', null);
define ('ZEND_THREAD_SAFE', false);
define ('ZEND_DEBUG_BUILD', false);

to

define ('LOG_PERROR', 32);
//define ('TRUE', true);
//define ('FALSE', false);
//define ('NULL', null);
define ('ZEND_THREAD_SAFE', false);
define ('ZEND_DEBUG_BUILD', false);

Comment some "define" and delete netbeans cache at: %USERS%.netbeans\6.9\var\cache\


Here's what I did when I wanted my auto complete to be PSR-2 compliant.

I am using NetBeans 7.3 and Windows 7.

Open this file in your text editor of choice: %USERPROFILE%\AppData\Roaming\NetBeans\7.3\phpstubs\phpruntime\Core.php

Search for this code:

define ('TRUE', true);
define ('FALSE', false);
define ('NULL', null);

If you don't care about auto complete, just comment out those 3 lines:

// define ('TRUE', true);
// define ('FALSE', false);
// define ('NULL', null);

If you want autocomplete to work and use lowercase, change the constants to lowercase:

define ('true', true);
define ('false', false);
define ('null', null);

Restart NetBeans and there you go.


If you want to follow PSR-2 coding style formatting for lowercase true, false and null constants in NetBeans 7.x/8.x at Ubuntu you need in: /home/user/netbeans-8.0/php/phpstubs/phpruntime/Core.php file (or at Windows in: C:\Program Files\NetBeans 8.0\php\phpstubs\phpruntime\Core.php) find next lines:

define ('TRUE', true);
define ('FALSE', false);
define ('NULL', null);

and change to:

define ('true', true);
define ('false', false);
define ('null', null);

Thereafter not necessary to restart your NetBeans, it must work straight. But if it not work, try to restart.

0

精彩评论

暂无评论...
验证码 换一张
取 消