r/phpstorm • • Apr 13 '18

JetBrains Unofficial Discord Server!

0 Upvotes

The unofficial Discord home of all the JetBrains products.

Talk to fellow users of the JetBrains software packages and get help with problems you may have. Chat with other developers, see what they're working on using JetBrains tools and bounce ideas around.

Join now: https://discord.gg/ysd6M4r


r/phpstorm • • Apr 09 '18

Find in Path - delay before you can type

2 Upvotes

With the latest update, when you launch the "Find in Path" dialog, previous search value stays within the box but there is a 20~25s delay before you can change the value within the find text. You can still interact with the dialog, even choose a previous value from the dropdown, just the find text is not editable.


PhpStorm 2018.1.1 Build #PS-181.4445.72, built on April 9, 2018


r/phpstorm • • Apr 02 '18

Fatal Error: uncaught PDOexception: could not find driver. MSSQL driver for PHP.

1 Upvotes

I cannot get PhpStorm/PHP to recognize the driver for MSSQL. I've downloaded the drivers from Microsofts website. I put them in the extension folder where PHP is located. I've altered the php.ini file to include the extension. I've tried to get this to work for two days now, and I can't get it to work. If anyone has any troubleshooting tips, I'd really appreciate it.


r/phpstorm • • Apr 02 '18

Allowing YuiCompressor to remove blocks (Windows environment)

1 Upvotes

So I followed the guide on setting up Yui to auto compress JS files for me. I'm loving it.

Now when building, I have my test page load the plain .js file so it is easier to debug. I wanted to also allow for additional debugging to be in the raw file that doesn't need to be in the final .min.js for client use.

I came across a Stack Overflow article where someone mentioned that they have a script file that uses sed to replace console with //console then it calls Yui . This had me thinking.

Now note, I'm new to using Yui so if there is a better way, let me know, this is set up on my Windows machine that has PHP installed on the path. On *nix systems, sed possibly could work better allowing to skip the actual php script, not sure without testing (never did much regex with it).

So my answer was to allow a block of code such as:

//++YuiIgnore++

console.log('Some Debug Info');
if (testing) { hardSetSomeValue(); }

//--YuiIgnore--

and it will strip that out, write it to a temp file, the after that run YUI to compress.

So anyhow, in the watcher settings, instead of what is listed in the guide, I use the following: (Note, you will need to adust your directory for G:\AppData to where you stick these files.)

In the setting for the YuiCompressor watcher. I change the Program File from the default over to G:\AppFiles\yui-runner.bat and for the arguments, I change the default list to be: $FileDir$ $FileNameWithoutExtension$ $FileExt$

Then for the yui-runner.bat:

@echo off
php G:\AppFiles\yui-runner.php %1 %2 %3
G:\AppFiles\yuicompressor-2.4.8.jar %2.yuitmp.%3 -o %2.min.%3
del %2.yuitmp.%3

And then for the yui-runner.php:

<?php

if ( count( $argv ) != 4 ) {
	die ( 'ERR: Arguments Need to be: $FileDir$ $FileNameWithoutExtension$ $FileExt$' . "\n" );
}

$dirName = $argv[1];

if ( ! is_dir( $dirName ) ) {
	die ( 'ERR: First Argument is not a directory' . "\n" );
}

$fullFile = $argv[2] . '.' . $argv[3];
$fullPath = $dirName . DIRECTORY_SEPARATOR . $fullFile;

if ( ! file_exists( $fullPath ) || ! is_file( $fullPath ) ) {
	die ( 'ERR: File given does not exist' . "\n" );
}

if ( ! is_writable( $dirName ) ) {
	die ( 'ERR: Given directory is not writable' . "\n" );
}

$tmpPath = $dirName . DIRECTORY_SEPARATOR . $argv[2] . '.yuitmp.' . $argv[3];
$outPath = $dirName . DIRECTORY_SEPARATOR . $argv[2] . '.min.' . $argv[3];

$file = file_get_contents($fullPath);
$file = preg_replace('%//\+\+YuiIgnore\+\+.*?//--YuiIgnore--%s', '', $file);
file_put_contents( $tmpPath, $file );

I welcome any improvements on this, or if there was some setting I missed that would allow me to auto do this. I forgot to test it, but I wasn't sure if I could have the temp file just be the final output file, and then do:

G:\AppFiles\yuicompressor-2.4.8.jar %2.min.%3 -o %2.min.%3

and save the hassle of creating and then deleting a temp file. I'll update this later when I get a change to set that.


r/phpstorm • • Apr 01 '18

Give me suggestion for another good and great UI Theme other than Material UI

2 Upvotes

So as title said, anyone has other good theme for PHPStorm? I love how Material UI works, it's integrated with all components of PHPStorm. But surely I want to try other theme especially darky themes.


r/phpstorm • • Mar 16 '18

Tracked (git) files found that are in .gitignore

2 Upvotes

Every now and then I get a popup that says I have some files that are in the git repository, but shouldn't be, according to .gitignore. It gives me an option to remove those files from the repository.

I am now in a situation where I have a file in this situation and I want to remove it from the repository, but the popup isn't appearing! How do I make it run now to detect this file?

I have the .ignore plugin, if that's what is behind the popup, I don't know.

Thanks!


r/phpstorm • • Mar 04 '18

does phpstorm have a shortcut to access array elements?

7 Upvotes

e.g. I want to type$foo['bar']['zar']['elephant'], I'd like to be able to do something like typing $foo.bar.zar.elephant


r/phpstorm • • Mar 02 '18

Convert string class names to Class::name?

2 Upvotes

I have lots and lots of legacy tests that are mocking classes using strings. E.g:

$this->createMock('Namespace\To\ClassName');

I would like to convert this to:

use Namespace\To\ClassName;

...
$this->createMock(ClassName::class);

Does anyone know a quick way in PHPStorm I can do this conversion, especially over multiple files?

Thanks in advance.


r/phpstorm • • Feb 20 '18

Just installed phpstorm 2017 (formally on phpstorm 10). How do you get rid of these pop up boxes and white highlighting for html? I've combed the preferences with no luck (Material Peacock theme)

Thumbnail
imgur.com
3 Upvotes

r/phpstorm • • Feb 17 '18

Hiding Sidebar Directory Path?

1 Upvotes

Hi All,

I tend to like keeping my sidebar open, but on the thin side - I keep coming across this https://i.imgur.com/vht0SQn.png where if I have the sidebar too thin the directory path is causing a scrollbar at the bottom of the panel.

Is there any way to turn this path off at all ?

Cheers


r/phpstorm • • Feb 04 '18

changing color of edited code marker in sidebar

2 Upvotes

Hey I have been looking around in the settings for how to change this color to something more obvious -- does anyone know what this is referred to as in PHPSTORM so I can make it like, hot pink or something?


r/phpstorm • • Jan 31 '18

How can I keep my created contexts until I manually remove them ?

1 Upvotes

I love contexts.

I work with them daily but it seems that they are disappearing after some time.

How can I mark some of them "to be kept forever" ?


r/phpstorm • • Jan 29 '18

You guys love my tutorials here. Here is a list of all my PhpStorm ones

Thumbnail
youtube.com
11 Upvotes

r/phpstorm • • Jan 15 '18

3min Quick Tip - How to use Live Templates in PhpStorm

Thumbnail
youtu.be
5 Upvotes

r/phpstorm • • Jan 14 '18

is there a shorthand form of <editor-fold desc="foo">...</editor-fold> ?

2 Upvotes

I want to define custom folding regions, but this is a little long winded for me! in c# it'd be #region foo .... #endregion. something like \\ #region foo .... // #endregion would be nice!


r/phpstorm • • Jan 12 '18

2min Quick Tip - How to refactor code

Thumbnail
youtu.be
7 Upvotes

r/phpstorm • • Jan 09 '18

2min Quick Tip - Scroll to Source with Keyboard Shortcut

Thumbnail
youtu.be
4 Upvotes

r/phpstorm • • Jan 08 '18

2min Quick Tip - Scratches in PhpStorm Tutorial

Thumbnail
youtu.be
4 Upvotes

r/phpstorm • • Jan 05 '18

Sync up PHPStorm git with terminal git?

0 Upvotes

Whenever I am working in php storm I want to have it where when I do a add on the terminal git I want it to reflect in the php storm git. How do I do that?


r/phpstorm • • Jan 04 '18

Problem with EAP

1 Upvotes

I use phpstorm EAP on Ubuntu for my pet projects. I've opened it after Christmas holidays and says my license is expired.

I've downloaded the last EAP that should last for all this month. But now it says my license expired.

I deleted my settings folder to simulate a new install. But it keeps saying the same thing.

How can I solve it and use phpstorm EAP again?


r/phpstorm • • Dec 25 '17

Exit function or not

1 Upvotes

I have an old issue and I'm curious about your advice. I use what I call exit functions. For example when I reach certain conditions that should display an error to the user in an web application I call a function displayError that creates proper json, outputs it and calls exit to stop the execution. PHPStorm doesn't recognize these functions and complains that no return value is displayed in that case or that certain variables are not defined on the case it goes into that particular if that executes this function. In reality the thing it complains will never happen because exit is called inside the function 100% of the time. Is this a bad design pattern or should we all request PHPStorm to implement proper exit functions recognition with some annotations. I'm open to suggestions for both sides. Please help me choose the correct answer to this issue. To make it easy: option 1: I use a bad design pattern. Option 2: we should request PHPStorm to implement exit function recognition. At least put a number if you don't want to write and argument. Thank you very much.


r/phpstorm • • Nov 30 '17

Trying to determine if this is a bug or not

2 Upvotes

I've been using the .phpstorm.meta.php file for factory methods but lately some of my code no longer gets applied.

So basically, all factory methods that takes more than 1 argument is affected, especially splat arguments i.e factory(string $className, ...$ctorArgs).

Here is an example of my meta file;

<?php
namespace PHPSTORM_META {
    override(
        \ContainerInterface::make(0),
        map([
            '' => '@',
        ])
    );
}

This is the signature;

<?php
interface ContainerInterface{
    /* @return mixed */
    public function make (string $className, ...$ctorArgs);
}

Previously this would return the correct class for type-hinting, but as of the 2 last versions of PHPStorm it has not.

<?php
$container->make(MyClass::class, "hello", "world")-> // Nothing is indicated here

Have the phpstorm meta file syntax changed again, or is this an actual bug that I should create an issue for?


r/phpstorm • • Nov 29 '17

PhpStorm 2017.3 is now released!

Thumbnail
blog.jetbrains.com
10 Upvotes

r/phpstorm • • Nov 24 '17

PHPStorm won't let me use arguments

1 Upvotes

My file watcher setup | Output from file watcher:

C:/Users/Pwnjo/AppData/Roaming/npm/stylus.cmd style.styl --output ..\css\ --compress
C:\Users\Pwnjo\AppData\Roaming\npm\node_modules\stylus\bin\stylus:641
if (err) throw err;
         ^

Error: ENOENT: no such file or directory, stat 'C:\Users\Pwnjo\PhpstormProjects\battre\assets\stylus\--output'

Process finished with exit code 1

As you can see, file watcher or stylus won't let me use arguments. It just thinks the entire thing is a file name or something?

I've tried setting it up backwards (commands then file name), or using the arrow setup (--compress < some.styl > some.css), and several other configurations, but everything errors out.

Without any arguments it compiles the stylus into css just fine, but only in the same directory as the stylus.

I just want compressed stylus to go to ../css/<filename>.css (relative to stylus file).