PHPackages                             worksome/code-sniffer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. worksome/code-sniffer

AbandonedArchivedPhpcodesniffer-standard[Utility &amp; Helpers](/categories/utility)

worksome/code-sniffer
=====================

Worksome's preferences and custom sniffers for phpcs

v1.0.1(3y ago)15334.1k↓50%1MITPHPPHP ^8.0

Since Mar 11Pushed 3y ago16 watchersCompare

[ Source](https://github.com/worksome/code-sniffer)[ Packagist](https://packagist.org/packages/worksome/code-sniffer)[ RSS](/packages/worksome-code-sniffer/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (9)Versions (29)Used By (0)

⚠️ Deprecated in favor of [coding-style](https://github.com/worksome/coding-style) package ⚠️

Worksome's custom sniffs
========================

[](#worksomes-custom-sniffs)

This package contains all of Worksome's custom sniffs and configuration.

```
composer require worksome/code-sniffer --dev

```

Usage
-----

[](#usage)

Create a `phpcs.xml` in the root of your project with content like the following

```

    YourCompany Coding Standard

    ./app
    ./tests
    ./config

```

Run phpcs for seeing if you have any errors

```
vendor/bin/phpcs

```

Or run phpcbf for automatically fixing the errors when possible

```
vendor/bin/phpcbf

```

We suggest adding the commands as scripts in your `composer.json` for easier execution.

```
...
"scripts": {
    "phpcs": "vendor/bin/phpcs",
    "phpcbf": "vendor/bin/phpcbf"
}
...
```

This way you can now execute them via composer

```
$ composer phpcs
$ composer phpcbf

```

Custom sniffs
=============

[](#custom-sniffs)

List all the custom sniffs created by Worksome.

Laravel
-------

[](#laravel)

All custom sniffs specific to Laravel.

### Config filename kebab case

[](#config-filename-kebab-case)

Checks if all config files are written in kebab case.

### Disallow env usage

[](#disallow-env-usage)

Makes sure that you don't use `env` helper in your code, except for config files.

### Event listener suffix

[](#event-listener-suffix)

Enforces event listeners to end with a specific suffix, this suffix is defaulted to `Listener`.

parametersdefaultssuffixListener### Disallow blade outside of the `resources` directory

[](#disallow-blade-outside-of-the-resources-directory)

Makes sure no `.blade.php` files exist outside of Laravel's `resources` directory.

parametersdefaultsresourcesDirectory{YOUR\_PROJECT}/resourcesPhpDoc
------

[](#phpdoc)

All custom sniffs which are not specific to Laravel.

### Property dollar sign

[](#property-dollar-sign)

Makes sure that you always have a dollar sign in your properties defined in phpdoc.

```
/**
* @property string $name
 */
class User {}
```

### Param tags with no type or comment

[](#param-tags-with-no-type-or-comment)

This removes all `@param` tags which has no specified a type or comment

```
/**
 * @param string $name
 * @param $type some random type
 * @param $other //
