Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Add support for php-cs-fixer #25

Closed
miken32 opened this Issue Sep 5, 2012 · 6 comments

Comments

Projects
None yet
6 participants

miken32 commented Sep 5, 2012

This tool implements code standards checking using PRS-2 and PRS-1 specifications. Would be great if this option could be available if installed, or even included (306 kb) with the bundle. More info: http://cs.sensiolabs.org/

Contributor

sleetdrop commented Nov 19, 2012

also these tools
phpmd
phpcpd
phpcs

danhanly commented Jul 8, 2014

This is a must for me!
I'm trying to switch to TextMate as a primary editor and unfortunately this is holding me back a bit.

In Netbeans, I can Ctrl, Shift + F to format the code according to standards.

Owner

sorbits commented Jul 8, 2014

Did you already install php-cs-fixer and is that doing what you need?

If so it’s trivial to write a command that calls it:

Bundle Editor → New (⌘N) → Command

Input/output: Document/Replace Document

Key equivalent: ⌃⇧H (consistent with other “pretty print”
commands)

Then set the command to call php-cs-fixer with appropriate options.

We can add such command to the PHP bundle, but ideally it would come
from a PHP user (as a pull request) as I do not know what is “best
practice” for PHP.

On 8 Jul 2014, at 11:51, danhanly wrote:

This is a must for me!
I'm trying to switch to TextMate as a primary editor and unfortunately
this is holding me back a bit.

In Netbeans, I can Ctrl, Shift + F to format the code according to
standards.


Reply to this email directly or view it on GitHub:
#25 (comment)

I have this settled up in a very similar way.

The difference is Output: Show in Tool Tip.

And the command is:

#!/usr/bin/env php

<?php
$file = $_ENV['TM_FILEPATH'];

system(sprintf("php-cs-fixer fix %s -vvv", $file));
Owner

sorbits commented Jul 15, 2014

I’m having problems installing php-cs-fixer (tried via homebrew) but
it seems a command for the PHP bundle could simply be:

#!/bin/sh
exec php-cs-fixer fix "$TM_FILEPATH" -vvv

Or by setting up php-cs-fixer in the command’s requirements:

#!/bin/sh
exec $PHP_CS_FIXER fix "$TM_FILEPATH" -vvv

The variable introduced should not be quoted, as that way the user can
add potential custom paramters.

Can someone suggest the easiest way to install php-cs-fixer?

@infininight can you look into adding a command for this (so we can
close this issue)?

If php-cs-fixer can work with stdin/out then it might be better to make
a command that does not rely on TM_FILEPATH.

On 11 Jul 2014, at 22:39, Pera Jovic wrote:

I have this settled up in a very similar way.

The difference is Output: Show in Tool Tip.

And the command is:

php
#!/usr/bin/env php

<?php
$file = $_ENV['TM_FILEPATH'];

system(sprintf("php-cs-fixer fix %s -vvv", $file));

Reply to this email directly or view it on GitHub:
#25 (comment)

I install php cs fixer with cloning a repo and symlink bin file to /usr/local/bin/php-cs-fixer.
With homebrew you don't get really fresh version with all fixes and improvements.

@infininight infininight was assigned by miken32 Jul 29, 2014

@sorbits sorbits closed this in d24593d Aug 24, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment