phpJoeMo Posted May 12, 2011 Share Posted May 12, 2011 Hi all, I have a function that is only used in the file it is declared in : /index.php /** * This function is used to display form messages. * * @param string $msg This explains login and session status . * * @access private * * @return string */ function pred($msg) { return "<p class='content' style='color:red;'> $msg</p>"; } I'm using netbeans 7.0 (which by the way rocks !!!!! ), and I don't want to be able to see the documentation in other files when I start typing something similar. I read at pear.net coding standards that the '@param private' can be used on class methods. Is there a way to make the documentation private to the file that the function is declared in? I'm simply trying not to flood other files in the project with needless function suggestions. Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/236279-php-comments-make-function-block-documentation-private-to-file/ Share on other sites More sharing options...
MadTechie Posted May 13, 2011 Share Posted May 13, 2011 the "@access private" is for the documentation only, however you can't make the global function private, your need to put it into a class first, if your having problems where you including that function too may times and are getting an error then you could do this if (!function_exists('pred')) { function pred($msg) { return "<p class='content' style='color:red;'> $msg</p>"; } } Quote Link to comment https://forums.phpfreaks.com/topic/236279-php-comments-make-function-block-documentation-private-to-file/#findComment-1214817 Share on other sites More sharing options...
phpJoeMo Posted May 13, 2011 Author Share Posted May 13, 2011 The issue isn't with re-declaration. I have a main file that includes the page content. Inside the individual page is where I declare this page - specific function. I simply don't want to see fund pred every time I start to type a function in my project IE preg_match. Maybe I'm just being picky, but check out the following tips I've uncovered on my quest to learn how to do this: ctrl + hover on any constant, class, method, function to see documentation click on it and you will be directed to the line of declaration, definition, or instantiation. ctrl + p on parameters to see full list for that function. Quote Link to comment https://forums.phpfreaks.com/topic/236279-php-comments-make-function-block-documentation-private-to-file/#findComment-1214828 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.