Disable Undefined Property error in PHP Devsense extension on VSCode - php

I just added the PHP extension by Devsense to my VSCode and now it's lighting up like a Christmas tree. I want to disable the Intellisense option for unknown/undefined properties.
Here is the issue
and the error message
Undefined property: MY_Model::$load PHP(PHP0416)
And a link to the post where they talk about adding it
I saw some options for Intelliphense where you could set "intelephense.diagnostics.undefinedProperties": false
in the vscode settings.json, but I couldn't find anything that would work for this extension.
The fix described here in the 3rd post to add the property in a comment does work, but is not feasible in the codebases I am working in. I need something more like the second post, where I can just disable the check altogether

I found the answer to my own question. Leaving it here because It took me way too long.
You just have to exclude the error code, in this case error code 0416

1 - Open Settings.json : ctrl + shift + P and type 'settings.json'
2 - Select 'Open User Settings (JSON)
3 - At the end of file, add this code:
"php.problems.exclude" : {
"/" : [416],
"vendor/" : true,
}

Related

How do I disable parameter hints in Vscode [duplicate]

How can I disable the default tooltip hint message in VSCode? It's annoying sometimes.
editor.hover.enabled: false in settings.json to Tooltip
Click on Edit in settings.json
There are two panes
Default User Settings
"editor.quickSuggestions": {
"other": false,
"comments": false,
"strings": false
}
User Settings
"editor.parameterHints.enabled": false,
"editor.suggest.snippetsPreventQuickSuggestions": false,
"html.suggest.html5": false,
"editor.snippetSuggestions": "none",
This also can be done UI.
Setting Snippet Suggestions : false
Update August 2018 (version 1.27)
Goto File=>Preference=>Settings
Text Editor => Suggestions
Click on Edit in settings.json
"editor.parameterHints.enabled": false,
"editor.suggest.snippetsPreventQuickSuggestions": false,
"html.suggest.html5": false,
Update your suggest options and save.
Before August 2018
Goto File=>Preference=>User Settings
You will find settings.json
// Configures if the built-in HTML language support suggests Angular tags and properties.
"html.suggest.angular1": false,
"html.suggest.ionic": false,
"html.suggest.html5": false,
Just find your language and set suggest = false
Update
Setting to turn off ALL popups
"editor.parameterHints": false
"editor.hover.enabled": false,
is your bulletproof solution. Then you can use CTLR + K, CTLR + I.
To hide those hints you can just add "editor.parameterHints": false to your settings.json. Found the answer in here.
I find using a larger value for Editor > Hover: Delay (search for "delay" in the settings search bar) does the trick for me. Its default is 300ms. This doesn't address the desire to actually eliminate the tooltips, but having them only appear after, say, 2 seconds, reduces the visual clutter quite a bit for me.
On version 1.27.2, I found that only this parameter disabled all the tooltips: "editor.hover.enabled": false.
I'm using Visual Studio Code v1.63.0 and in Settings I searched for "hover" and, among other things, found "Editor > Hover: Delay" and "Editor > Hover: Enabled". Unchecking the latter will disable the hover. However, I personally find them useful but they're displayed too quickly so I increased ""Editor > Hover: Delay" from "300" to "5000"
Simple way that no one here has mentioned: Code → Preferences → Settings. Search for "hover". Uncheck the checkbox where it says "Editor > Hover: Enabled".
Cntrl + shift + P -> Prefences: Open Settings (JSON)
"editor.parameterHints": false,
"editor.hover.enabled": false
i had to do both of these.
Here's the noob version, assuming you know little about VS Code (like me).
Windows.
VS Code version: 1.37.1
While in VS Code:
press F1 then type "settings" or "preferences" - then click "Preferences: Open User Settings"
- or -
from top menu: File>Preferences>Settings
- or -
hotkey: ctrl+,
in the settings pane, type "hover" (no need to press "enter")
the settings pane should display the hover settings immediately
Uncheck "Editor › Hover: Enabled"
hover disable
Rockstar Version: edit the JSON like a balla
F1 then type "Open Settings (JSON)"
-or-
navigate to settings JSON file and open in VS Code
https://code.visualstudio.com/docs/getstarted/settings#_settings-file-locations
Add this to JSON file (within curly braces, INCLUDE quotes): "editor.hover.enabled": false
Note: each line needs a comma after it. If you add to top, put a comma after this line. If you add to bottom, add a comma after the previous line.
Don't forget to save!
what JSON looks like
If you're new to coding, those tooltips can come in handy. You may want instead to just DELAY their appearance as Logan suggested.
click here: https://stackoverflow.com/a/53512394/8623576
or simply scroll up! :)
Note: I appreciate others have posted almost the EXACT same answer but, as I mentioned, this is the NOOB version that assumes the user has little/no experience with VS Code.
for Versions 1.31+ this one line did it for me:
"editor.parameterHints.enabled": false
Go to the settings gear wheel in the bottom left hand corner, then go to Settings and search "hover". Uncheck the "Controls whether the hover is shown" box.
Arrrg!!!
Hope this helps others. Running with v1.72.1. For the life of me was trying all the different settings, options, suggesting and couldn't get the tooltip help disabled... Coffee might have been my solution, finally noticed in the tooltip window there is an 'x' in the upper right corner for a close, clicking it. WOW! It worked and seems to have persisted my desire to dismiss them. I wanted them gone.... Perfect!!! Thinking about it, don't see a way to get them back if someone might actually want them back. VS Code is nice for a lot of stuff, but pretty bad for some of it's design and usability...
If you are not looking for disable and as mentioned by user: Darrell Brogdon above, if you want to delay the hover time of tooltip as solution then simply add the below line in user settings with your desired time value.
replace value 3000 as per your need.
Note: hover settings are moved in Online Services Settings in newer versions, hence you might not be able to find it with search 'hover' in user settings.
// modify in Preferences --> Settings or settings.json
"editor.hover.delay": 3000,

PHP Storm Magic Method Access Error on persistence->parameters

When i code phalcon with phpstorm i have one particular error i cannot figure out how to resolve. I like to see the green check at the top of each page to indicate there are no issues but this error is preventing the green checkmark shown.
So this is what causes the error:
$this->persistent->parameters = null;
How can i alter that code to prevent the PHP Storm error:
Field accessed via magic method
I know its a bit picky but would love to solve this
Use #property PhpDoc construction. Example:
It's also gives autocomplete to magic properties. Always use all available inspections.
Uncheck "Notify about access to a field via magic method".
You can find this setting under Project Settings -> Inspections -> PHP -> Undefined -> Undefined field.
You can try to download the framework code from the devtoolos on Github and Include it in PHP Storm. You can either add it as library dependency or simple paste it in the file explorer of your project.
https://github.com/phalcon/phalcon-devtools/tree/master/ide/2.0.7/Phalcon
It should have all the required PHP Doc

CodeIntel with PHP in Sublime Text 2 not working

I am trying for 2 hours now to get SublimeCodeIntel working with PHP. Well, some things work, but CodeIntel doesnt autocomplete class methods and parameters when outside of the class.
I use Sublim Text 2 for Windows (7) and the last version of the plugin.
I have a class Page in classes/Page.php, and a index.php.
In index.php:
$page = new Page('home',$_GET['page']);
And when I type
$page->
I can read in taskbar "Info: processing 'PHP': Please Wait" for a few seconds and then nothing happens.
When working in Page.php, I can start typing $this->.. and it somewhat works (actually it doesnt show functions parameters).
Same with Alt+clicking on functions and variables (only works if they are defined in the current file)
I tried several things:
1/ Deactivating "detect_slow_plugins" (error message doesn't appear anymore, but the plugin is not working better)
2/ Changing SublimeCodeIntel.sublime-settings config (copy paste the whole file and editing values):
"codeintel_language_settings": {
"PHP": {
"php": "E:/wamp/bin/apache/Apache2.2.21/bin",
"codeintel_scan_extra_dir": [],
"codeintel_scan_files_in_project": true,
"codeintel_max_recursive_dir_depth": 15
}
}
I don't even know if the "php" value is important (I found several snippets on the internet)...
3/ Same thing in Sublim Text User settings
4/ Re-building indexes as advised here
I use an PHP autoloader and I don't get how the plugin knows for sure which file defines which class. Could be an issue ?
I am completely stuck here, I tried everything I found, and read some setup tutorials (each one of them being something like "install and it just works!"... very annoying).
Does anyone have a solution? Or something to check, or try...
Thanks!

I have an undefined variable, but i don't know why

This is the code i have problem with: http://tutsforweb.blogspot.hu/2012/02/php-installation-script.html
Notice: Undefined variable: pre_error in C:\wamp\www\torolni\install.php
on line 110 Call Stack #TimeMemoryFunctionLocation
10.0022297152{main}( )..\install.php:0 20.0022297824step_2( )..\install.php:13
I have the same problem,as the first commenter, but i don't know how to "close Notice message in your php ini file". What is that? Where can i find it? I use WAMP. Could it be a problem in a "real" server? (Not in localhost)
I can't go to the 3rd step because of the error. Help me please.
They are suggesting to not display PHP notices, but I think it is bad advice because instead of fixing possible code problems that method just hides the message. Fixing the probem would be to initiate the variable:
function step_2(){
$pre_error = '';
//...
}
Let me start off by saying turning off notices to hide your PHP errors is not very good practice at all!
Looking at the error, you cannot echo a non-existent variable. $pre_error is not defined in the case where things work correctly. You can declare this at the start of 'Step 2'.
function step_2(){
$pre_error = '';
if....
It would also be a good idea to update the conditionals in the if statements so that you check the array key exists before testing it's value.
E.g. && $_POST['pre_error'] != '' should change to && (isset($_POST['pre_error']) && $_POST['pre_error'] != '')
Click on your WAMP icon in the taskbar > PHP > php.ini. This will bring you to the text file that sets up your basic PHP behaviors. You can customize those behaviors by following this reference: http://www.php.net/manual/en/function.error-reporting.php
Also, please don't make a PHP installation script. All sorts of security issues will rear their ugly head, especially if you're not using secure FTP over SSL.
To find your php.ini file:
Option 1: Navigate to the corresponding folder on your computer and open the php.ini file with notepad. on mine it is specifically C:\wamp\bin\apache\Apache2.2.17\bin (Your exact location and version of php may be slightly different.
Option 2
Click on the wamp icon in your system tray->PHP->php.ini
In notepad hit ctrl+f and search for display_errors = On. set this to display_errors = Off
Restart your wamp server and the notice should no longer be displayed
This is a very poor fix however as others have mentioned. I would also recommend you turn them back on when you are finished with that tutorials as displaying errors is invaluable when developing.

Does FirePhp work well with FireBug 1.12.0?

I used firephp in my project well before yesterday.
After I upgrade Firefox to version 23.0.1 , the FireBug extension is upgraded to version 1.12.0 automatically, and I find firephp do not show the detail data in the console.
It still shows the brief data. I can not unfold it to see the detail.
I guess firebug changed the data structure, and the firephp need to be upgrade.
If you are impatient type you can do a quick fix yourself.
Open the FireBug xpi file with your favourite archive/zip manager. For linux users, you should find the file here:
~/.mozilla/firefox/[unique-id].default/extensions/firebug#software.joehewitt.com.xpi
Navigate to /content/firebug/console/ in the archive/zip manager and open consolePanel.js
Got to line 911 (this may differ slightly for minor version revisions). It should look like this:
this.filterMatchSet.push(group);
Add this before that line:
if (typeof this.filterMatchSet == 'undefined')
{
this.filterMatchSet = [];
}
Save your change to the archive and restart FireFox
Firefox 23.0.1 + Firebug 1.12.0 + FirePHP 0.7.2 - the same versions set and the same problem... I checked FirePHP forum and there is a topic about this issue. Add-on author wrote there
Will take a look in early September after I return from vacation. Thanks for reporting this issue.
so in few weeks problem will be resolved I hope. :)
It appears that this issue with firePHP isn't being fixed any time soon and firebug has been updated again. Tom's answer does work but as he only specified a line number that part doesn't work in the newer version of firebug as the line numbers doesn't line up with the old ones SO here is how to find the correct place to insert Tom's code:
Follow Tom's answer here: https://stackoverflow.com/a/18530316/769294
Then when you have the consolePanel.js open you want to find this function:
filterLogRow: function(logRow, scrolledToBottom)
{
if (this.matchesFilter(logRow))
{
// Mark the groups, in which the log row is located, also as matched
for (var group = Dom.getAncestorByClass(logRow, "logRow-group"); group;
group = Dom.getAncestorByClass(group.parentNode, "logRow-group"))
{
Css.setClass(group, "contentMatchesFilter");
// #################################################################
// Add This line here
// #################################################################
if (typeof this.filterMatchSet == 'undefined') { this.filterMatchSet = []; }
// #################################################################
this.filterMatchSet.push(group);
}
}
.......
},
As you can see I have added some comments around the line you need to add (from Tom's answer) and you can see where it needs to go.
Hope this helps for all the updates to firebug in the near future until firePHP is fixed. :)
The problem is fixed with Firebug 1.12.3.

Categories