Code Monkey home page Code Monkey logo

sublimephpcompanion's Introduction

Sublime PHP Companion

This Sublime Text 3 Package provides cool stuff for PHP 5.3+ coding session.

Installation

Package control

Just search for PHP Companion in package control and you're ready.

Keybinding

The package no longer provides keybindings. You will have to install your own shortcuts. The Default.sublime-keymap-sample will give you the shortcuts I personally use.

Commands

find_use

Just place your cursor on a class name, hit the F5 key (personal shortcut) and that's it.

It will show you the different namespace that match your class, pick up one and you're done.

PHP Companion will sort your uses statement in alphabetical order. This can be configured to sort by line length with the use_sort_length user setting.

expand_fqcn

This command expands the class under the cursor to its FQCN (Fully Qualified Class Name). You have two keys for this command F6 and shift+F6 (personal shortcut) that respectively expand with and without the leading namespace separator \.

import_namespace

Just hit the F4 key (personal shortcut), it will add the namespace definition based on the absolute filename of the current file. I use a simple trick to determine where the namespace begun, actually the namespace will start at the first CamelCased folder.

If a namespace is already declared, the command will shout how crazy you are in the status bar.

Warning: This feature requires a filename so the command won't work in an unsaved buffer.

goto_definition_scope

Hit shift+F12 (personal shortcut) to search for a method definition based on the current scope. It will fallback to the "goto_definition" command if a match was not found.

insert_php_constructor_property

Hit F7 (personal shortcut) to insert both a constructor argument and its according property. The property will be private by default but you can change it with the visibility setting.

implement

Place your cursor on a class, abstract class or an interface name and hit the F3 key (personal shortcut). Matching interfaces or classes will be shown. Select one and then import all or one of the methods from that interface or class.

See use_todo_implement setting.

Settings

Settings can be stored either in your system wide "PHP Companion.sublime-settings" file or in the project settings file. This allows you to set preferences per-project if you need to.

If you're storing settings in a project file, put them in a phpcompanion node like this:

"phpcompanion": {
    "exclude_dir": [
        "vendor",
        "build"
    ]
}

IMPORTANT : Sublime Text 4 does not index files and folders ignored by .gitignore. Update your sublime settings with :

"index_exclude_gitignore": false

exclude_dir

List of directories to exclude when searching for the class declaration file. Path is relative to the project directory.

Please note that the filtering is done after the search in the index. So this option has no impact on performance, it's just a convenient way to avoid duplicate namespace declaration in some case.

use_sort_length

When importing use statements with the find_use command, sort statements by the length of the line.

use_todo_implement

When an interface or abstract class is implemented, this option is used to customize the method body of the newly added methods.

The available options are true and false.

"use_todo_implement": true:

public function methodName()
{
    // TODO: Implement 'methodName' method.
}

"use_todo_implement": false:

public function methodName()
{
    throw new \Exception("Method 'methodname' not implemented");
}

Successor of SublimeCTagsPHP

This plugin is the successor of SublimeCTagsPHP. PHP Companion uses the built-in index of Sublime Text 3 instead of CTags.

Warning! PHP Companion does not work on Sublime Text 2 and never will.

Licence

All of Sublime PHP Companion is licensed under the MIT license.

Copyright (c) 2013-2020 Erwan Richard

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

sublimephpcompanion's People

Contributors

adl1995 avatar aegypius avatar anlutro avatar arturolinares avatar bantya avatar bruno-costa avatar chadrien avatar danwall avatar erichard avatar ezzatron avatar igorw avatar jennevdmeer avatar jgskin avatar jonathantorres avatar kkiernan avatar mastir avatar mkusher avatar mrchozo avatar predragnikolic avatar ptcong avatar risingphoenix avatar ronanchilvers avatar shonm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sublimephpcompanion's Issues

find_use and expand_fqcn work "sometimes"

Hi,

I have Laravel 5 project, and it can find Session class but not the Guard class. It never finds any of my project classes. Why is that so? Do i have to do some additional configuration?

find_use expand_fqcn and goto_definition_scope don't work

I have closed sublime deleted index, opened sublime and run the GoTo Project Symbols which has reindexed sublime successfully. find_use expand_fqcn and goto_definition_scope are still not working on any assigned key combo or through running the commands from the Command Palette.

import_namespace and insert_php_constructor_property work as expected so the package is working.

find_use and expand_fqcn don't have any output in the console or bottom bar when they are run.

goto_definition_scope has no output in the console but it does say "Unable to find {ClassName}" in the bottom bar when run.

I was successfully running this package on a different machine but this new one no luck! Any suggestions?

insert_php_constructor_property not available

Hi there,

Upon searching for available PHP Companion commands, there's no mention of any constructor action.

Just in case there wasn't supposed to be, I went into my keymapping & set up a keybind to the "insert_php_constructor_property" command.

Nothing happens. No Console message either. Every other command (and keybind) works like a charm.

goto_definition_scope not taking into account the exclude_dir setting

Hi,

I was just asking myself if this behavior is a feature or a bug.
I've just installed it, then I added a directory (app/cache) to the "exclude_dir" property of the package settings (using User settings).
I expected that the goto_definition_scope takes in account this setting, but it seems that this command does not (it always suggest me a class from this folder). On the opposite, the find_use command takes it into account as expected.

So I would like to know if this behavior is working as expected, or there is a way to exclude dir from the goto_definition_scope command.

I am using ST on Windows 10.

Does not work, if namespace is written just after <?php

I write namespaces right after <?php. Many people does that, for example, Laravel community.
Example:

<?php namespace Acme\Models;
class User { }

In this case, if I press F5, SublimePHPCompanion will not find the User class.
Currently this function that finds the dependencies works only if namespace is written in new line like this:

<?php
namespace Acme\Models;
class User { }

importing the correct class name in USE.

currently am having a small issue when trying to import the class name for something like Faker\Factory so instead i get use Faker\Faker and here is a ss to show what i get

faker

find_use is broken

When I execute the find_use command, nothing happens, and this is dumped to the console:

Traceback (most recent call last):
  File "./sublime_plugin.py", line 362, in run_
  File "./PHPCompanion.py", line 88, in run
  File "./PHPCompanion.py", line 19, in find_symbol
AttributeError: 'Window' object has no attribute 'lookup_symbol_in_index'

I'm running OSX, Sublime 2.0.1 build 2217.

Inconsistent keybindings / readme

I was super confused as to why the keyboard shortcuts described in the readme weren't doing anything. Apparently the readme assumes everyone is on OSX by default, because I finally thought to look in the sublime-keymap files, upon which I realized that Linux uses a different set of keys than OSX.

I'd suggest making the keybindings the same everywhere, but at the very least the readme should clarify what the keybindings are on the different OSes.

Keyboard shortcuts not working

I'm on windows 7 64bit and the key binding are missing from Preferences > Package Setting > PHP Companion.

Using the keyboard shortcuts doesn't work.

Doing Ctrl + Shift + P searching for 'PHPCompanion' and running the commands from there does work tough.

Finding in Windows

Hi,

I've an issue when I'm using PHP Companion in Windows. When I hit the F5 key it does find the right file but oddly it can't open it :

Here's an exemple with Laravel when I'm looking for Route class.

Traceback (most recent call last):
  File "C:\Users\luc.tribolet\Desktop\ST3\sublime_plugin.py", line 531, in run_
    return self.run(edit)
  File "C:\Users\luc.tribolet\Desktop\ST3\Data\Packages\PHP Companion\PHPCompanion.py", line 79, in run
    self.namespaces = find_symbol(symbol, view.window())
  File "C:\Users\luc.tribolet\Desktop\ST3\Data\Packages\PHP Companion\PHPCompanion.py", line 25, in find_symbol
    with open(file[0], "r+b") as f:
FileNotFoundError: [Errno 2] No such file or directory: '/C/wamp/www/subdomains/laravel-develop/vendor/laravel/framework/src/Illuminate/Routing/Route.php'

The destination is absolutely correct but it can't open it.

Any ideas ?

illegal option -- R

When trying to build ctags, it opens message box: "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ctags: illegal option -- R
usage: ctags [-BFadtuwvx] [-f tagsfile] file ..."

AttributeError error on ST3+Windows 7

Been experiencing an issue on Windows 7. Thought it was my local Sublime Text so I tested it on a fresh install of Sublime with no other packages installed.

Installation was done using package control and I am running ST3 portable.

Here's the error I'm seeing with every command:

Traceback (most recent call last):
  File "F:\dev\sublimetext\sublime_plugin.py", line 556, in run_
    return self.run(edit)
  File "php_companion.commands.find_use_command in F:\dev\sublimetext\Data\Installed Packages\PHP Companion.sublime-package", line 17, in run
  File "php_companion.utils in F:\dev\sublimetext\Data\Installed Packages\PHP Companion.sublime-package", line 39, in find_symbol
  File "php_companion.settings in F:\dev\sublimetext\Data\Installed Packages\PHP Companion.sublime-package", line 7, in get_setting
AttributeError: 'NoneType' object has no attribute 'get'

Wondering if this is something specific to my local ST3 that can be fixed?

Thanks in advance!

TypeError with insert_php_constructor_property

As a follow up to my previous issue, seeing this error when attempting to use the insert constructor property function.

Also, I updated my user keybinding to "insert_php_constructor_property" since that looks like it was just updated.

Traceback (most recent call last):
  File "F:\dev\sublimetext\sublime_plugin.py", line 556, in run_
    return self.run(edit)
  File "php_companion.commands.insert_constructor_prop in F:\dev\sublimetext\Data\Installed Packages\PHP Companion.sublime-package", line 30, in run
  File "php_companion.commands.insert_constructor_prop in F:\dev\sublimetext\Data\Installed Packages\PHP Companion.sublime-package", line 50, in add_property
TypeError: Can't convert 'NoneType' object to str implicitly

Here is the code I'm trying to test this on:

<?php

class BaseClass {
   public function __construct($testVar) {
       print "In BaseClass constructor\n";
   }
}

Thanks again!

Allow to insert a namespace at the cursor position

Hey there,

I was wondering if it is possible to add a new feature to this awesome plugin :)
Many times I need to import a namespace but not as a use statement. I want it to be inserted at the cursor position.
This is very useful when mocking objects with phpunit for example :

$this->getMock('A\Quite\Long\Namespace\Here');

So basically, it will be a like the "find use" feature but it will insert the resulting namespace at the cursor position.

This would be really really awesome ^^ Unfortunately I don't know Python at all to make this myself :(
Cheers, and thanks for this great plugin. It's my favorite :)

Insert namespace after file docblock

If you use the import_namespace command in a file with a file-level docblock, you get the following:

<?php

namespace Foo;
/**
 * blah blah
 */

class Bar {}

I think it should look like this instead - this is how Symfony does it, for example.

<?php
/**
 * blah blah
 */

namespace Foo;

class Bar {}

Default keymap overrides important OSX defaults

I use Sublime on both OSX and Linux, and whilst the default key bindings for PHP Companion work okay for Linux, they clash with some important things in OSX.

In particular:

  • F4 is used to go to the next result in a multi-file search
  • F5 is used to sort lines
  • F6 (and variants) are used for spellcheck related functions

I remap import_namespace to F8 and find_use to F10 as they're unused, but I also have to re-map F4, F5, and F6 back to their defaults which is pretty annoying.

Perhaps some better defaults could be chosen? At least for OSX, although personally I prefer it when keybindings work in an equivalent way across platforms. What do you think?

using classes don't work, but methods work

I'm working on a Symfony-project and I installed my project via the symfony-installer

$ symfony new debugSublime

When I try to import the Request-class in one of my files it fails, however typing createFromGlobals and running the find_use command generates use Symfony\Component\HttpFoundation\createFromGlobals; which is only a method, not a class.

I took a look in the index via Goto > Goto Symbol in Project.... The symbol createFromGlobals is in my Index, but Request is missing.

I closed Sublime Text deleted the index (rm -rf ~/.config/sublime-text/Index) and open it again, same result.

Path to Request in my project: /vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Request.php.

Here is my demo-code:

<?php

namespace AppBundle\Controller;

use Symfony\Component\HttpFoundation\createFromGlobals;

class DefaultController extends Controller
{
    public function indexAction()
    {
        $request = new Request;
        $qhy = new createFromGlobals;
    }
}

Am I doing something wrong?

Shortcut not working

I just installed plugin and re-created index but still f9,f10 or other keys not working in sublime text 3 in preference menu showing : Change log, Readme and License options and in default key shortcut when i try to search f9 nothing shows. I used default shortcuts in user key settings but same issue no FQCN work or key.

Does not work

Ubuntu 14.04.2 LTS, Sublime 3, build 3083.

I installed the package, confgured shortcuts:

    { "keys": ["f6"], "command": "expand_fqcn" },
    { "keys": ["shift+f6"], "command": "expand_fqcn", "args": {"leading_separator": true} },
    { "keys": ["f5"], "command": "find_use" },
    { "keys": ["f4"], "command": "import_namespace" },
    { "keys": ["shift+f12"], "command": "goto_definition_scope" },
    { "keys": ["f7"], "command": "insert_constructor_prop" }

However, it does not react on f4, f5. Simply nothing happens.

I can provide any additional info required for debugging on request.

Windows 10 shortcuts not functioning

Sublime Text 3 build 3103

Using package manager installed PHP companion but no shortcuts work. Even tried using the ones that you have as examples. Nothing works.

Console shows nothing either.

Any suggestions?

Expand FQCN does not work properly on multi-selection

Hi Richard and thank you very much for this great package :)

I noticed that the expand_fqcn command does not work as expected when I perform a multi-selection of a given class.

In that case, only the first occurrence gets the FQCN, the other ones remain unchanged.

Here is an example, as you can see the command works only for the first occurrence (the first comment):

fqcn_mini

Use the php bin to get all declared classes (4f6c11b08e) breaks usability

... by adding a dependency on the php binary.

I see it has been introduced to fix some global symbols resolution, though on my machine I have no php binaries as I work on build machines with exported file systems.

Would it be possible to use an option so this extra resolution can be turned on/off ?

As for the moment The plugin is not usable for me anymore:

Traceback (most recent call last):
File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 549, in run_
return self.run(edit)
File "php_companion.commands.find_use_command in C:\XXX\AppData\Roaming\Sublime Text 3\Installed Packages\PHP Companion.sublime-package", line 17, in run
File "php_companion.utils in C:\XXX\AppData\Roaming\Sublime Text 3\Installed Packages\PHP Companion.sublime-package", line 40, in find_symbol
File "php_companion.utils in C:\XXX\AppData\Roaming\Sublime Text 3\Installed Packages\PHP Companion.sublime-package", line 45, in find_in_global_namespace
File "X/subprocess.py", line 571, in check_output
File "X/subprocess.py", line 818, in init
File "X/subprocess.py", line 1096, in _execute_child
FileNotFoundError: [WinError 2] Le fichier spécifié est introuvable
(specified file does not exist)

Insert constructor property doesn't behave intuitively with multiple classes in one file

Often times in tests I define little throwaway classes at the bottom that are only used in that test. The "insert constructor property" command seems to always insert the property in either the first constructor in the file if there's already a constructor somewhere, or the first class in the file if none of the classes have a constructor.

It would be super nice if it looked for the first class or constructor definition above wherever the cursor is 👍

companion-injection

Configurable newlines for import_namespace

The import_namespace command currently adds 2 newlines between <?php and the namespace declaration, or no newlines if inline_namespace is set to true. I'd like to have just 1 newline. Maybe add a namespace_newlines setting with a default value of 2?

Handle duplicate import classes as the same

Sometimes I'm working in a test/dev project with many instances of the same package (e.g. Behat because 5 libraries in my ST project use Behat). When I want to import a Behat class, I press F5 and it pops up with 5 options: 5 different class files from those 5 libraries, but the 5 Full/Qualified/Class/Name are exactly the same. The files might even be different, because they're different versions, but that's not important.

If the resulting import is the same, it doesn't have to pop up.

start_dir_pattern error

Hello,

I get my project in /home/maxime/sites/ when i import namespace it return

namespace home/maxime/sites/project

so I tried to configure start_dir_pattern

I used :

"start_dir_pattern" : "home/maxime/sites/"

and i get this error :

Traceback (most recent call last):
File "/home/maxime/bin/SB3/sublime_plugin.py", line 549, in run_
return self.run(edit)
File "/home/maxime/.config/sublime-text-3/Packages/PHP Companion/php_companion/commands/import_namespace_command.py", line 25, in run
namespaceStmt = re.sub(pattern, '\1', namespaceStmt)
File "./re.py", line 170, in sub
File "./re.py", line 311, in filter
File "./sre_parse.py", line 870, in expand_template
sre_constants.error: invalid group reference

[Windows] generated namespace is full path including <drive-letter>:\

I just tried out your plugin and found the following:

I have a symfony2 project located at c:\Users\<username>\www\<project-name>.

Now created a new file src/Vendor/MyBundle/VendorMyBundle.php and hit F4...

At first i used SublimeText 2 where it didn't insert any namespace at all ( please consider adding a note that the plugin is not working for SublimeText < 3.x to the README.md ) ...

... BUT trying to insert a namespace for a class already containing a namspace resulted in "namespace definition already exist!" being added to the status bar on the bottom left.

Afterwards i switched to SublimeText 3 and tried again:

Now it kind of works but the generated namespace contains the whole path including c:\.

namespace c:\Users\<username>\www\<project-name>\src\Vendor\MyBundle;

Hitting F4 multiple times inserts the namespace multiple times ( no status message )

Do i need to adjust the start_dir_pattern - if yes how ?

Automatically insert find_use

I'm sure there's a reason why this feature is not implemented, but I'm not sure of it.

It would be extremely nice to have a command (in the package) to find all the classes in a file then insert use automatically. If there're multiple files with the same name, then a dialog pops up.

Am I missing something?

Exception thrown when using find_use and expand_fqcn

I am experiencing a bug when I try the find_use or expand_fqcn command. Not really sure what is going on here, but hopefully someone here can make sense of the console output. Clearly some file is missing, but I cannot say which one.

Traceback (most recent call last):
  File "./subprocess.py", line 1112, in _execute_child
FileNotFoundError: [WinError 2] The system cannot find the file specified

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 556, in run_
    return self.run(edit)
  File "php_companion.commands.find_use_command in C:\Users\bblue\AppData\Roaming\Sublime Text 3\Installed Packages\PHP Companion.sublime-package", line 17, in run
  File "php_companion.utils in C:\Users\bblue\AppData\Roaming\Sublime Text 3\Installed Packages\PHP Companion.sublime-package", line 40, in find_symbol
  File "php_companion.utils in C:\Users\bblue\AppData\Roaming\Sublime Text 3\Installed Packages\PHP Companion.sublime-package", line 45, in find_in_global_namespace
  File "./subprocess.py", line 576, in check_output
  File "./subprocess.py", line 824, in __init__
  File "./subprocess.py", line 1118, in _execute_child
FileNotFoundError: [WinError 2] The system cannot find the file specified

I am successfully using import_namespace and goto_definition_scope

find_use does not work with trait

PHP traits are just ignored from the indexing feature of ST3, so the search_symbol_in_project function does not find the symbol in the index.

IDEA: insert_namespace custom prefix

This would be especially useful for Laravel applications and I don't feel like it would be very hard to implement, but I have no idea how Sublime packages work so I cannot develop it.

Basically, in your PHP Companion.sublime-settings you could set a prefix, for example "App" for a laravel app. So when you hit f10 you will get App\Http\Controllers\FooController instead of Http\Controllers\FooController

Awesome work on this project! It's saved me so much time!!!

Trait import namespace

I dont know if this is not working or should or its just me its not working for.

but every time i use a trait in php in a class like:

class SomeClass
{
    use SomeTrait;
}

it dosent import the namespace when i hit the command: Import Namespace

make import_namespace detect composer.json

Hi, thanks for this great plugin. It really help me building Laravel app. I have a sugestion. Is is possible for this plugin to read a configuration for namespace in composer.json file?

When using Laravel, default composer.json autoload told that all folder in App directory should be namescaped in app. But, when I use import_namespace this plugin give a full directory url.

Eg. when I run from /User/me/Code/laravel/app/entity/model.php. It should be App\Entity\Model based on composer.json autoload configuration.
But, it give me User\me\Code\laravel\app\entity\model.

Here is sample composer.json files:

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "laravel/framework": "5.0.*",
        "league/commonmark": "0.7.*",
        "barryvdh/laravel-ide-helper": "~2.0"
    },
    "require-dev": {
        "phpunit/phpunit": "~4.0",
        "phpspec/phpspec": "~2.1"
    },
    "autoload": {
        "classmap": [
            "database"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },
    "autoload-dev": {
        "classmap": [
            "tests/TestCase.php"
        ]
    },
    "scripts": {
        "post-install-cmd": [
            "php artisan clear-compiled",
            "php artisan optimize"
        ],
        "post-update-cmd": [
            "php artisan clear-compiled",
            "php artisan optimize"
        ],
        "post-create-project-cmd": [
            "php -r \"copy('.env.example', '.env');\"",
            "php artisan key:generate"
        ]
    },
    "config": {
        "preferred-install": "dist"
    }
}

The configuration for namespace is this line:

....
       "psr-4": {
            "App\\": "app/"
        }
....

remove the FQC automatically when using find_use

is there a chance to add the functionality to remove the inline namespace once we import it as a Use case ?
Ex..

// we excute the find_use cmnd
$factory->define(App\Http\Models\User::class, function () {});

and the result become

use App\Http\Models\User;

$factory->define(User::class, function () {});

rather than

use App\Http\Models\User;

$factory->define(App\Http\Models\User::class, function () {});

I can't find this package in Sublime3!

Hello

  1. I have installed package control
  2. I find your plugin by searching for "PHP Companion" in the install package command (ctrl + shift + p then type install)

than,I can't find this package in Sublime3!what happened?

Bug when inserting some use from the Solarium library.

Hey,

I found a little bug using the solarium library in my project and trying to import some use statements.

Their classes look like the following:

<?php

/**
 * @namespace
 */
namespace Solarium;
use Solarium\Core\Client\Client as CoreClient;

/**
 * This class makes the client easier to use (shorter class name) and adds
 * a library version check.
 */
class Client extends CoreClient
{
    // ...
}

When I try to import the use in my code, the inserted statement looks like the following:

use */
namespace Solarium\Client;

It seems the plugin catches the @namespace annotation as the real namespace keyword and the resulting use statement is messed up.

I hope you will be able to fix this without much troubles.

Regards.

Feature Request: Prune Unused Imports

I'd love to see a command that automatically removes any unused classes that have been imported.

For ex:

namespace Yolo;

use Bar;
use Thing;
use Baz;

class Foo {
  public static function go() {
    Bar::fire();
  }
}

If I run the "prune" command on this file, it would prune the use Thing and use Baz lines. So it would change to this:

namespace Yolo;

use Bar;

class Foo {
  public static function go() {
    Bar::fire();
  }
}

I'll contribute $200 (with Paypal) to whoever PRs or adds this.

Main.sublime-menu fail to map the right path

click the setting - default is OK to open the file.
But Keymap - default is not.

Both git clone and package control install fail to open the keymap setting....

(OS x 10.9.1 ST3 b3059)

Can't get working expand_fqcn

Hello,

I have fresh Sublime Text 3 installation. Build 3083. I have installed PHP Companion and started fresh Laravel 5 project, and I can't get expand_fqcn command to work.

I tried to call it with key bindings I previously set up, and also via Command Palette, and nothing happens. I have tried to do that with different classes and different use cases. Just nothing is happening.

Import namespace and create constructor properties are working.

Can't figure out what it can be.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.