Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHPCS needs updated support. #14

Open
designbyjr opened this issue Dec 11, 2017 · 10 comments
Open

PHPCS needs updated support. #14

designbyjr opened this issue Dec 11, 2017 · 10 comments

Comments

@designbyjr
Copy link

designbyjr commented Dec 11, 2017

The most recent PHPCS is not supported in this repo, also there are PSR2 clashes with the repo. The current repo does not support PHP 7 return type Hinting, which was fixed in the last year in PHPCS >=3.0.1.
Code example of type hinting.
protected static function buildSeleniumProcess() : Process { //some code here }
Also when using routes file Squiz does not like function closures.
`Route::get('/', function () {
return view('welcome');

<- error here disallow whitespace indent

[tab]});`

<- squiz.whitespace and laravel.tabs disallow whitespace clash.

@tedsecretsource
Copy link

The error I'm getting is:

Fatal error: Interface 'PHP_CodeSniffer_Sniff' not found in…

@TimOgilvy
Copy link

Also getting an error:

phpcs --standard=$HOME/.composer/vendor/pragmarx/laravelcs/Standards/Laravel/ .

Fatal error: Interface 'PHP_CodeSniffer_Sniff' not found in 
/Users/tim/.composer/vendor/pragmarx/laravelcs/Standards/Laravel/Sniffs/Tabs
/DisallowWhitespaceIndentSniff.php on line 12

@dotZak
Copy link

dotZak commented Apr 25, 2018

This seems related so I'll add it here instead of creating a new issue.

When installing via composer global require I'm getting the following when installing on php_codesniffer 3.2.2.

$ composer global require pragmarx/laravelcs
Changed current directory to /Users/zk/.composer
Using version ^0.1.0 for pragmarx/laravelcs
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for pragmarx/laravelcs ^0.1.0 -> satisfiable by pragmarx/laravelcs[v0.1.0].
    - Conclusion: remove squizlabs/php_codesniffer 3.2.2
    - Conclusion: don't install squizlabs/php_codesniffer 3.2.2
    - pragmarx/laravelcs v0.1.0 requires squizlabs/php_codesniffer ~2.0 -> satisfiable by squizlabs/php_codesniffer[2.0.0, 2.1.0, 2.2.0, 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.4.0, 2.5.0, 2.5.1, 2.6.0, 2.6.1, 2.6.2, 2.7.0, 2.7.1, 2.8.0, 2.8.1, 2.9.0, 2.9.1].
    - Can only install one of: squizlabs/php_codesniffer[2.0.0, 3.2.2].

   … [a bunch of versions listed]

    - Can only install one of: squizlabs/php_codesniffer[2.9.1, 3.2.2].
    - Installation request for squizlabs/php_codesniffer (locked at 3.2.2, required as *) -> satisfiable by squizlabs/php_codesniffer[3.2.2].


Installation failed, reverting ./composer.json to its original content.
$

@philtweir
Copy link

The changes needed (afaict) seem to be mostly classnames - I have done this locally, but am not sure what the preferred way to keep backwards compatibility is? (happy to PR)

@rizkysyazuli
Copy link

@philtweir how do you did this locally to be exact? i need this to work asap.

@philtweir
Copy link

@rizkysyazuli i'll push to a branch on a fork, and you can try also (will report back here w link)

@philtweir
Copy link

philtweir commented Jul 10, 2018

Patched version (no backward compatibility): https://github.com/flaxandteal/laravelcs/tree/feature/phpcs3-support

Please note - I have tried this and seemed to work fine (with w0rp/ale in vim) on my own code, but it's quite possible it didn't hit certain code paths. Happy to update if there are further changes required.

@rizkysyazuli
Copy link

@philtweir how do you install it btw? hehe. sorry, i don't use composer that much.

@philtweir
Copy link

@rizkysyazuli if you modify the instructions in the README to do:

phpcs --standard=/path/to/cloned/flaxandteal/branch/laravelcs/Standards/Laravel/ /path/to/your/project/files

instead of your normal phpcs call (wherever that is defined in your IDE)

@rizkysyazuli
Copy link

@philtweir ah, yes. just clone it directly. hehe.

yep, i should be able to reconfigure the linter arguments in SublimeLinter. thx again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants