lynxsolutions/php-static-analysis 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

lynxsolutions/php-static-analysis

最新稳定版本:1.0.0

Composer 安装命令:

composer require lynxsolutions/php-static-analysis

包简介

Static Analysis Tools Configurations for Laravel projects

README 文档

README

This repository, besides the PHPCS LynxSolutionsCodingStandard, also includes configuration files for various static analysis tools used in LynxSolutions PHP(mostly Laravel) projects.

Installation

Composer:

composer require --dev lynxsolutions/php-static-analysis

Usage

PHP_CodeSniffer:

In your project's phpcs.xml file add the following line:

<rule ref="LynxSolutionsCodingStandard"/>

If you don't have a phpcs.xml file, here's a simple example:

<?xml version="1.0"?>
<ruleset
        name="LynxSolutions PHPCS default configuration"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="./vendor/squizlabs/php_codesniffer/phpcs.xsd"
>
    <description>LynxSolutions PHPCS default configuration.</description>
    
    <arg name="extensions" value="php"/>
    <arg name="colors" />

    <arg value="sp"/>

    <file>app</file>
    <file>bootstrap</file>
    <file>config</file>
    <file>database</file>
    <file>routes</file>
    <file>tests</file>

    <exclude-pattern>cache/*</exclude-pattern>

    <rule ref="LynxSolutionsCodingStandard"/>
</ruleset>

Now you should be able to run:

vendor/bin/phpcs

PHP Mess Detector:

In your project's phpmd.xml file add the following line:

<rule ref="vendor/lynxsolutions/php-static-analysis/phpmd/phpmd.xml"/>

If you don't have a phpmd.xml file, here's a simple example:

<?xml version="1.0"?>
<ruleset
    name="LynxSolutions PHPMD default configuration"
    xmlns="http://pmd.sf.net/ruleset/1.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
    xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd"
>
    <description>LynxSolutions PHPMD default configuration.</description>

    <rule ref="vendor/lynxsolutions/php-static-analysis/phpmd/phpmd.xml"/>
</ruleset>

Now you can run:

vendor/bin/phpmd app,bootstrap,config,database,routes,tests text phpmd.xml

PHPStan:

In your project's phpstan.neon file add the following line:

includes:
    - vendor/lynxsolutions/php-static-analysis/phpstan/phpstan.neon

For Laravel projects:

First, make sure you install the larastan/larastan package:

composer require --dev larastan/larastan

Then, in your project's phpstan.neon, include the following:

includes:
    - vendor/lynxsolutions/php-static-analysis/phpstan/laravel.neon

If you don't have a phpstan.neon file, here's a simple example:

includes:
    - vendor/lynxsolutions/php-static-analysis/phpstan/laravel.neon

parameters:
    paths:
        - app
        - bootstrap
        - config
        - database
        - routes
        - tests

Now you can run:

vendor/bin/phpstan analyse

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-08-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固