8000 [RFC][Ast][Routing] Use Ast to generate the UrlGenerator by GuilhemN · Pull Request #19555 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[RFC][Ast][Routing] Use Ast to generate the UrlGenerator #19555

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension 10000


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Focus on GeneratorAstGenerator
  • Loading branch information
GuilhemN committed Aug 7, 2016
commit 791a9554e87355798c3c223a57b235c9e65e33f3
34 changes: 34 additions & 0 deletions src/Symfony/Component/Ast/AstDumper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Component\Ast;

use PhpParser\PrettyPrinterAbstract;
use PhpParser\PrettyPrinter\Standard;

final class AstDumper
{
private $printer;

public function __construct(PrettyPrinterAbstract $printer = null)
{
if (null === $printer) {
$printer = new Standard();
}

$this->printer = $printer;
}

public function dump(NodeList $nodeList)
{
return $this->printer->prettyPrintFile($nodeList->getNodes());
}
}
49 changes: 49 additions & 0 deletions src/Symfony/Component/Ast/NodeList.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Component\Ast;

use PhpParser\Node;

final class NodeList
{
private $nodes = array();

/**
* @param Node[] $nodes
*/
public function __construct(array $nodes)
{
foreach ($nodes as $node) {
$this->addNode($node);
}
}

/**
* @return Node[]
*/
public function getNodes()
{
return $this->nodes;
}

public function addNode(Node $node)
{
$this->nodes[] = $node;
}

public function append(NodeList $nodeList)
{
foreach ($nodeList->getNodes() as $node) {
$this->addNode($node);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace Symfony\Component\AstGenerator\Util;
namespace Symfony\Component\Ast\Util;

use PhpParser\Node;
use PhpParser\Node\Expr;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "symfony/ast-generator",
"name": "symfony/ast",
"type": "library",
"description": "Symfony component to generate AST from and to various others components",
"keywords": ["symfony", "ast", "generator"],
"description": "Symfony AST Component",
"keywords": ["symfony", "ast"],
"homepage": "https://symfony.com",
"license": "MIT",
"authors": [
Expand All @@ -17,22 +17,18 @@
],
"require": {
"php": ">=5.5.9",
"nikic/php-parser": "~2.0",
"symfony/property-info": "~2.8|~3.0"
},
"require-dev": {
"symfony/serializer": "~2.8|~3.0"
"nikic/php-parser": "~2.0"
},
"autoload": {
"psr-4": { "Symfony\\Component\\AstGenerator\\": "" },
"psr-4": { "Symfony\\Component\\Ast\\": "" },
"exclude-from-classmap": [
"/Tests/"
]
},
"minimum-stability": "dev",
"extra": {
"branch-alias": {
"dev-master": "3.1-dev"
"dev-master": "3.2-dev"
}
}
}
66 changes: 0 additions & 66 deletions src/Symfony/Component/AstGenerator/AstGeneratorChain.php

This file was deleted.

39 changes: 0 additions & 39 deletions src/Symfony/Component/AstGenerator/AstGeneratorInterface.php

This file was deleted.

This file was deleted.

88 changes: 0 additions & 88 deletions src/Symfony/Component/AstGenerator/Tests/AstGeneratorChainTest.php

This file was deleted.

This file was deleted.

Loading
0