PHPackages                             gskema/phpcs-type-sniff - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. gskema/phpcs-type-sniff

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

gskema/phpcs-type-sniff
=======================

PHPCS sniff to enforce PHP7 types and array types

83.0.0(1y ago)41121.6k↑10.1%2[1 issues](https://github.com/gskema/phpcs-type-sniff/issues)2MITPHPPHP &gt;=8.3CI failing

Since May 6Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/gskema/phpcs-type-sniff)[ Packagist](https://packagist.org/packages/gskema/phpcs-type-sniff)[ Docs](https://github.com/gskema/phpcs-type-sniff)[ RSS](/packages/gskema-phpcs-type-sniff/feed)WikiDiscussions 81.x Synced 1mo ago

READMEChangelogDependencies (3)Versions (68)Used By (2)

PHPCS Type Sniff
================

[](#phpcs-type-sniff)

[![Latest Version on Packagist](https://camo.githubusercontent.com/1c11686d99df34548249e90d98e3a435230ac353b48d72fc2eb3458472fb6e25/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f67736b656d612f70687063732d747970652d736e6966662e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/gskema/phpcs-type-sniff)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/ad1d4581dc87a59ab3e719a48b83e7cf967e11aa536172fdd3439ae5f8c285ed/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f67736b656d612f70687063732d747970652d736e6966662f63692e796d6c3f6272616e63683d38312e78)](https://github.com/gskema/phpcs-type-sniff/actions)[![Coverage Status](https://camo.githubusercontent.com/7837ab87e7bc7e6dde4f0484e25c91f6e3bc20d17452773dcf79b6770a579961/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f67736b656d612f70687063732d747970652d736e6966662e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/gskema/phpcs-type-sniff/code-structure)[![Quality Score](https://camo.githubusercontent.com/953be541e61797b3e1bb022a67650279c860717d78d6bc5e30f11994df5e9e9d/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f67736b656d612f70687063732d747970652d736e6966662e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/gskema/phpcs-type-sniff)[![Total Downloads](https://camo.githubusercontent.com/1a34cbd93c9a0237262fa9021ff5857f7d6e4a2c42fbc0f5165cf8a32e2c614f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f67736b656d612f70687063732d747970652d736e6966662e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/gskema/phpcs-type-sniff)

Custom `phpcs` [CodeSniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) rule that:

- Enforces usage of PHP8, PHP7 type declarations (where possible)
- Enforces documenting array types with more specific types (e.g. `int[]`)
- Checks for useless PHPDoc blocks (no repeated information)
- Many more other checks

Example PHP class (comments on the right = `phpcs` warnings):

```
