mirror of
https://github.com/phabelio/PHP-Parser.git
synced 2024-11-26 20:14:46 +01:00
[CS] Open class brackets in new line
This commit is contained in:
parent
fc8ac71e76
commit
7f72c84122
@ -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;
|
||||||
|
@ -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.
|
||||||
*
|
*
|
||||||
|
@ -2,4 +2,5 @@
|
|||||||
|
|
||||||
namespace PhpParser;
|
namespace PhpParser;
|
||||||
|
|
||||||
class ConstExprEvaluationException extends \Exception {}
|
class ConstExprEvaluationException extends \Exception
|
||||||
|
{}
|
@ -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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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;
|
||||||
|
@ -10,7 +10,8 @@ namespace PhpParser\Internal;
|
|||||||
*
|
*
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
class Differ {
|
class Differ
|
||||||
|
{
|
||||||
private $isEqual;
|
private $isEqual;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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 */
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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 */
|
||||||
|
@ -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.
|
||||||
*
|
*
|
||||||
|
@ -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);
|
||||||
|
@ -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 */
|
||||||
|
@ -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 */
|
||||||
|
@ -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.
|
||||||
*
|
*
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
@ -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 */
|
||||||
|
@ -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);
|
||||||
|
|
||||||
|
@ -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());
|
||||||
|
@ -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) {
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
*/
|
*/
|
||||||
|
@ -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');
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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)]);
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user