承接 camelot/coding-style 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

camelot/coding-style

Composer 安装命令:

composer require camelot/coding-style

包简介

Coding style for the Camelot project

README 文档

README

PHP

Camelot tries to adhere a coding style based on PSR-2 and the Symfony2 coding standard.

CodeSniffer

To use run:

composer require camleot/codingstyle --dev

Add a global before require if you want to install it globally.

If installing globally you also need to configure the installed_paths:

phpcs --config-set installed_paths "$(composer config --global data-dir)"

Then create a CodeSniffer config file named phpcs.xml.dist in your project root:

<?xml version="1.0"?>
<ruleset>
    <!-- Add color to output...umm duh -->
    <arg name="colors"/>

    <!-- Files or folders to sniff -->
    <file>src</file>
    <file>tests</file>

    <!-- Path to our coding standard folder -->
    <rule ref="vendor/camelot/codingstyle/Camelot"/>
</ruleset>

Additional changes can be made here. See CodeSniffer's annotated ruleset for more information.

phpcs.xml.dist should be committed for all developers to use.
An phpcs.xml file can also be create which takes precedence over phpcs.xml.dist for local changes. This file should be ignored from git.

Code Fixer

To use run:

composer require camelot/codingstyle --dev

Add a global before require if you want to install it globally.

Then create a config file named .php_cs.dist in your project root:

<?php

return Camelot\CsFixer\Config::create()
    // addRules() accepts arrays and traversable objects.
    ->addRules(
        // Create Camelot's standard rules.
        Camelot\CsFixer\Rules::create()
            // Enable risky rules.
            ->risky()
            // Enable PHP 5.6, 7.0, and 7.1 rules. Methods exist for each version.
            //->php71()
    )

    // Modify existing rules or add new ones.
    ->addRules([
        'heredoc_to_nowdoc' => false,
        'mb_str_functions'  => true,
    ])

    // Add directories to scan.
    ->in('src', 'tests')
;

See their website for a list of rules and additional configuration options.

.php_cs.dist should be committed for all developers to use.
An .php_cs file can also be create which takes precedence over .php_cs.dist for local changes. This file should be ignored from git.

JavaScript

There's no explicitly written style yet, but when creating the files needed for Camelot using the grunt toolchain there's a target linting the javascript code.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-08-31

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固