Skip to content
This repository has been archived by the owner on Mar 20, 2022. It is now read-only.

New Implementation #14

Open
wants to merge 63 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
f2a94a0
Start again
dantleech Jan 20, 2021
a816265
Initial
dantleech Jan 20, 2021
7c803ed
Progress
dantleech Jan 20, 2021
817a5ee
open, close and leading phpdoc
dantleech Jan 20, 2021
afe8a54
Return collection
dantleech Jan 20, 2021
1e9b704
Parser test
dantleech Jan 20, 2021
efa1e2a
Updated README
dantleech Jan 20, 2021
6c5ea45
Parse lists
dantleech Jan 21, 2021
11cb6c1
Printer tests OK, docblock start / end broken
dantleech Jan 22, 2021
a36dae5
Fixed tests
dantleech Jan 22, 2021
a507778
Refactored
dantleech Jan 22, 2021
28459e8
Remove dump
dantleech Jan 23, 2021
38e0a6e
Add bench
dantleech Jan 23, 2021
97f060d
Use dev-master
dantleech Jan 23, 2021
f54f646
Experiment with preg_match_all lexer
dantleech Jan 23, 2021
8e8ea0b
Added phpstan comparison benchmark
dantleech Jan 23, 2021
339ce22
Revert "Experiment with preg_match_all lexer"
dantleech Jan 23, 2021
9cf4db7
Fixed parser test
dantleech Jan 23, 2021
c7797e5
Optimisations
dantleech Jan 23, 2021
61d6dbf
Performance optimization
dantleech Jan 23, 2021
ba68f54
Use token properties
dantleech Jan 23, 2021
a7e599b
Access current as property
dantleech Jan 23, 2021
9da77bf
Add type hint
dantleech Jan 23, 2021
3aae081
Create pattern in constructor
dantleech Jan 23, 2021
27cf88b
Support param text
dantleech Jan 23, 2021
4670c87
Remove skip docblock tokens
dantleech Jan 23, 2021
d01f5e9
Add ignored tests
dantleech Jan 23, 2021
b9258c9
support unknown tag
dantleech Jan 23, 2021
f1b65b4
Support deprecated tag
dantleech Jan 23, 2021
c6bdf9e
Support method node
dantleech Jan 23, 2021
4b02882
Support nullable
dantleech Jan 23, 2021
38ee727
Support property
dantleech Jan 23, 2021
034f18b
Support return node
dantleech Jan 23, 2021
657f344
Support fully qualfiied names
dantleech Jan 23, 2021
a264866
Remove duplicate check
dantleech Jan 23, 2021
15382fb
Use switch (doesn't make any perf diff)
dantleech Jan 23, 2021
3c0abd6
Support NULL and return text
dantleech Jan 23, 2021
8cf1de2
Support method parameters
dantleech Jan 23, 2021
0e38ec9
Support for default method values
dantleech Jan 23, 2021
28df9f5
Updated phpcs
dantleech Jan 24, 2021
eccad5b
Apply CS fixes
dantleech Jan 24, 2021
c3ffc05
Add lexer bench
dantleech Jan 24, 2021
0bfc821
Adding traversal API
dantleech Jan 25, 2021
3f6fdee
Added test for method node
dantleech Jan 25, 2021
9d1e711
Aiming towards 100% isomorphism
dantleech Jan 25, 2021
104e91f
Method node is isomorphic
dantleech Jan 25, 2021
0baa83b
Param node
dantleech Jan 25, 2021
5cd1571
Return node
dantleech Jan 25, 2021
9e6a733
Finish adding node tests
dantleech Jan 26, 2021
c616bcb
Namespaced tag nodes
dantleech Jan 26, 2021
eaec94d
Migrate printer tests
dantleech Jan 26, 2021
3bc0fbf
Add property traversable support
dantleech Jan 27, 2021
013368c
Improving API
dantleech Jan 27, 2021
1384d0b
Apply CS fix
dantleech Jan 27, 2021
aa7e948
Added more API methods
dantleech Jan 27, 2021
878745c
Updated composer, removed baseline
dantleech Jan 27, 2021
0ffbbe0
Render text
dantleech Jan 27, 2021
59af98e
Add API for tags to docblock
dantleech Jan 27, 2021
eb60d2c
FIx docblock get tag
dantleech Jan 31, 2021
91d2d92
Accessor for parameters
dantleech Jan 31, 2021
6006420
Removed core PHP docs from benchmark
dantleech Jan 27, 2021
beae269
Prop assertion
dantleech Jan 31, 2021
6d4b18e
Support for return $this
dantleech Jan 31, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Param node
  • Loading branch information
dantleech committed Jan 25, 2021
commit 0baa83b4c0e3c9c36a9d455da3ea55e9f521ac04
23 changes: 19 additions & 4 deletions lib/Ast/ParamNode.php
Original file line number Diff line number Diff line change
@@ -2,28 +2,43 @@

namespace Phpactor\Docblock\Ast;

use Phpactor\Docblock\Token;

class ParamNode extends TagNode
{
protected const CHILD_NAMES = [
'tag',
'type',
'variable',
'text',
];

/**
* @var ?TypeNode
*/
private $type;
public $type;

/**
* @var ?VariableNode
*/
private $variable;
public $variable;

/**
* @var TextNode|null
*/
private $text;
public $text;

/**
* @var Token
*/
public $tag;

public function __construct(?TypeNode $type, ?VariableNode $variable, ?TextNode $text = null)
public function __construct(Token $tag, ?TypeNode $type, ?VariableNode $variable, ?TextNode $text = null)
{
$this->type = $type;
$this->variable = $variable;
$this->text = $text;
$this->tag = $tag;
}

public function type(): ?TypeNode
4 changes: 2 additions & 2 deletions lib/Parser.php
Original file line number Diff line number Diff line change
@@ -95,7 +95,7 @@ private function parseTag(): TagNode
private function parseParam(): ParamNode
{
$type = $variable = $textNode = null;
$this->tokens->chomp(Token::T_TAG);
$tag = $this->tokens->chomp(Token::T_TAG);

if ($this->ifType()) {
$type = $this->parseTypes();
@@ -105,7 +105,7 @@ private function parseParam(): ParamNode
$variable = $this->parseVariable();
}

return new ParamNode($type, $variable, $this->parseText());
return new ParamNode($tag, $type, $variable, $this->parseText());
}

private function parseVar(): VarNode
24 changes: 24 additions & 0 deletions tests/Unit/Ast/NodeTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace Phpactor\Docblock\Tests\Unit\Ast;

use Generator;
use PHPUnit\Framework\TestCase;
use Phpactor\Docblock\Ast\MethodNode;
use Phpactor\Docblock\Ast\Node;
use Phpactor\Docblock\Ast\ParamNode;

class NodeTest extends NodeTestCase
{
/**
* @return Generator<mixed>
*/
public function provideNode(): Generator
{
yield [
'@param Baz\Bar $foobar',
function (ParamNode $methodNode) {
}
];
}
}