SublimeLinter 3 plugin for PHP, using php -l.

Overview

SublimeLinter-php

Build Status

This linter plugin for SublimeLinter provides an interface to php -l. It will be used with files that have the "PHP", "HTML", or "HTML 5" syntax.

Installation

SublimeLinter must be installed in order to use this plugin.

Please use Package Control to install the linter plugin.

Before installing this plugin, ensure that php is installed on your system. To install php, download and run the appropriate installer: Linux/OS X or Windows.

Please make sure that the path to php is available to SublimeLinter. The docs cover troubleshooting PATH configuration.

Settings

Comments
  • Process PHP with 100% CPU usage

    Process PHP with 100% CPU usage

    I'm on OS X Yosemite. From time to time, for me like about every hour, SublimeLinter-php is starting PHP task with 100% CPU usage. It never stops, unless I stop the task manually. I didn't know what starts that task, but found out that the issue is gone when I disable SublimeLinter-php.

    bug wontfix 
    opened by kokokurak 69
  • Not working in linux

    Not working in linux

    • SO: Lubuntu 18.10

    • PHP path: /usr/bin/php (version 7.2)

    • Sublime version: 3

    • my linter settings:

    // SublimeLinter Settings - User
    {
      "debug": true,
    }
    
    • no errors in console.

    • my statup console log:

    startup, version: 3207 linux x64 channel: stable
    executable: /opt/sublime_text/sublime_text
    working dir: /home/luiz
    packages path: /home/luiz/.config/sublime-text-3/Packages
    state path: /home/luiz/.config/sublime-text-3/Local
    zip path: /opt/sublime_text/Packages
    zip path: /home/luiz/.config/sublime-text-3/Installed Packages
    ignored_packages: ["Vintage"]
    pre session restore time: 0.0971498
    startup time: 0.19988
    first paint time: 0.230325
    git: tracking working dir /home/luiz/.config
    reloading plugin Default.arithmetic
    reloading plugin Default.auto_indent_tag
    reloading plugin Default.block
    reloading plugin Default.colors
    reloading plugin Default.comment
    reloading plugin Default.convert_color_scheme
    reloading plugin Default.convert_syntax
    reloading plugin Default.copy_path
    reloading plugin Default.detect_indentation
    reloading plugin Default.echo
    reloading plugin Default.exec
    reloading plugin Default.fold
    reloading plugin Default.font
    reloading plugin Default.goto_line
    reloading plugin Default.history_list
    reloading plugin Default.indentation
    reloading plugin Default.install_package_control
    reloading plugin Default.kill_ring
    reloading plugin Default.mark
    reloading plugin Default.new_templates
    reloading plugin Default.open_context_url
    reloading plugin Default.open_in_browser
    reloading plugin Default.pane
    reloading plugin Default.paragraph
    reloading plugin Default.paste_from_history
    reloading plugin Default.profile
    reloading plugin Default.quick_panel
    reloading plugin Default.rename
    reloading plugin Default.run_syntax_tests
    reloading plugin Default.save_on_focus_lost
    reloading plugin Default.scroll
    reloading plugin Default.set_unsaved_view_name
    reloading plugin Default.settings
    reloading plugin Default.show_scope_name
    reloading plugin Default.side_bar
    reloading plugin Default.sort
    reloading plugin Default.switch_file
    reloading plugin Default.symbol
    reloading plugin Default.transform
    reloading plugin Default.transpose
    reloading plugin Default.ui
    reloading plugin CSS.css_completions
    reloading plugin Diff.diff
    reloading plugin HTML.encode_html_entities
    reloading plugin HTML.html_completions
    reloading plugin ShellScript.ShellScript
    reloading plugin 0_package_control_loader.00-package_control
    reloading plugin 0_package_control_loader.01-pygments
    reloading plugin 0_package_control_loader.50-backrefs
    reloading plugin 0_package_control_loader.50-markupsafe
    reloading plugin 0_package_control_loader.50-pymdownx
    reloading plugin 0_package_control_loader.50-python-markdown
    reloading plugin 0_package_control_loader.50-pyyaml
    reloading plugin 0_package_control_loader.51-python-jinja2
    reloading plugin 0_package_control_loader.55-jsonschema
    reloading plugin 0_package_control_loader.55-mdpopups
    reloading plugin A File Icon.plugin
    reloading plugin BracketHighlighter.bh_core
    reloading plugin BracketHighlighter.bh_logging
    reloading plugin BracketHighlighter.bh_plugin
    reloading plugin BracketHighlighter.bh_popup
    reloading plugin BracketHighlighter.bh_regions
    reloading plugin BracketHighlighter.bh_remove
    reloading plugin BracketHighlighter.bh_rules
    reloading plugin BracketHighlighter.bh_search
    reloading plugin BracketHighlighter.bh_swapping
    reloading plugin BracketHighlighter.bh_wrapping
    reloading plugin BracketHighlighter.support
    reloading plugin EditorConfig.EditorConfig
    reloading plugin Emmet.emmet-plugin
    reloading plugin GitStatusBar.git_status_bar
    reloading plugin Package Control.1_reloader
    reloading plugin Package Control.2_bootstrap
    reloading plugin Package Control.Package Control
    reloading plugin Stylus.Stylus
    reloading plugin SublimeLinter-php.linter
    reloading plugin SublimeLinter.__init__
    reloading plugin SublimeLinter.active_linters_view
    reloading plugin SublimeLinter.busy_indicator_view
    reloading plugin SublimeLinter.goto_commands
    reloading plugin SublimeLinter.highlight_view
    reloading plugin SublimeLinter.log_handler
    reloading plugin SublimeLinter.message_view
    reloading plugin SublimeLinter.panel_view
    reloading plugin SublimeLinter.status_bar_view
    reloading plugin SublimeLinter.sublime_linter
    reloading plugin Svelte.macros
    Traceback (most recent call last):
      File "/opt/sublime_text/sublime_plugin.py", line 125, in reload_plugin
        m = importlib.import_module(modulename)
      File "./python3.3/importlib/__init__.py", line 90, in import_module
      File "<frozen importlib._bootstrap>", line 1584, in _gcd_import
      File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
      File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
      File "/opt/sublime_text/sublime_plugin.py", line 1199, in load_module
        exec(compile(source, source_path, 'exec'), mod.__dict__)
      File "/home/luiz/.config/sublime-text-3/Installed Packages/Svelte.sublime-package/macros.py", line 1, in <module>
    ImportError: No module named 'YAMLMacros'
    reloading plugin Terminal.Terminal
    plugins loaded
    SublimeLinter: log_handler.py:74      Logging installed; log level INFO
    SublimeLinter: sublime_linter.py:62   debug mode: on
    SublimeLinter: sublime_linter.py:63   version: 4.11.2
    SublimeLinter: sublime_linter.py:266  Delay linting 'SublimeLinter.sublime-settings' for 0.0s
    SublimeLinter: sublime_linter.py:266  Delay linting '<untitled 33>' for 0.0s
    Emmet: No need to update PyV8
    Package Control: Skipping automatic upgrade, last run at 2019-05-03 18:28:29, next run at 2019-05-03 19:28:29 or after
    git: untracking working dir /home/luiz/.config
    SublimeLinter: sublime_linter.py:266  Delay linting '<untitled 38>' for 0.0s
    git: tracking working dir /home/luiz/dev
    
    opened by luizbills 15
  • Incorrect error thrown for array type hint or string type declaration

    Incorrect error thrown for array type hint or string type declaration

    When I type the following

    public function test( array $arr ) : array {
        return $arr;
    }
    

    I get the error

    Return type declaration not allowed (PHP 7)

    And typing this

    public function test_string( string $str ) : array {
        return $arr;
    }
    

    Throws

    Scalar type declaration not allowed (PHP 7)

    But both are valid in PHP 7 (http://php.net/manual/en/migration70.new-features.php)

    Also declare( strict_types=1 ); will give Unsuported directive error.

    Should this be updated?

    opened by dingo-d 13
  • Parse error with PHP 7.2

    Parse error with PHP 7.2

    Linting with PHP 7.2 (debug enabled) on OSX gives the following errors:

    SublimeLinter: #31 SublimeLinter.sublime-package:782: 'php' is linting 'ResponsePageFESpecOrderEdit.php'
    SublimeLinter: #31 SublimeLinter.sublime-package:1186: php: ResponsePageFESpecOrderEdit.php ['/usr/local/bin/php', '-l', '-n', '-d', 'display_errors=On', '-d', 'log_errors=Off']
    SublimeLinter: #31 SublimeLinter.sublime-package:1189: php: cwd: /Volumes/neo/varwwwhtml/CometCT1/Extensions
    SublimeLinter: #31 SublimeLinter.sublime-package:809: php output:
    
        Parse error: syntax error, unexpected 'as' (T_AS) in Standard input code on line 11
        Errors parsing Standard input code
    SublimeLinter: #31 SublimeLinter.sublime-package:850: php: No match for line: ''
    SublimeLinter: #31 SublimeLinter.sublime-package:850: php: No match for line: 'Errors parsing Standard input code'
    
    opened by cverond 7
  • Unexpected 'class' (T_CLASS) while using php CLI 7.1

    Unexpected 'class' (T_CLASS) while using php CLI 7.1

    Hello,

    First I'm not sure whether this is a bug/issue or not. Maybe I should use another way to notifiy this. I'm sorry if this is the case.

    Well the problem is that I've been using the linter for months and working perfectly. All of a sudden it started to notify the unexpected class error in lines like this (typical Laravel5.3 config/app.php)

            ...
            Illuminate\Auth\AuthServiceProvider::class,
            ...
    

    I double-checked my settings. I re-iistalled the package and double-checked my (CLI) php -v

    $ php -v
    PHP 7.1.0 (cli) (built: Dec  2 2016 09:19:56) ( NTS )
    Copyright (c) 1997-2016 The PHP Group
    Zend Engine v3.1.0-dev, Copyright (c) 1998-2016 Zend Technologies
        with Zend OPcache v7.1.0, Copyright (c) 1999-2016, by Zend Technologies
    

    Any ideas? looks like the linter is running php -l using a php <5.5 or the like.

    I'd appreciate any help. Thanks in advance

    question 
    opened by jhmilan 7
  • Class property assigned to an array throws error

    Class property assigned to an array throws error

    PHP Version: 5.6 Mac Version: 10.10.3

    Example: $test->test = ["test"]; Throws Error: unexpected '['

    Example $test = ["test"]; NO ERROR

    opened by upwebdesign 6
  • AttributeError: 'NoneType' object has no attribute 'rfind'

    AttributeError: 'NoneType' object has no attribute 'rfind'

    SublimeLinter is not working for me. When I open SublimeText3 console, I see:

    Traceback (most recent call last):
      File "/Applications/Sublime Text 3.app/Contents/MacOS/sublime_plugin.py", line 458, in is_visible_
        ret = self.is_visible()
      File "phpunit in /Users/justin/Library/Application Support/Sublime Text 3/Installed Packages/PHPUnit.sublime-package", line 1156, in is_visible
      File "phpunit in /Users/justin/Library/Application Support/Sublime Text 3/Installed Packages/PHPUnit.sublime-package", line 1143, in is_enabled
      File "phpunit in /Users/justin/Library/Application Support/Sublime Text 3/Installed Packages/PHPUnit.sublime-package", line 615, in top_folder
      File "./posixpath.py", line 151, in dirname
    AttributeError: 'NoneType' object has no attribute 'rfind'
    
    opened by nodesocket 6
  • Rulesets aren't being passed as arguments in ST 3.1

    Rulesets aren't being passed as arguments in ST 3.1

    I apologize if this should be filed under the SublimeLinter package instead - let me know if I should move the issue.

    Rulesets configured in SublimeLinter.sublime-settings aren't being passed as arguments to PHPMD with ST 3.1. I turned debugging on and found the command being used was formatted as follows:

    C:\PHP\phpmd c:\users\user\appdata\local\temp\fileCopy.php text

    As you might expect the output PHPMD produces is the help page which lists the mandatory parameters, one of which (the ruleset) is missing.

    Moving the rulesets string contents to a value in the args array fixes the issue, but I figured you would like to know that this problem exists.

    opened by ActionCactus 5
  • Not linting with php embedded on file with javascript syntax

    Not linting with php embedded on file with javascript syntax

    I use codeigniter in my work. That means that I have javascript code on .php files. So in Sublime Text 3, I put those .php files with a Javascript syntax. The problem is that when I put php embedded code on those files (that has a Javascript syntax set) I don't get any linting from the sublimelinter-php. What should I do? Here is a screenshot of my Sublime Text: a

    question wontfix 
    opened by alexandre1985 5
  • Fixes for latest PHP

    Fixes for latest PHP

    Includes some regex fixes for latest PHP versions and some improved error message filtering.

    • Removes trailing text like "Standard input code", " in -", " on ", in error messages in the status message
    • Fixes parsing some errors in newer versions of PHP

    Re: https://github.com/SublimeLinter/SublimeLinter-php/issues/48#issuecomment-1181302475

    opened by gerardroche 4
  • Added support for reading cmd from settings

    Added support for reading cmd from settings

    This simply adds support for reading cmd from settings.

    Why: to override system's php and use a specific binary (note: using paths setting did not work for this).

    opened by flavioheleno 4
Releases(1.4.1)
Owner
Code and documentation for SublimeLinter, the linter eco-system for Sublime Text
null
Integrates the ClassicPress Plugin Directory and any plugin stored in GitHub (tagged with classicpress-plugin) in the ClassicPress Admin

ClassicPress Plugin Directory Adds a new screen in a ClassicPress Install where you can browse, install, activate, deactivate, update, delete and pagi

TukuToi 3 Dec 27, 2022
This repository demonstrates exemplary implementation of chat using HTTP and Websocket servers in PHP using Kraken Framework components.

This repository demonstrates exemplary implementation of chat using HTTP and Websocket servers in PHP using Kraken Framework components.

Kraken 48 Aug 11, 2021
A research raw data repository for researchers of Arba Minch University built using Codeigniter which follows MVC architecture. The front-end is build using Bootstrap.

Arba Minch University Dataset Repository This system is a research dataset repository for Arba Minch University researchers and is build using Codeign

Wuletaw Wonte 8 Jul 1, 2022
This repository contains the codebase PHP bridge using RoadRunner Jobs plugin.

RoadRunner Jobs Plugin This repository contains the codebase PHP bridge using RoadRunner Jobs plugin. Installation To install application server and J

Spiral Scout 15 Nov 9, 2022
A PocketMine-MP plugin that allows you to comfortably register events using a new piece of PHP 8 power — attributes.

AdvancedEvents This is a PocketMine-MP plugin that allows you to comfortably register events using a new piece of PHP 8 power — attributes. Inspired b

JuraSciix 7 Dec 5, 2022
This is a PocketMine plugin that helps staffs track players using commands.

Track This is a PocketMine plugin that helps staffs track players using commands. Features Allows selected staffs to watch players use commands to fac

Nguyễn Thành Nhân 6 Jun 23, 2022
A FREE Wordpress Plugin to compress and convert images using cwebp, jpegoptim and optipng.

Squidge Is FREE WordpPress Plugin built for developers in mind compressing and convert images using jpegoptim, optipng, cwebp, and libavif. It's extre

Ainsley Clark 23 Dec 10, 2022
Unicode-url-for-Textpattern - Plugin for using unicode urls instead of transliterations to ASCII characters

Unicode-url-for-Textpattern Summary textpattern plugin wcz_utf8_url – uses UTF-8 permlinks instead of transliterated ones for SEO Features automatical

Andrij 4 Dec 16, 2017
This composer plugin is a temporary implementation of using symbolic links to local packages as dependencies to allow a parallel work process

Composer symlinker A Composer plugin to install packages as local symbolic links. This plugin is a temporary implementation of using symbolic links to

Pierre Cassat 18 Nov 9, 2021
A plugin to make life easier for users who need to edit specific functions of a world and also create, rename and delete worlds quickly using commands or the world management menu.

A plugin to make life easier for users who need to edit specific functions of a world and also create, rename and delete worlds quickly using commands or the world management menu.

ImperaZim 0 Nov 6, 2022
WooCommerce Empty Cart Button plugin helps you to add Empty Cart button to WooCommerce Pages/Sections using Shortcode only.

WooCommerce Empty Cart Button plugin helps you to add Empty Cart button to WooCommerce Pages/Sections using Shortcode only. How to use? Download the p

Katr 2 Sep 24, 2022
This Pocketmine-MP plugin is a plugin including a complete faction system.

SimpleFaction Simple faction plugin replacing FactionsPro which is no longer updated. Commands Command Name Command Description Available for /f help

Ayzrix 33 Dec 19, 2022
SpawnInLobby Pocketmine-MP plugin. With this plugin the player will always join the game at the default world spawn point

SpawnInLobby Pocketmine-MP plugin. With this plugin the player will always join the game at the default world spawn point

null 1 Jan 7, 2022
Ratio plugin is a luck plugin. The more lucky you are, the more you win!

Ratio Ratio plugin is a luck plugin. The more lucky you are, the more you win Features When you break a block (Cobblestone), it gives/puts you somethi

Ali Tura Çetin 2 Apr 25, 2022
actionMaster is a new faction plugin that aims at flexibility and customization of the plugin by the user and the developers.

FactionMaster is a new faction plugin that aims at flexibility and customization of the plugin by the user and the developers. It includes all the basic functionality of a faction plugin and data storage in MySQL or SQLITE. This is done by adding an extension system and a translation system. FactionMaster has a will of accessibility to the players and especially not to have to remember a lot of commands to play, all is done via interface.

FactionMaster 21 Dec 26, 2022
Api.video-wordpress-plugin - The official api.video plugin for WordPress

api.video WordPress Plugin api.video is the video infrastructure for product builders. Lightning fast video APIs for integrating, scaling, and managin

api.video 5 Oct 19, 2022
Ied plugin composer - Inspired Plugin Composer: Create, publish and edit plugins from within Textpattern CMS.

ied_plugin_composer Create, publish and edit plugins from within Textpattern CMS. Creates a new page under the Extensions tab where you can edit and e

Stef Dawson 8 Oct 3, 2020
BetterMobs - a plugin Remixed, by MadoxMC, the original plugin is maked by tgwaste

BetterMobsOverworld BetterMobs is a plugin Remixed, by MadoxMC, the original plugin is maked by tgwaste. MadoxMC Just Edited This plugin to Make 3 Compatible Plugins to add Mobs on your Overworld Worlds, NetherWorlds & EndWorlds, MadoxMC Idea.

MadoxMC 4 Dec 15, 2022
BetterMobs is a plugin Remixed, by MadoxMC, the original plugin is maked by tgwaste.

BetterMobs is a plugin Remixed, by MadoxMC, the original plugin is maked by tgwaste. MadoxMC Just Edited This plugin to Make 3 Compatible Plugins to add Mobs on your Overworld Worlds, NetherWorlds & EndWorlds, MadoxMC Idea.

MadoxMC 10 Dec 15, 2022