Asked  9 Months ago    Answers:  5   Viewed   84 times

I use a File Watcher defined as this

enter image description here

Here is my watchers.xml file:

<?xml version="1.0" encoding="UTF-8"?>
    <option name="arguments" value="fix $FileDir$/$FileName$ --verbose " />
    <option name="checkSyntaxErrors" value="false" />
    <option name="description" />
    <option name="exitCodeBehavior" value="ERROR" />
    <option name="fileExtension" value="php" />
    <option name="immediateSync" value="true" />
    <option name="name" value="PHP CS Fixer" />
    <option name="output" value="" />
    <option name="outputFilters">
      <array />
    <option name="outputFromStdout" value="false" />
    <option name="program" value="/usr/local/bin/php-cs-fixer" />
    <option name="scopeName" value="Project Files" />
    <option name="trackOnlyRoot" value="false" />
    <option name="workingDir" value="$ProjectFileDir$" />
    <envs />

While autosave executes, sometimes I am getting an error message about the conflict between changes in memory and on disk.

enter image description here

How can I solve this issue?



It happens because PHP CS Fixer modifies the file, as @LazyOne said, but you have empty value of "Output paths to refresh" so IDE cannot know about these changes.

Set the value of "Output paths to refresh" to $FileName$ - same as in arguments - to make PhpStorm aware about the changes (it depends on the "Working directory" value which has been set in Other Options - if it is set to $FileDir$ then you don't need to mention it in the paths to refresh).

Wednesday, March 31, 2021
answered 9 Months ago

You should point to your vendor/autoload.php at Settings | PHP | PHPUnit when using PHPUnit via Composer.

This blog post has all the details (with pictures) to successfully configure IDE for such scenario:

Related usability ticket:

P.S. The WI-18388 ticket is already fixed in v8.0

Wednesday, March 31, 2021
answered 9 Months ago

You have PSR-2 enabled, which requires the braces on the next line. From the documentation it looks like you can set braces.position_after_functions_and_oop_constructs to same (default would be next):

  • position_after_functions_and_oop_constructs ('next', 'same'): whether the opening brace should be placed on “next” or “same” line after classy constructs (non-anonymous classes, interfaces, traits, methods and non-lambda functions); defaults to 'next'


    'braces' => array(
        'allow_single_line_closure' => true,
        'position_after_functions_and_oop_constructs' => 'same',
Saturday, May 29, 2021
answered 7 Months ago

Solution found on stackoverflow and modified it a bit.

static bool IsFileLocked(FileInfo file)
    FileStream stream = null;

        stream = file.Open(FileMode.Open, 
                 FileAccess.ReadWrite, FileShare.None);
    catch (IOException)
        //the file is unavailable because it is:
        //still being written to
        //or being processed by another thread
        //or does not exist (has already been processed)
        return true;
        if (stream != null)

    //file is not locked
    return false;

static void FswCreated(object sender, FileSystemEventArgs e)
    string sFile = e.FullPath;

    Console.WriteLine("processing file : " + sFile);

    // Wait if file is still open
    FileInfo fileInfo = new FileInfo(sFile);

    string[] arrLines = File.ReadAllLines(sFile);
Wednesday, June 30, 2021
answered 6 Months ago
  1. You need to enable Track only root files option so that only main file will be compiled.

    If it does not work -- delete your existing watcher and create new one from scratch. Here is mine (as an example -- works fine for me).

  2. For automatic upload (deployment) -- have a look at the official manual:

    If configured correctly but it still does not work -- it's possible (quite likely) that your Output paths to refresh is not pointing to a correct file (after File Watcher execution IDE does not re-read whole project looking for changes -- only files pointed here).

Tuesday, August 31, 2021
answered 3 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :