我们正在运行各种嗅探以帮助保持一致性,同时使用eslint - 所以我们正试图统一一些规则。我们可以在eslint中做到这一点,但无法弄清楚如何在phpcs中做到这一点。
tap(function () {
return true;
});
$cake = 'yes please';
防止
tap(function () {
return true;
});
$cake = 'yes please';
getSomething()
{
$something = 'something';
return $something;
}
或
getSomething()
{
return 'something';
}
而不是
getSomething()
{
$something = 'something';
return $something;
}
谢谢:)
答案 0 :(得分:0)
对于npm -dd install
npm info it worked if it ends with ok
npm verb cli [ '/usr/bin/node', '/usr/bin/npm', '-dd', 'install' ]
npm info using npm@3.10.10
npm info using node@v6.11.5
npm verb mapToRegistry no registry URL found in name for scope @angular
npm verb request uri https://registry.npmjs.org/@angular%2fcommon
npm verb request no auth needed
npm info attempt registry request try #1 at 3:41:11 PM
npm verb request id 10054e4c6c4b8242
npm verb etag W/"59f29d79-234ca"
npm verb lastModified Fri, 27 Oct 2017 02:44:09 GMT
npm http request GET https://registry.npmjs.org/@angular%2fcommon
npm http 304 https://registry.npmjs.org/@angular%2fcommon
npm verb headers { date: 'Fri, 27 Oct 2017 23:41:13 GMT',
npm verb headers via: '1.1 varnish',
npm verb headers 'cache-control': 'max-age=0',
npm verb headers etag: 'W/"59f29d79-234ca"',
npm verb headers age: '0',
npm verb headers connection: 'keep-alive',
npm verb headers 'x-served-by': 'cache-mdw17339-MDW',
npm verb headers 'x-cache': 'MISS',
npm verb headers 'x-cache-hits': '0',
npm verb headers 'x-timer': 'S1509147674.967823,VS0,VE358',
npm verb headers vary: 'Accept-Encoding' }
npm verb etag https://registry.npmjs.org/@angular%2fcommon from cache
npm verb get saving @angular/common to /home/jeff/.npm/registry.npmjs.org/_40angular_252fcommon/.cache.json
npm verb correctMkdir /home/jeff/.npm correctMkdir not in flight; initializing
npm verb cache add spec @angular/common@4.4.6
npm verb addNamed "4.4.6" is a plain semver version for @angular/common
npm verb mapToRegistry no registry URL found in name for scope @angular
npm verb addNameVersion registry:https://registry.npmjs.org/@angular%2fcommon not in flight; fetching
npm verb get https://registry.npmjs.org/@angular%2fcommon not expired, no request
npm verb afterAdd /home/jeff/.npm/@angular/common/4.4.6/package/package.json not in flight; writing
npm verb correctMkdir /home/jeff/.npm correctMkdir not in flight; initializing
npm verb afterAdd /home/jeff/.npm/@angular/common/4.4.6/package/package.json written
npm verb request uri https://registry.npmjs.org/tslib
npm verb request no auth needed
npm info attempt registry request try #1 at 3:41:14 PM
npm verb etag W/"59dd9f6d-4c68"
npm verb lastModified Wed, 11 Oct 2017 04:34:53 GMT
npm http request GET https://registry.npmjs.org/tslib
npm http 304 https://registry.npmjs.org/tslib
npm verb headers { date: 'Fri, 27 Oct 2017 23:41:15 GMT',
npm verb headers via: '1.1 varnish',
npm verb headers 'cache-control': 'max-age=300',
npm verb headers etag: 'W/"59dd9f6d-4c68"',
npm verb headers age: '172',
npm verb headers connection: 'keep-alive',
npm verb headers 'x-served-by': 'cache-mdw17339-MDW',
npm verb headers 'x-cache': 'HIT',
npm verb headers 'x-cache-hits': '1',
npm verb headers 'x-timer': 'S1509147675.077783,VS0,VE0',
npm verb headers vary: 'Accept-Encoding, Accept' }
npm verb etag https://registry.npmjs.org/tslib from cache
npm verb get saving tslib to /home/jeff/.npm/registry.npmjs.org/tslib/.cache.json
npm verb correctMkdir /home/jeff/.npm correctMkdir not in flight; initializing
npm verb cache add spec tslib@^1.7.1
npm verb addNamed ">=1.7.1 <2.0.0" is a valid semver range for tslib
npm verb addNameRange registry:https://registry.npmjs.org/tslib not in flight; fetching
npm verb get https://registry.npmjs.org/tslib not expired, no request
npm verb addNamed "1.8.0" is a plain semver version for tslib
npm verb afterAdd /home/jeff/.npm/tslib/1.8.0/package/package.json not in flight; writing
npm verb correctMkdir /home/jeff/.npm correctMkdir not in flight; initializing
npm verb afterAdd /home/jeff/.npm/tslib/1.8.0/package/package.json written
npm info lifecycle xsltool@1.0.0~preinstall: xsltool@1.0.0
npm verb correctMkdir /home/jeff/.npm/_locks correctMkdir not in flight; initializing
npm verb lock using /home/jeff/.npm/_locks/staging-950641377131bc6f.lock for /mnt/c/work/personal/LiveXSLTransformUI/tmp/node_modules/.staging
npm verb unbuild node_modules/.staging/@angular/common-b1bc935a
npm verb unbuild node_modules/.staging/tslib-34a2ed6e
npm verb gentlyRm don't care about contents; nuking /mnt/c/work/personal/LiveXSLTransformUI/tmp/node_modules/.staging/@angular/common-b1bc935a
npm verb gentlyRm don't care about contents; nuking /mnt/c/work/personal/LiveXSLTransformUI/tmp/node_modules/.staging/tslib-34a2ed6e
npm verb tar unpack /home/jeff/.npm/@angular/common/4.4.6/package.tgz
npm verb tar unpacking to /mnt/c/work/personal/LiveXSLTransformUI/tmp/node_modules/.staging/@angular/common-b1bc935a
npm verb gentlyRm don't care about contents; nuking /mnt/c/work/personal/LiveXSLTransformUI/tmp/node_modules/.staging/@angular/common-b1bc935a
npm verb tar unpack /home/jeff/.npm/tslib/1.8.0/package.tgz
npm verb tar unpacking to /mnt/c/work/personal/LiveXSLTransformUI/tmp/node_modules/.staging/tslib-34a2ed6e
npm verb gentlyRm don't care about contents; nuking /mnt/c/work/personal/LiveXSLTransformUI/tmp/node_modules/.staging/tslib-34a2ed6e
npm verb gentlyRm don't care about contents; nuking /mnt/c/work/personal/LiveXSLTransformUI/tmp/node_modules/.staging/tslib-34a2ed6e/node_modules
npm verb gentlyRm don't care about contents; nuking /mnt/c/work/personal/LiveXSLTransformUI/tmp/node_modules/.staging/@angular/common-b1bc935a/node_modules
npm info lifecycle tslib@1.8.0~preinstall: tslib@1.8.0
npm info lifecycle @angular/common@4.4.6~preinstall: @angular/common@4.4.6
npm info linkStuff tslib@1.8.0
npm verb linkBins tslib@1.8.0
npm verb linkMans tslib@1.8.0
npm info linkStuff @angular/common@4.4.6
npm verb linkBins @angular/common@4.4.6
npm verb linkMans @angular/common@4.4.6
npm info lifecycle tslib@1.8.0~install: tslib@1.8.0
npm info lifecycle @angular/common@4.4.6~install: @angular/common@4.4.6
npm info lifecycle tslib@1.8.0~postinstall: tslib@1.8.0
npm info lifecycle @angular/common@4.4.6~postinstall: @angular/common@4.4.6
npm verb unlock done using /home/jeff/.npm/_locks/staging-950641377131bc6f.lock for /mnt/c/work/personal/LiveXSLTransformUI/tmp/node_modules/.staging
npm info linkStuff xsltool@1.0.0
npm verb linkBins xsltool@1.0.0
npm verb linkMans xsltool@1.0.0
npm info lifecycle xsltool@1.0.0~install: xsltool@1.0.0
> xsltool@1.0.0 install /mnt/c/work/personal/LiveXSLTransformUI/tmp
> npm install
npm info it worked if it ends with ok
npm verb cli [ '/usr/bin/node', '/usr/bin/npm', 'install' ]
npm info using npm@3.10.10
npm info using node@v6.11.5
npm info lifecycle xsltool@1.0.0~preinstall: xsltool@1.0.0
npm verb correctMkdir /home/jeff/.npm/_locks correctMkdir not in flight; initializing
npm verb lock using /home/jeff/.npm/_locks/staging-950641377131bc6f.lock for /mnt/c/work/personal/LiveXSLTransformUI/tmp/node_modules/.staging
npm verb unlock done using /home/jeff/.npm/_locks/staging-950641377131bc6f.lock for /mnt/c/work/personal/LiveXSLTransformUI/tmp/node_modules/.staging
npm info linkStuff xsltool@1.0.0
npm verb linkBins xsltool@1.0.0
npm verb linkMans xsltool@1.0.0
npm info lifecycle xsltool@1.0.0~install: xsltool@1.0.0
> xsltool@1.0.0 install /mnt/c/work/personal/LiveXSLTransformUI/tmp
> npm install
npm info it worked if it ends with ok
npm verb cli [ '/usr/bin/node', '/usr/bin/npm', 'install' ]
npm info using npm@3.10.10
npm info using node@v6.11.5
npm info lifecycle xsltool@1.0.0~preinstall: xsltool@1.0.0
npm verb correctMkdir /home/jeff/.npm/_locks correctMkdir not in flight; initializing
npm verb lock using /home/jeff/.npm/_locks/staging-950641377131bc6f.lock for /mnt/c/work/personal/LiveXSLTransformUI/tmp/node_modules/.staging
npm verb unlock done using /home/jeff/.npm/_locks/staging-950641377131bc6f.lock for /mnt/c/work/personal/LiveXSLTransformUI/tmp/node_modules/.staging
npm info linkStuff xsltool@1.0.0
npm verb linkBins xsltool@1.0.0
npm verb linkMans xsltool@1.0.0
npm info lifecycle xsltool@1.0.0~install: xsltool@1.0.0
之前的空行,您可以使用PHP CS Fixer中的return
规则
要与PHP_CodeSniffer一起使用,最好的方法是使用EasyCodingStandard。
blank_line_before_statement
composer require --dev symplify\easy-coding-standard
# easy-coding-standard.neon
checkers:
- PhpCsFixer\Fixer\ReturnNotation\BlankLineBeforeReturnFixer
vendor/bin/ecs check src
对于闭包,您必须调整原始规则以包含闭包令牌。
如果出现任何问题,请create an issue here。我很乐意尽可能地改进这个工具。