定制 yousha/codecop 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

yousha/codecop

最新稳定版本:2.1.0

Composer 安装命令:

composer require yousha/codecop

包简介

A lightweight static analyzer that scan PHP files for quality issues.

README 文档

README

A lightweight static analyzer that scan PHP files for quality issues.

current version PHP PHP contributions welcome

Contents

Overview

CodeCop is a lightweight yet powerful static analysis tool designed specifically for PHP codebases. This command-line utility scans PHP files within a specified directory (and its subdirectories) to identify common code quality issues that can affect maintainability, reliability, and consistency of PHP applications. The tool focuses on enforcing modern PHP best practices and detecting potential problems before they make their way into production environments.

Features

  • No external dependency/library
  • Validates strict type(declare(strict_types=1)) declaration
  • Enforces final or abstract for all classes
  • Requires return types for all methods (except __construct)
  • Skips non-project directories automatically
  • Handles anonymous classes properly
  • Detects non-UTF-8 encoded files
  • Warns about UTF-8 BOM (Byte Order Mark)
  • Supported PHP: 7.4 to 8.5
  • Supported platforms: Windows, GNU/Linux, MacOS

Requirements

  1. PHP >= 7.4 to PHP == 8.5
  2. Composer >= 2

Installation

Via Composer:

composer require yousha/codecop --dev

Usage

php vendor/bin/codecop .

Or:

php vendor/bin/codecop src/

Check version:

php vendor/bin/codecop --version

Get help:

php vendor/bin/codecop --help

Support

Changelog

See CHANGELOG.txt file.

ToDo

See TODO.txt file.

Notice

See NOTICE.txt file.

License

This open-source software is distributed under the GPL-3.0 license. See LICENSE file.

统计信息

  • 总下载量: 43
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-only
  • 更新时间: 2025-04-07