定制 elplaza/mypsr 二次开发

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

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

elplaza/mypsr

Composer 安装命令:

composer require elplaza/mypsr

包简介

My PHP Coding Standars

关键字:

README 文档

README

Installazione

Lo standard definito è lo standard che in teoria uno vuole utilizzare in tutti i progetti, quindi dev'essere installato globalmente. Per essere utilizzato in modo "agile" va installato l'opportuno plugin dell'editor e configurato.

Usando SublimeText 3, il plugin che consiglio è Phpcs. Questo plugin può usare diversi tools quali lo sniffer, il linter, il mess detector, il fixer etc... che verranno installati globalmente una volta installato questo: composer global require elplaza/mypsr

p.s. per aggiornare i pacchetti installati globalmente lanciare: composer global update

Una volta installati i tools, questi, come lo standard da usare, vanno comunicati al plugin tramite il file di configurazione (Preferences --> Package Settings --> PHP Code Sniffer --> Settings User), per es.:

{
	"show_debug"                  : false,
	"phpcs_executable_path"       : "~/.composer/vendor/bin/phpcs",
	"phpcbf_executable_path"      : "~/.composer/vendor/bin/phpcbf",
	"php_cs_fixer_executable_path": "~/.composer/vendor/bin/php-cs-fixer",
	"phpmd_executable_path"       : "~/.composer/vendor/bin/phpmd",
	"phpcs_show_quick_panel"      : true,
	"phpcbf_on_save"              : true,
	"php_cs_fixer_on_save"        : false,
	"phpmd_run"                   : true,
	"phpcs_additional_args"       : {
        "--standard": "~/.composer/vendor/elplaza/mypsr/src/MyPSR",
        "-n": ""
    },
    "phpcbf_additional_args": {
        "--standard": "~/.composer/vendor/elplaza/mypsr/src/MyPSR",
        "-n": ""
    }
}

🪲 tip: se il plugin non sembra funzionare, abilitare il show_debug e aprire la console di Sublime.

Lanciare i test

Per lanciare i test del MyPSR basta:

  • lanciare un test singolo: ./vendor/bin/phpunit src/MyPSR/Tests/WhiteSpace/BracketsUnitTest.php
  • lanciare tutti i test: ./vendor/bin/phpunit --testsuite MyPSR

Utile per testare il nostro PSR:

  • tutto lo standard: ./vendor/bin/phpcs -s -vvv --standard=./src/MyPSR testfile.php
  • solo uno sniff: ./vendor/bin/phpcs -s -vvv --standard=./src/MyPSR --sniffs=MyPSR.Arrays.Multiline testfile.php
  • per il fixer: ./vendor/bin/phpcbf -vvv --standard=./src/MyPSR --sniffs=MyPSR.Arrays.Multiline testfile.php

Comandi utili

Comandi utili:

  • stampa la lista dei coding standard installati: ./vendor/bin/phpcs -i
  • stampa tutti gli sniff presenti nello standard specificato: ./vendor/bin/phpcs -e --standard=PSR2
  • stampa la documentazione per ogni sniff dello standard: ./vendor/bin/phpcs --generator=Text --standard=./src/MyPSR
  • stampa la documentazione per il singolo sniff: ./vendor/bin/phpcs --generator=Text --standard=./src/MyPSR --sniffs=MyPSR.Arrays.Multiline

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-01-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固