My vscode does not see the definition of functions in vendor library.
I don't know if it has anything to do with gitignore, where I have put vendor, but I would like to find a solution that lets me keep it in gitignore, but allows me to search through in the work environment.
Because it does not see the definition, it gets underlined as a problem and I can not take a peak into what I am working here with.
It does not affect the resulting outcome, it is problem while using the vscode.
Can you please help?
I tried creating config.json in the project root folder .vscode saying:
{
"search.useIgnoreFiles": false
}
It didn't do anything.
Thank you for looking into it.
Add the direcory path into intelephense configuration:
#ext:bmewburn.vscode-intelephense-client
Like here into include path list:
Related
My code's rather simple:
return response()->view("OneTimeLink", [ 'data' => $data ]);
I'm getting the following error:
InvalidArgumentException: View [OneTimeLink] not found. in file /app/vendor/laravel/framework/src/Illuminate/View/FileViewFinder.php on line 137
In debugging this, I've since learned that it should have a .blade.php extension. I renamed the file, rebuilt the docker image, I get the same error.
I've tried using relative and absolute paths, with proper (and Windows') slashes. Always the same error (though, it will modify the error message to show that it's observing the path I've specified).
If I just output a json'ed getcwd() it shows me that it's working from the /app/public directory (I've no idea if that is normal). So I've also tried using a "../Http/Resources/Views/OneTimeLink" path, with the same results. No doubt I've messed up just where to place the views, and it is a path that Laravel won't actually bother to check, but I'm having trouble determining just where it is wanting to find these.
Is there a debugging technique that will reveal where it is looking, or documentation that specifies where that should be located? Inside the docker container, artisan is claiming Laravel 7.30.4.
In the app/config directory, there should be a "view.php" file. This includes a 'paths' array that probably only includes one entry:
resource_path('views'),
The standard location is included by default according to a comment, and does not need to be added.
The resource_path() function is also a decent way to try to figure out just where it might be looking for these. I included a debug statement with what it returns, and got the following value:
/app/resources/temp
This path looked a little weird because I was expecting everything important to be in a path something like /app/Http/resources ... I'd screwed up my Dockerfile and was copying it into /app. So everything needed a /app/app prefix essentially, throwing off the Views and lord knows what else.
This used to work, but it stopped working recently. I don't think anything changed in my settings, but I have poured over them for a couple hours now just to make sure. I have checked all over google and SO too. Please pay attention to the details before claiming "this was answered over here..." Thanks. :)
Assumptions and Requirements
Assume we have two files:
<project_root>/index.php
<project_root>/folder/file.php
Assume our project root is /home/me/project.
We want to include file.php from index.php. We expect PhpStorm to be able to resolve the file path and allow us to do nifty IDE things like "Go To Declaration."
What works
require 'folder/file.php';
require '/home/me/project/folder/file.php';
$root = '/home/me/project/';
require $root.'folder/file.php';
What No Longer Works
define('ROOT_DIR', "/home/me/project/");
require ROOT_DIR.'folder/file.php';
PhpStorm does recognize the value of ROOT_DIR when I mouseover, but it highlights home and says something like: Path '"/home/me...folder/file.php' not found
Why Use a Constant Anyway?
To keep this simple, I've left out details that are not necessary to illustrate the problem. The primary thing I'd like to address is why this used to work but no longer does, and/or how can I make it work again.
Sorry, can't help. What are you really trying to do?
Here are the details I left out. If we can't solve the primary issue, perhaps we can find a good work around.
I'm working with an existing codebase. Most files require a config.php file that defines root_dir() for getting the web/project root. PhpStorm wasn't resolving those paths (understandably so), so I created a constant to takes it's place. That makes more sense anyway.
In today's battle, I discovered that you can do this:
/** #define "root_dir()" "/home/me/project/" */
// or
/** #define "ROOT_DIR" "/home/me/project/" */
If you put that anywhere in the file then PhpStorm is able to resolve all the includes/requires in that file. BUT, it only works in that file, even if you try to include/require it in another file. You'd have to do this to EVERY file to get it working everywhere. Nope. Nuh-uh. No thank you. I need to reference the absolute path to the project/web root in a way that PhpStorm will recognize across the whole project.
#LazyOne answered this in the comments. This is a bug in the latest release, and it's being tracked here: https://youtrack.jetbrains.com/issue/WI-31754
Until this gets patched I've created this work around:
Using Keyboard Maestro, I created a hotkey that will paste the #define comment at the top of the file and return the cursor to its original position. Download the macro here. Import that and edit the text.
Edit: You may actually need to edit the file in a regular text editor. One of the file paths may need to be changed to work on your system.
Note: I'm using a modified version of the Mac Eclipse keyboard layout in PHPStorm. I'm not sure that will matter.
Also, be aware that many of your "changed files" will simply have this mapping at the top of the file, and this mapping may not be correct for you teammates. I'm simply excluding those changes from my commits.
Here's the code, https://github.com/google/google-api-php-client/
Here's the file that's missing, https://github.com/google/google-api-php-client/blob/master/src/Google/autoload.php
I know it's possible to create this file with composer, but was just wondering if anyone has it available.
I'm also concerned that this alone might not make the software work, as I've tried to do it the manual way and the Class it can't reference is "GuzzleHttp\Collection" which is accessed in PHP with "use GuzzleHttp\Collection". I don't know how adding "autoload.php" will help referencing a file that's not part of the "google-api-php-client".
Does anyone actually have this software working in PHP, it says Beta?
I found it using Google Cache,
http://webcache.googleusercontent.com/search?q=cache:992oyuQ76a0J:https://github.com/google/google-api-php-client/blob/master/src/Google/autoload.php+&cd=1&hl=en&ct=clnk&gl=us
This file should be load from vendor directory
// include your composer dependencies
require_once 'vendor/autoload.php';
I have been developing a website using Symfony. Everything was good until earlier today I was adding some Fixtures using the DoctrineFixturesBundle and ran the "app/console" command. I received the following error:
[Symfony\Component\DependencyInjection\Exception\InvalidArgumentException]
Symfony\\Bundle\\AsseticBundle\\EventListener\\RequestListener
is not a valid class name for the "assetic.request_listener" service.
I tried undoing the changes I made to the fixtures to find my mistake and it didn't change. In my infinite wisdom, I decided to try updating my vendors by running "composer update" and it didn't work.
Also, when I run my site in a browser, I get the same error.
I don't know what's going on. Someone please help, any help appreciated.
For those who stop by :)
In most cases problem is with class name which has leading \ in front of class name. More info more info
Just wanted to let you all know how I fixed it. It's not the most elegant solution but it worked. I downloaded a new company of Symfony, copied over all my bundles, my whole config directory,my composer.json, and my AppKernel.php. It got rid of all my errors, even some cache issues I was getting.
For the record, this error is always related to one thing and that's the name of the class is wrong. Either you are specifying the path the class incorrectly, or you spelled the name wrong.
For instance, I got stumped on this one because I accidentally add .php to the class name.
Reformat on .xml files gave me same issue. Exactly, reformat the files in a directory instead of a single file, working with PhpStorm.
#abarisone:
Problem was in a services.xml file. PhpStorm "reformat" transform (example):
<parameter key="xxx">Petrus\xx\xx\XHRCoreExceptionListener</parameter>
to:
<parameter key="xxx">
Petrus\xx\xx\XHRCoreExceptionListener
</parameter>
Was hard to find and easy to correct, manually with help of "Local history" Phpstorm's feature.
Hi this is my first post on here. I am trying to install the Gdata Zend Client library without much success.
I have used these resources + scoured Stack Overflow.
https://developers.google.com/gdata/articles/php_client_lib
http://jeromejaglale.com/doc/php/google_calendar_api
I want to be able to add,edit etc events on google calendar via PHP. My problem/question is i really dont understand what the include_path settings are all about and how to set them in order to make the class work. Of course i checked php manual regarding this but still draw a blank.
I have downloaded the relevant class and uploaded it to my web root. In the past i would just include a class by using php include at the top of the page and this would suffice.
I am of the understanding that i need to change the php.ini file to show php where my class is. Does this mean that i have to put my class somewhere else other than the web root.
I am terribly confused about this step and i know that if i can get it installed, actually using the class should be relatively easy.
Thanks for any help.
Welcome! Your Q is about include files rather than ZF elements.
Understanding where the include setting can be made (and subsequently overridden) is an absolute key bit of information.
You need to find out where it is on the server you are working on.
echo ini_get('include_path');
Then dash off and really, really read the corresponding manual page.
Try out including a very simple file with an echo statement, and you will regain your sanity and confidence.
http://www.php.net/manual/en/function.include.php
Get that working then have a play with this:
http://www.php.net/manual/en/function.ini-set.php
The experience how you can include a file from the same directory (not generally a good idea if that is a public webpage - inside your webroot)
Then if you want to really chase this thing down, look at where you can set this in Apache and per-directory in .htaccess files.
Finally, you can just include a file by telling include/require the exact path from the top of the tree;
include /var/www/includes/libraries/and/so/on.php;
There are SO many places you can set and override this that you are really best off finding out where the server thinks the include directory is and putting your compoenents in there:
Now, when that comes to ZF stuff, I (on Deb and Ubuntu anyhow) put the contents of
Zend Framworks version XYZ ZendFramework/lib/Zend <-that folder into:
/usr/share/php/Zend <-into this place
Then setup your autoloader and Robert is your mothers brother...
Zend/Gdata.php line 124 is like this:
public static function import($uri, $client = null,$className=’Zend_Gdata_Feed’)
Change that to this:
public static function import($uri, $client = null,$className=’Zend_Gdata_Feed’, $useObjectMapping = true)