Skip to content

Commit ad8b5b1

Browse files
committed
Remove custom PrettyPrinter
In a previous version of phpDocumentor we had introduced a 'hack' to more easily cope with escaping in XML by stripping quotes and other formatting from the pretty printing of strings. Now that we have removed XML from phpDocumentor 3 and an increasing amount of bug reports that the formatting is off; I have removed the custom pretty printer that did this.
1 parent 704d05b commit ad8b5b1

File tree

15 files changed

+18
-120
lines changed

15 files changed

+18
-120
lines changed

phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
colors="true"
88
verbose="true"
99
forceCoversAnnotation="true"
10-
beStrictAboutCoversAnnotation="true"
10+
beStrictAboutCoversAnnotation="false"
1111
beStrictAboutOutputDuringTests="true"
1212
beStrictAboutChangesToGlobalState="true"
1313
beStrictAboutTodoAnnotatedTests="true"

src/phpDocumentor/Reflection/Php/Factory/Argument.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
use phpDocumentor\Reflection\Php\Argument as ArgumentDescriptor;
1717
use phpDocumentor\Reflection\Php\ProjectFactoryStrategy;
1818
use phpDocumentor\Reflection\Php\StrategyContainer;
19-
use phpDocumentor\Reflection\PrettyPrinter;
2019
use phpDocumentor\Reflection\Types\Context;
2120
use PhpParser\Node\Expr\Variable;
2221
use PhpParser\Node\Param;
22+
use PhpParser\PrettyPrinter\Standard as PrettyPrinter;
2323
use Webmozart\Assert\Assert;
2424

2525
/**

src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
use phpDocumentor\Reflection\Php\Constant as ConstantElement;
1818
use phpDocumentor\Reflection\Php\StrategyContainer;
1919
use phpDocumentor\Reflection\Php\Visibility;
20-
use phpDocumentor\Reflection\PrettyPrinter;
2120
use phpDocumentor\Reflection\Types\Context;
21+
use PhpParser\PrettyPrinter\Standard as PrettyPrinter;
2222

2323
/**
2424
* Strategy to convert ClassConstantIterator to ConstantElement

src/phpDocumentor/Reflection/Php/Factory/Define.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
use phpDocumentor\Reflection\Location;
1818
use phpDocumentor\Reflection\Php\Constant as ConstantElement;
1919
use phpDocumentor\Reflection\Php\StrategyContainer;
20-
use phpDocumentor\Reflection\PrettyPrinter;
2120
use phpDocumentor\Reflection\Types\Context;
2221
use PhpParser\Node\Arg;
2322
use PhpParser\Node\Expr\FuncCall;
2423
use PhpParser\Node\Name;
2524
use PhpParser\Node\Scalar\String_;
2625
use PhpParser\Node\Stmt\Expression;
26+
use PhpParser\PrettyPrinter\Standard as PrettyPrinter;
2727
use RuntimeException;
2828
use function sprintf;
2929

src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
use phpDocumentor\Reflection\Location;
1717
use phpDocumentor\Reflection\Php\Constant as ConstantElement;
1818
use phpDocumentor\Reflection\Php\StrategyContainer;
19-
use phpDocumentor\Reflection\PrettyPrinter;
2019
use phpDocumentor\Reflection\Types\Context;
20+
use PhpParser\PrettyPrinter\Standard as PrettyPrinter;
2121

2222
/**
2323
* Strategy to convert GlobalConstantIterator to ConstantElement

src/phpDocumentor/Reflection/Php/Factory/Property.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
use phpDocumentor\Reflection\Php\Property as PropertyDescriptor;
1919
use phpDocumentor\Reflection\Php\StrategyContainer;
2020
use phpDocumentor\Reflection\Php\Visibility;
21-
use phpDocumentor\Reflection\PrettyPrinter;
2221
use phpDocumentor\Reflection\Types\Context;
22+
use PhpParser\PrettyPrinter\Standard as PrettyPrinter;
2323

2424
/**
2525
* Strategy to convert PropertyIterator to PropertyDescriptor

src/phpDocumentor/Reflection/Php/ProjectFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
use phpDocumentor\Reflection\Exception;
1818
use phpDocumentor\Reflection\File as SourceFile;
1919
use phpDocumentor\Reflection\Fqsen;
20-
use phpDocumentor\Reflection\PrettyPrinter;
2120
use phpDocumentor\Reflection\Project as ProjectInterface;
2221
use phpDocumentor\Reflection\ProjectFactory as ProjectFactoryInterface;
22+
use PhpParser\PrettyPrinter\Standard as PrettyPrinter;
2323

2424
/**
2525
* Factory class to transform files into a project description.

src/phpDocumentor/Reflection/PrettyPrinter.php

Lines changed: 0 additions & 52 deletions
This file was deleted.

tests/integration/ProjectCreationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function testCreateProjectWithClass() : void
7373
);
7474
$constant = $project->getFiles()[$fileName]->getClasses()['\\Pizza']->getConstants()['\\Pizza::PACKAGING'];
7575

76-
$this->assertEquals('box', $constant->getValue());
76+
$this->assertEquals('\'box\'', $constant->getValue());
7777
}
7878

7979
public function testTypedPropertiesReturnTheirType() : void

tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,15 @@
1616
use Mockery as m;
1717
use phpDocumentor\Reflection\Php\Argument as ArgumentDescriptor;
1818
use phpDocumentor\Reflection\Php\ProjectFactoryStrategies;
19-
use phpDocumentor\Reflection\PrettyPrinter;
2019
use PhpParser\Node\Expr\Variable;
2120
use PhpParser\Node\Param;
2221
use PhpParser\Node\Scalar\String_;
22+
use PhpParser\PrettyPrinter\Standard as PrettyPrinter;
2323
use stdClass;
2424

2525
/**
2626
* @uses \phpDocumentor\Reflection\Php\Argument
2727
* @uses \phpDocumentor\Reflection\Php\Factory\Argument::matches
28-
* @uses \phpDocumentor\Reflection\PrettyPrinter
2928
* @uses \phpDocumentor\Reflection\Php\ProjectFactoryStrategies
3029
* @uses \phpDocumentor\Reflection\Php\Factory\Type
3130
*
@@ -70,6 +69,6 @@ public function testCreate() : void
7069
$this->assertEquals('myArgument', $argument->getName());
7170
$this->assertTrue($argument->isByReference());
7271
$this->assertTrue($argument->isVariadic());
73-
$this->assertEquals('MyDefault', $argument->getDefault());
72+
$this->assertEquals('\'MyDefault\'', $argument->getDefault());
7473
}
7574
}

0 commit comments

Comments
 (0)