PHPackages                             ycodetech/phpcs-standard - 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. [PSR &amp; Standards](/categories/psr-standards)
4. /
5. ycodetech/phpcs-standard

ActivePhpcodesniffer-standard[PSR &amp; Standards](/categories/psr-standards)

ycodetech/phpcs-standard
========================

yCodeTech's custom PHP\_CodeSniffer standard with opinionated coding rules and best practices

1.2.0(1mo ago)09MITPHPPHP &gt;=7.2CI passing

Since Aug 20Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/yCodeTech/phpcs-standard)[ Packagist](https://packagist.org/packages/ycodetech/phpcs-standard)[ RSS](/packages/ycodetech-phpcs-standard/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (10)Versions (7)Used By (0)

yCodeTech PHPCS Standard
========================

[](#ycodetech-phpcs-standard)

[![Latest Stable Version](https://camo.githubusercontent.com/1876b5f8805c7b0b106755c07cfa4e1cd62735a4bd44d4d2d1b67362d0a5977f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f79436f6465546563682f70687063732d7374616e646172643f6c6162656c3d537461626c65)](https://packagist.org/packages/ycodetech/phpcs-standard)[![Minimum PHP Version](https://camo.githubusercontent.com/190f481f2264b3746692f13e86da6d104698002a37ff1041f8cfbd5b38be9ee1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f79436f6465546563682f70687063732d7374616e646172642f7068703f6c6162656c3d706870)](https://camo.githubusercontent.com/190f481f2264b3746692f13e86da6d104698002a37ff1041f8cfbd5b38be9ee1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f79436f6465546563682f70687063732d7374616e646172642f7068703f6c6162656c3d706870)[![PHPCS Version](https://camo.githubusercontent.com/607ad9fa5a804044f506f42d8124883f16cb688ce8a57469912834d5ba2691a8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f79436f6465546563682f70687063732d7374616e646172642f737175697a6c6162732f7068705f636f6465736e69666665723f6c6162656c3d5048504353)](https://camo.githubusercontent.com/607ad9fa5a804044f506f42d8124883f16cb688ce8a57469912834d5ba2691a8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f79436f6465546563682f70687063732d7374616e646172642f737175697a6c6162732f7068705f636f6465736e69666665723f6c6162656c3d5048504353)[![Unit Tests](https://github.com/yCodeTech/phpcs-standard/actions/workflows/unit-tests.yml/badge.svg)](https://github.com/yCodeTech/phpcs-standard/actions/workflows/unit-tests.yml)

A custom [PHP\_CodeSniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer/tree/4.x) standard that enforces opinionated type and docblock rules with auto-fixing capabilities.

Table of Contents
-----------------

[](#table-of-contents)

- [Requirements](#requirements)
- [Installation](#installation)
- [Sniffs](#sniffs)
    - [yCodeTech.Commenting.DocblockFormat](#ycodetechcommentingdocblockformat)
    - [yCodeTech.Commenting.FunctionComment](#ycodetechcommentingfunctioncomment)
    - [yCodeTech.Types.DisallowTypeLongNames](#ycodetechtypesdisallowtypelongnames)
    - [yCodeTech.Types.DisallowVoidType](#ycodetechtypesdisallowvoidtype)
- [Testing](#testing)
    - [Unit Tests](#unit-tests)

Requirements
------------

[](#requirements)

- `php >= 7.2`
- `squizlabs/php_codesniffer 3.13+ || 4.x`

Installation
------------

[](#installation)

```
# Per project:
$ composer require ycodetech/phpcs-standard

# Globally
$ composer global require ycodetech/phpcs-standard
```

Sniffs
------

[](#sniffs)

### yCodeTech.Commenting.DocblockFormat

[](#ycodetechcommentingdocblockformat)

Enforces proper spacing and formatting in docblocks.

RulesFixable?All docblock tags must have exactly `1 space` between each element. ✔️The type and variable in any tag must be separated by a `space`. ✔️`@return` tags must be preceded by exactly `1 empty line`. ✔️#### Violation Codes:

[](#violation-codes)

`yCodeTech.Commenting.DocblockFormat.TagSpacing`

`yCodeTech.Commenting.DocblockFormat.ReturnSpacing`

#### Examples:

[](#examples)

✔️ Valid: Exactly 1 space between tag elements❌ Invalid: Multiple spaces between tag elements```
/**
 * @param string $name The name parameter
 * @throws Exception If something goes wrong
 * @see SomeClass For more information
 * @var string
 * @copyright Copyright (c) year, Name
 */
```

```
/**
 * @param string    $name       The name parameter
 * @throws    Exception    If something goes wrong
 * @see    SomeClass  For more information
 * @var    string
 * @copyright        Copyright (c) year, Name
 */
```

✔️ Valid: Exactly 1 space between type and variable❌ Invalid: 0 spaces between type and variable```
/**
 * @param string $name The name parameter
 */
```

```
/**
 * @param string$name The name parameter
 */
```

✔️ Valid: Exactly 1 empty line before @return tag❌ Invalid: 0 empty lines before @return tag```
/**
 * @param string $name The name parameter
 *
 * @return string
 */
```

```
/**
 * @param string $name The name parameter
 * @return string
 */
```

✔️ Valid: Exactly 1 empty line before @return tag❌ Invalid: Multiple empty lines before @return tag```
/**
 * @param string $name The name parameter
 *
 * @return string
 */
```

```
/**
 * @param string $name The name parameter
 *
 *
 *
 * @return string
 */
```

### yCodeTech.Commenting.FunctionComment

[](#ycodetechcommentingfunctioncomment)

Functions that return a value must have a `@return` docblock tag (nested anonymous function and closure returns will be ignored).

RulesFixable?NotesFunctions with `non-void` return types (`string`, `bool`, etc.) must have a `@return` tag. ✔️- Fixes with a `mixed` return type.
- Magic methods (e.g. `__construct`, `__get`, etc.) are exempt.

Functions with `void` return types must NOT have `@return` tags, except generator functions. ✔️- Most magic methods are exempt, except for those that return `void`: `__construct`, `__destruct`, `__clone`, `__set`, `__unset`, `__wakeup`, and `__unserialize`.

Generator functions must have a `@return` tag. ✔️- Fixes with an `iterable` return type.

#### Violation Codes:

[](#violation-codes-1)

`yCodeTech.Commenting.FunctionComment.MissingReturn`

`yCodeTech.Commenting.FunctionComment.VoidReturnTagFound`

#### Examples:

[](#examples-1)

✔️ Valid: @return tag for non-void function❌ Invalid: Missing @return tag for non-void function```
/**
 * Get formatted string.
 *
 * @param string $input The input string
 *
 * @return string
 */
public function formatString(string $input): string
{
}
```

```
/**
 * Get formatted string.
 *
 * @param string $input The input string
 */
public function formatString(string $input): string
{
}
```

✔️ Valid: No @return for void function❌ Invalid: @return tag on void function```
/**
 * Process data without returning anything.
 *
 * @param array $data The data to process
 */
public function processData(array $data): void
{
}
```

```
/**
 * Process data without returning anything.
 *
 * @param array $data The data to process
 *
 * @return void
 */
public function processData(array $data): void
{
}
```

✔️ Valid: @return tag for generator function❌ Invalid: Missing @return tag for generator function```
/**
 * Get formatted string.
 *
 * @param string $input The input string
 *
 * @return iterable
 */
public function formatString(string $input)
{
    yield "Hello $input";
}
```

```
/**
 * Get formatted string.
 *
 * @param string $input The input string
 */
public function formatString(string $input)
{
    yield "Hello $input";
}
```

### yCodeTech.Types.DisallowTypeLongNames

[](#ycodetechtypesdisallowtypelongnames)

Long type names are disallowed. Short names must be used in docblocks, type declarations, and type casting.

RulesFixable?Use `bool` instead of `boolean`.✔️Use `int` instead of `integer`.✔️Notes- Docblocks and type declarations include union and nullable types.
- Docblock types can also include generic types.
- Types will only be fixed in these regular docblocks tags:

    `@param`, `@return`, `@var`, `@property`, `@method`.

    Also any other tags that contain the regular tags; example:

    `@property-read`, `@phpstan-param`, `@psalm-return`.
- Any types in docblock descriptions will not get fixed.

#### Violation Codes:

[](#violation-codes-2)

`yCodeTech.Types.DisallowTypeLongNames.DocblockType`

`yCodeTech.Types.DisallowTypeLongNames.TypeDeclaration`

`yCodeTech.Types.DisallowTypeLongNames.TypeCast`

#### Examples:

[](#examples-2)

✔️ Valid: Short name docblock types❌ Invalid: Long name docblock types```
/**
 * @param bool $isValid
 * @psalm-param bool $isValid
 *
 * @return int
 */
```

```
/**
 * @param boolean $isValid
 * @psalm-param boolean $isValid
 *
 * @return integer
 */
```

✔️ Valid: Short name docblock generic types❌ Invalid: Long name docblock generic types```
/**
 * @param Collection $numbers
 * @param Map $settings
 * @param array $counts
 * @param array $counts
 */
```

```
/**
 * @param Collection $numbers
 * @param Map $settings
 * @param array $counts
 * @param array $counts
 */
```

✔️ Valid: Short name class property type declarations❌ Invalid: Long name class property type declarations```
private bool $isActive;
protected int $userCount;
```

```
private boolean $isActive;
protected integer $userCount;
```

✔️ Valid: Short name function/method/closure types❌ Invalid: Long name function/method/closure types```
function foo(bool $flag): int {
    $callback = function(bool $isValid): int {
    };
}
```

```
function foo(boolean $flag): integer {
    $callback = function(boolean $isValid): integer {
    };
}
```

✔️ Valid: Short name nullable and union types❌ Invalid: Long name nullable and union types```
function foo(?bool $flag, bool|string $var): ?int {
}
```

```
function foo(?boolean $flag, boolean|string $var): ?integer {
}
```

✔️ Valid: Short name type casting❌ Invalid: Long name type casting```
$foo = (bool) $isValid;
$bar = (int) $count;
```

```
$foo = (boolean) $isValid;
$bar = (integer) $count;
```

### yCodeTech.Types.DisallowVoidType

[](#ycodetechtypesdisallowvoidtype)

Explicit `void` return type declarations are disallowed on functions, methods, and closures. The absence of a return type already implies void.

RulesFixable?Explicit `: void` return type declarations must be removed.✔️#### Violation Codes:

[](#violation-codes-3)

`yCodeTech.Types.DisallowVoidType.Found`

#### Examples:

[](#examples-3)

✔️ Valid: No return type (implicitly void)❌ Invalid: Explicit void return type```
function doSomething()
{
    echo "Hello";
}
```

```
function doSomething(): void
{
    echo "Hello";
}
```

Testing
-------

[](#testing)

To test the standard against the provided comprehensive test file, please see [the specific instructions](./test_utils/README.md).

### Unit Tests

[](#unit-tests)

Run the comprehensive test suite:

```
# Test all sniff unit tests
$ composer test
```

Each test file contains deliberate violations that should be detected by the corresponding sniff.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance90

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~109 days

Total

3

Last Release

53d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c808117f4c887d9f33427863102871a9c7ac9c2b9c10f712593ec55b42580733?d=identicon)[ycodetech](/maintainers/ycodetech)

---

Top Contributors

[![yCodeTech](https://avatars.githubusercontent.com/u/31927084?v=4)](https://github.com/yCodeTech "yCodeTech (82 commits)")

---

Tags

coding-standardsphpphp-codesnifferphpcbfphpcsphpcs-standardstandardsycodetechycodetech-standardsstandardsphpcsPHP\_CodeSnifferphpcodesniffer-standardCoding Standard

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ycodetech-phpcs-standard/health.svg)

```
[![Health](https://phpackages.com/badges/ycodetech-phpcs-standard/health.svg)](https://phpackages.com/packages/ycodetech-phpcs-standard)
```

###  Alternatives

[phpcompatibility/php-compatibility

A set of sniffs for PHP\_CodeSniffer that checks for PHP cross-version compatibility.

2.3k74.3M1.3k](/packages/phpcompatibility-php-compatibility)[phpcsstandards/phpcsutils

A suite of utility functions for use with PHP\_CodeSniffer

6333.4M58](/packages/phpcsstandards-phpcsutils)[phpcsstandards/phpcsextra

A collection of sniffs and standards for use with PHP\_CodeSniffer.

10324.3M44](/packages/phpcsstandards-phpcsextra)[automattic/vipwpcs

PHP\_CodeSniffer rules (sniffs) to enforce WordPress VIP minimum coding conventions

25510.2M145](/packages/automattic-vipwpcs)[mayflower/mo4-coding-standard

PHP CodeSniffer ruleset implementing the MO4 coding standards extending the Symfony coding standards.

17508.3k5](/packages/mayflower-mo4-coding-standard)[drupal/coder

Coder is a library to review Drupal code.

3043.6M461](/packages/drupal-coder)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
