[CS] Open class brackets in new line

This commit is contained in:
Gabriel Caruso 2018-01-10 14:24:26 -02:00 committed by Nikita Popov
parent fc8ac71e76
commit 7f72c84122
29 changed files with 58 additions and 29 deletions

View File

@ -7,7 +7,8 @@ use PhpParser\BuilderHelpers;
use PhpParser\Node; use PhpParser\Node;
use PhpParser\Node\Stmt; use PhpParser\Node\Stmt;
class Use_ implements Builder { class Use_ implements Builder
{
protected $name; protected $name;
protected $type; protected $type;
protected $alias = null; protected $alias = null;

View File

@ -14,7 +14,8 @@ use PhpParser\Node\Stmt;
* *
* @internal * @internal
*/ */
final class BuilderHelpers { final class BuilderHelpers
{
/** /**
* Normalizes a node: Converts builder objects to nodes. * Normalizes a node: Converts builder objects to nodes.
* *

View File

@ -2,4 +2,5 @@
namespace PhpParser; namespace PhpParser;
class ConstExprEvaluationException extends \Exception {} class ConstExprEvaluationException extends \Exception
{}

View File

@ -28,7 +28,8 @@ use PhpParser\Node\Scalar;
* point to string conversions are affected by the precision ini setting. Secondly, they are also * point to string conversions are affected by the precision ini setting. Secondly, they are also
* affected by the LC_NUMERIC locale. * affected by the LC_NUMERIC locale.
*/ */
class ConstExprEvaluator { class ConstExprEvaluator
{
private $fallbackEvaluator; private $fallbackEvaluator;
/** /**

View File

@ -5,7 +5,8 @@ namespace PhpParser\Internal;
/** /**
* @internal * @internal
*/ */
class DiffElem { class DiffElem
{
const TYPE_KEEP = 0; const TYPE_KEEP = 0;
const TYPE_REMOVE = 1; const TYPE_REMOVE = 1;
const TYPE_ADD = 2; const TYPE_ADD = 2;

View File

@ -10,7 +10,8 @@ namespace PhpParser\Internal;
* *
* @internal * @internal
*/ */
class Differ { class Differ
{
private $isEqual; private $isEqual;
/** /**

View File

@ -15,7 +15,8 @@ use PhpParser\Node\Expr;
* *
* @internal * @internal
*/ */
class PrintableNewAnonClassNode extends Expr { class PrintableNewAnonClassNode extends Expr
{
/** @var Node\Arg[] Arguments */ /** @var Node\Arg[] Arguments */
public $args; public $args;
/** @var null|Node\Name Name of extended class */ /** @var null|Node\Name Name of extended class */

View File

@ -2,7 +2,8 @@
namespace PhpParser; namespace PhpParser;
class JsonDecoder { class JsonDecoder
{
/** @var \ReflectionClass[] Node type to reflection class map */ /** @var \ReflectionClass[] Node type to reflection class map */
private $reflectionClassCache; private $reflectionClassCache;

View File

@ -6,7 +6,8 @@ use PhpParser\Node\Name;
use PhpParser\Node\Name\FullyQualified; use PhpParser\Node\Name\FullyQualified;
use PhpParser\Node\Stmt; use PhpParser\Node\Stmt;
class NameContext { class NameContext
{
/** @var null|Name Current namespace */ /** @var null|Name Current namespace */
protected $namespace; protected $namespace;

View File

@ -7,7 +7,8 @@ use PhpParser\Node;
/** /**
* @property Node\Name $namespacedName Namespaced name (if using NameResolver) * @property Node\Name $namespacedName Namespaced name (if using NameResolver)
*/ */
abstract class ClassLike extends Node\Stmt { abstract class ClassLike extends Node\Stmt
{
/** @var Node\Identifier|null Name */ /** @var Node\Identifier|null Name */
public $name; public $name;
/** @var Node\Stmt[] Statements */ /** @var Node\Stmt[] Statements */

View File

@ -5,7 +5,8 @@ namespace PhpParser;
use PhpParser\NodeVisitor\FindingVisitor; use PhpParser\NodeVisitor\FindingVisitor;
use PhpParser\NodeVisitor\FirstFindingVisitor; use PhpParser\NodeVisitor\FirstFindingVisitor;
class NodeFinder { class NodeFinder
{
/** /**
* Find all nodes satisfying a filter callback. * Find all nodes satisfying a filter callback.
* *

View File

@ -10,7 +10,8 @@ use PhpParser\NodeVisitorAbstract;
* *
* This visitor is required to perform format-preserving pretty prints. * This visitor is required to perform format-preserving pretty prints.
*/ */
class CloningVisitor extends NodeVisitorAbstract { class CloningVisitor extends NodeVisitorAbstract
{
public function enterNode(Node $origNode) { public function enterNode(Node $origNode) {
$node = clone $origNode; $node = clone $origNode;
$node->setAttribute('origNode', $origNode); $node->setAttribute('origNode', $origNode);

View File

@ -9,7 +9,8 @@ use PhpParser\NodeVisitorAbstract;
* This visitor can be used to find and collect all nodes satisfying some criterion determined by * This visitor can be used to find and collect all nodes satisfying some criterion determined by
* a filter callback. * a filter callback.
*/ */
class FindingVisitor extends NodeVisitorAbstract { class FindingVisitor extends NodeVisitorAbstract
{
/** @var callable Filter callback */ /** @var callable Filter callback */
protected $filterCallback; protected $filterCallback;
/** @var Node[] Found nodes */ /** @var Node[] Found nodes */

View File

@ -10,7 +10,8 @@ use PhpParser\NodeVisitorAbstract;
* This visitor can be used to find the first node satisfying some criterion determined by * This visitor can be used to find the first node satisfying some criterion determined by
* a filter callback. * a filter callback.
*/ */
class FirstFindingVisitor extends NodeVisitorAbstract { class FirstFindingVisitor extends NodeVisitorAbstract
{
/** @var callable Filter callback */ /** @var callable Filter callback */
protected $filterCallback; protected $filterCallback;
/** @var null|Node Found node */ /** @var null|Node Found node */

View File

@ -2,7 +2,8 @@
namespace PhpParser; namespace PhpParser;
interface Parser { interface Parser
{
/** /**
* Parses PHP code into a node tree. * Parses PHP code into a node tree.
* *

View File

@ -6,7 +6,8 @@ use PhpParser\Error;
use PhpParser\ErrorHandler; use PhpParser\ErrorHandler;
use PhpParser\Parser; use PhpParser\Parser;
class Multiple implements Parser { class Multiple implements Parser
{
/** @var Parser[] List of parsers to try, in order of preference */ /** @var Parser[] List of parsers to try, in order of preference */
private $parsers; private $parsers;

View File

@ -2,7 +2,8 @@
namespace PhpParser; namespace PhpParser;
class ParserFactory { class ParserFactory
{
const PREFER_PHP7 = 1; const PREFER_PHP7 = 1;
const PREFER_PHP5 = 2; const PREFER_PHP5 = 2;
const ONLY_PHP7 = 3; const ONLY_PHP7 = 3;

View File

@ -7,7 +7,8 @@ namespace PhpParser;
* *
* @internal * @internal
*/ */
class TokenStream { class TokenStream
{
/** @var array Tokens (in token_get_all format) */ /** @var array Tokens (in token_get_all format) */
private $tokens; private $tokens;
/** @var int[] Map from position to indentation */ /** @var int[] Map from position to indentation */

View File

@ -2,7 +2,8 @@
namespace PhpParser; namespace PhpParser;
class CodeTestParser { class CodeTestParser
{
public function parseTest($code, $chunksPerTest) { public function parseTest($code, $chunksPerTest) {
$code = canonicalize($code); $code = canonicalize($code);

View File

@ -6,7 +6,8 @@ use PhpParser\Node\Expr;
use PhpParser\Node\Scalar; use PhpParser\Node\Scalar;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
class ConstExprEvaluatorTest extends TestCase { class ConstExprEvaluatorTest extends TestCase
{
/** @dataProvider provideTestEvaluate */ /** @dataProvider provideTestEvaluate */
public function testEvaluate($exprString, $expected) { public function testEvaluate($exprString, $expected) {
$parser = new Parser\Php7(new Lexer()); $parser = new Parser\Php7(new Lexer());

View File

@ -4,7 +4,8 @@ namespace PhpParser\Internal;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
class DifferTest extends TestCase { class DifferTest extends TestCase
{
private function formatDiffString(array $diff) { private function formatDiffString(array $diff) {
$diffStr = ''; $diffStr = '';
foreach ($diff as $diffElem) { foreach ($diff as $diffElem) {

View File

@ -4,7 +4,8 @@ namespace PhpParser;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
class JsonDecoderTest extends TestCase { class JsonDecoderTest extends TestCase
{
public function testRoundTrip() { public function testRoundTrip() {
$code = <<<'PHP' $code = <<<'PHP'
<?php <?php

View File

@ -6,7 +6,8 @@ use PhpParser\Node\Name;
use PhpParser\Node\Stmt\Use_; use PhpParser\Node\Stmt\Use_;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
class NameContextTest extends TestCase { class NameContextTest extends TestCase
{
/** /**
* @dataProvider provideTestGetPossibleNames * @dataProvider provideTestGetPossibleNames
*/ */

View File

@ -4,7 +4,8 @@ namespace PhpParser\Node;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
class IdentifierTest extends TestCase { class IdentifierTest extends TestCase
{
public function testToString() { public function testToString() {
$identifier = new Identifier('Foo'); $identifier = new Identifier('Foo');

View File

@ -4,7 +4,8 @@ namespace PhpParser;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
class DummyNode extends NodeAbstract { class DummyNode extends NodeAbstract
{
public $subNode1; public $subNode1;
public $subNode2; public $subNode2;

View File

@ -11,7 +11,8 @@ use PhpParser\ParserTest;
require_once __DIR__ . '/../ParserTest.php'; require_once __DIR__ . '/../ParserTest.php';
class MultipleTest extends ParserTest { class MultipleTest extends ParserTest
{
// This provider is for the generic parser tests, just pick an arbitrary order here // This provider is for the generic parser tests, just pick an arbitrary order here
protected function getParser(Lexer $lexer) { protected function getParser(Lexer $lexer) {
return new Multiple([new Php5($lexer), new Php7($lexer)]); return new Multiple([new Php5($lexer), new Php7($lexer)]);

View File

@ -7,7 +7,8 @@ use PhpParser\ParserTest;
require_once __DIR__ . '/../ParserTest.php'; require_once __DIR__ . '/../ParserTest.php';
class Php5Test extends ParserTest { class Php5Test extends ParserTest
{
protected function getParser(Lexer $lexer) { protected function getParser(Lexer $lexer) {
return new Php5($lexer); return new Php5($lexer);
} }

View File

@ -7,7 +7,8 @@ use PhpParser\ParserTest;
require_once __DIR__ . '/../ParserTest.php'; require_once __DIR__ . '/../ParserTest.php';
class Php7Test extends ParserTest { class Php7Test extends ParserTest
{
protected function getParser(Lexer $lexer) { protected function getParser(Lexer $lexer) {
return new Php7($lexer); return new Php7($lexer);
} }

View File

@ -175,7 +175,8 @@ EOC;
} }
} }
class InvalidTokenLexer extends Lexer { class InvalidTokenLexer extends Lexer
{
public function getNextToken(&$value = null, &$startAttributes = null, &$endAttributes = null) : int { public function getNextToken(&$value = null, &$startAttributes = null, &$endAttributes = null) : int {
$value = 'foobar'; $value = 'foobar';
return 999; return 999;