Move phpcs config to file

This commit is contained in:
Adrien Crivelli 2020-07-26 14:48:06 +09:00
parent 6a41381c1d
commit 48f8b5c1f2
No known key found for this signature in database
GPG Key ID: B182FD79DC6DE92E
3 changed files with 26 additions and 4 deletions

22
.phpcs.xml.dist Normal file
View File

@ -0,0 +1,22 @@
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PHP_CodeSniffer"
xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">
<file>samples</file>
<file>src</file>
<file>tests</file>
<exclude-pattern>samples/Header.php</exclude-pattern>
<exclude-pattern>*/tests/Core/*/*Test\.(inc|css|js)$</exclude-pattern>
<arg name="report-width" value="200"/>
<arg name="parallel" value="80"/>
<arg name="cache" value="/tmp/.phpspreadsheet.phpcs-cache"/>
<arg name="colors"/>
<arg value="np"/>
<!-- Include the whole PSR12 standard -->
<rule ref="PSR12">
<exclude name="PSR2.Methods.MethodDeclaration.Underscore"/>
</rule>
</ruleset>

View File

@ -28,7 +28,7 @@
"scripts": {
"check": [
"php-cs-fixer fix --ansi --dry-run --diff",
"phpcs --report-width=200 samples/ src/ tests/ --ignore=samples/Header.php --standard=PSR12 -n",
"phpcs",
"phpunit --color=always"
],
"fix": [

View File

@ -3277,7 +3277,7 @@ class Calculation
}
// Parse the formula and return the token stack
return $this->_parseFormula($formula);
return $this->internalParseFormula($formula);
}
/**
@ -3418,7 +3418,7 @@ class Calculation
// Parse the formula onto the token stack and calculate the value
$this->cyclicReferenceStack->push($wsCellReference);
$cellValue = $this->processTokenStack($this->_parseFormula($formula, $pCell), $cellID, $pCell);
$cellValue = $this->processTokenStack($this->internalParseFormula($formula, $pCell), $cellID, $pCell);
$this->cyclicReferenceStack->pop();
// Save to calculation cache
@ -3765,7 +3765,7 @@ class Calculation
*
* @return bool
*/
private function _parseFormula($formula, ?Cell $pCell = null)
private function internalParseFormula($formula, ?Cell $pCell = null)
{
if (($formula = $this->convertMatrixReferences(trim($formula))) === false) {
return false;