2018-01-29 05:41:11 +01:00
|
|
|
|
<?php
|
2020-11-28 03:48:16 +01:00
|
|
|
|
|
2018-01-29 05:41:11 +01:00
|
|
|
|
namespace Psalm\Tests;
|
|
|
|
|
|
2020-11-28 03:48:16 +01:00
|
|
|
|
use DOMAttr;
|
|
|
|
|
use DOMDocument;
|
|
|
|
|
use DOMXPath;
|
|
|
|
|
use PHPUnit\Framework\Constraint\Constraint;
|
|
|
|
|
use Psalm\Config;
|
|
|
|
|
use Psalm\Context;
|
|
|
|
|
use Psalm\DocComment;
|
|
|
|
|
use Psalm\Internal\RuntimeCaches;
|
|
|
|
|
use Psalm\Tests\Internal\Provider;
|
|
|
|
|
|
|
|
|
|
use function array_filter;
|
2019-07-05 22:24:00 +02:00
|
|
|
|
use function array_keys;
|
2020-11-28 03:48:16 +01:00
|
|
|
|
use function array_shift;
|
2019-07-05 22:24:00 +02:00
|
|
|
|
use function count;
|
|
|
|
|
use function dirname;
|
|
|
|
|
use function explode;
|
|
|
|
|
use function file_exists;
|
|
|
|
|
use function file_get_contents;
|
2020-11-28 03:48:16 +01:00
|
|
|
|
use function glob;
|
2019-07-05 22:24:00 +02:00
|
|
|
|
use function implode;
|
2020-11-28 03:48:16 +01:00
|
|
|
|
use function in_array;
|
2019-07-05 22:24:00 +02:00
|
|
|
|
use function preg_quote;
|
2019-06-26 22:52:29 +02:00
|
|
|
|
use function sort;
|
|
|
|
|
use function strpos;
|
2020-11-28 03:48:16 +01:00
|
|
|
|
use function str_replace;
|
2019-07-05 22:24:00 +02:00
|
|
|
|
use function substr;
|
|
|
|
|
use function trim;
|
2020-08-16 22:26:54 +02:00
|
|
|
|
use function var_export;
|
2018-01-29 05:41:11 +01:00
|
|
|
|
|
2020-11-28 03:48:16 +01:00
|
|
|
|
use const DIRECTORY_SEPARATOR;
|
|
|
|
|
use const LIBXML_NONET;
|
|
|
|
|
|
2018-01-29 05:41:11 +01:00
|
|
|
|
class DocumentationTest extends TestCase
|
|
|
|
|
{
|
2020-11-28 03:48:16 +01:00
|
|
|
|
/**
|
|
|
|
|
* a list of all files containing annotation documentation
|
|
|
|
|
*/
|
|
|
|
|
private const ANNOTATION_DOCS = [
|
|
|
|
|
'docs/annotating_code/supported_annotations.md',
|
|
|
|
|
'docs/annotating_code/templated_annotations.md',
|
|
|
|
|
'docs/annotating_code/adding_assertions.md',
|
|
|
|
|
'docs/security_analysis/annotations.md',
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* annotations that we don’t want documented
|
|
|
|
|
*/
|
|
|
|
|
private const INTENTIONALLY_UNDOCUMENTED_ANNOTATIONS = [
|
|
|
|
|
'@psalm-self-out', // I'm fairly sure it's intentionally undocumented, but can't find the reference
|
|
|
|
|
'@psalm-variadic',
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* These should be documented
|
|
|
|
|
*/
|
|
|
|
|
private const WALL_OF_SHAME = [
|
|
|
|
|
'@psalm-assert-untainted',
|
|
|
|
|
'@psalm-consistent-constructor',
|
|
|
|
|
'@psalm-flow',
|
|
|
|
|
'@psalm-generator-return',
|
|
|
|
|
'@psalm-ignore-variable-method',
|
|
|
|
|
'@psalm-ignore-variable-property',
|
|
|
|
|
'@psalm-override-method-visibility',
|
|
|
|
|
'@psalm-override-property-visibility',
|
|
|
|
|
'@psalm-scope-this',
|
|
|
|
|
'@psalm-seal-methods',
|
|
|
|
|
'@psalm-stub-override',
|
|
|
|
|
'@psalm-taint-unescape',
|
|
|
|
|
'@psalm-yield',
|
|
|
|
|
];
|
|
|
|
|
|
2018-11-06 03:57:36 +01:00
|
|
|
|
/** @var \Psalm\Internal\Analyzer\ProjectAnalyzer */
|
2018-11-11 18:01:14 +01:00
|
|
|
|
protected $project_analyzer;
|
2018-01-29 05:41:11 +01:00
|
|
|
|
|
2020-11-28 03:48:16 +01:00
|
|
|
|
/** @var string */
|
|
|
|
|
private static $docContents = '';
|
|
|
|
|
|
2018-01-29 05:41:11 +01:00
|
|
|
|
/**
|
|
|
|
|
* @return array<string, array<int, string>>
|
|
|
|
|
*/
|
2020-09-12 17:24:05 +02:00
|
|
|
|
private static function getCodeBlocksFromDocs(): array
|
2018-01-29 05:41:11 +01:00
|
|
|
|
{
|
2020-03-19 17:32:49 +01:00
|
|
|
|
$issues_dir = dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'docs' . DIRECTORY_SEPARATOR . 'running_psalm' . DIRECTORY_SEPARATOR . 'issues';
|
2018-01-29 05:41:11 +01:00
|
|
|
|
|
2020-03-19 17:32:49 +01:00
|
|
|
|
if (!file_exists($issues_dir)) {
|
2018-01-29 05:41:11 +01:00
|
|
|
|
throw new \UnexpectedValueException('docs not found');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$issue_code = [];
|
|
|
|
|
|
2020-03-19 17:32:49 +01:00
|
|
|
|
foreach (glob($issues_dir . '/*.md') as $file_path) {
|
|
|
|
|
$file_contents = file_get_contents($file_path);
|
2018-01-29 05:41:11 +01:00
|
|
|
|
|
2020-03-19 17:32:49 +01:00
|
|
|
|
$file_lines = explode("\n", $file_contents);
|
2018-01-29 05:41:11 +01:00
|
|
|
|
|
2020-03-19 17:32:49 +01:00
|
|
|
|
$current_issue = str_replace('# ', '', array_shift($file_lines));
|
2018-01-29 05:41:11 +01:00
|
|
|
|
|
2020-03-19 17:32:49 +01:00
|
|
|
|
for ($i = 0, $j = count($file_lines); $i < $j; ++$i) {
|
|
|
|
|
$current_line = $file_lines[$i];
|
2018-01-29 05:41:11 +01:00
|
|
|
|
|
2020-03-19 17:32:49 +01:00
|
|
|
|
if (substr($current_line, 0, 6) === '```php' && $current_issue) {
|
|
|
|
|
$current_block = '';
|
2018-01-29 05:41:11 +01:00
|
|
|
|
++$i;
|
|
|
|
|
|
2020-03-19 17:32:49 +01:00
|
|
|
|
do {
|
|
|
|
|
$current_block .= $file_lines[$i] . "\n";
|
|
|
|
|
++$i;
|
|
|
|
|
} while (substr($file_lines[$i], 0, 3) !== '```' && $i < $j);
|
|
|
|
|
|
|
|
|
|
$issue_code[$current_issue][] = trim($current_block);
|
|
|
|
|
|
|
|
|
|
continue 2;
|
|
|
|
|
}
|
2018-01-29 05:41:11 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $issue_code;
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-17 00:36:36 +02:00
|
|
|
|
public function setUp() : void
|
2018-01-29 05:41:11 +01:00
|
|
|
|
{
|
2020-08-23 16:32:07 +02:00
|
|
|
|
RuntimeCaches::clearAll();
|
2018-01-29 05:41:11 +01:00
|
|
|
|
|
|
|
|
|
$this->file_provider = new Provider\FakeFileProvider();
|
|
|
|
|
|
2018-11-11 18:01:14 +01:00
|
|
|
|
$this->project_analyzer = new \Psalm\Internal\Analyzer\ProjectAnalyzer(
|
2018-01-29 05:41:11 +01:00
|
|
|
|
new TestConfig(),
|
2018-11-06 03:57:36 +01:00
|
|
|
|
new \Psalm\Internal\Provider\Providers(
|
2018-09-28 22:18:45 +02:00
|
|
|
|
$this->file_provider,
|
|
|
|
|
new Provider\FakeParserCacheProvider()
|
|
|
|
|
)
|
2018-01-29 05:41:11 +01:00
|
|
|
|
);
|
2019-02-07 21:27:43 +01:00
|
|
|
|
|
2020-09-01 04:59:47 +02:00
|
|
|
|
$this->project_analyzer->setPhpVersion('8.0');
|
2018-01-29 05:41:11 +01:00
|
|
|
|
}
|
|
|
|
|
|
2020-06-23 22:56:39 +02:00
|
|
|
|
public function testAllIssuesCoveredInConfigSchema(): void
|
|
|
|
|
{
|
|
|
|
|
$all_issues = \Psalm\Config\IssueHandler::getAllIssueTypes();
|
|
|
|
|
$all_issues[] = 'PluginIssue'; // not an ordinary issue
|
|
|
|
|
sort($all_issues);
|
|
|
|
|
|
|
|
|
|
$schema = new DOMDocument();
|
|
|
|
|
$schema->load(__DIR__ . '/../config.xsd', LIBXML_NONET);
|
|
|
|
|
|
|
|
|
|
$xpath = new DOMXPath($schema);
|
|
|
|
|
$xpath->registerNamespace('xs', 'http://www.w3.org/2001/XMLSchema');
|
|
|
|
|
|
|
|
|
|
/** @var iterable<mixed, DOMAttr> $handlers */
|
|
|
|
|
$handlers = $xpath->query('//xs:complexType[@name="IssueHandlersType"]/xs:choice/xs:element/@name');
|
|
|
|
|
$handler_types = [];
|
|
|
|
|
foreach ($handlers as $handler) {
|
|
|
|
|
$handler_types[] = $handler->value;
|
|
|
|
|
}
|
|
|
|
|
sort($handler_types);
|
|
|
|
|
|
|
|
|
|
$this->assertSame(implode("\n", $all_issues), implode("\n", $handler_types));
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-12 17:24:05 +02:00
|
|
|
|
public function testAllIssuesCovered(): void
|
2018-01-29 06:39:21 +01:00
|
|
|
|
{
|
2019-05-03 21:29:44 +02:00
|
|
|
|
$all_issues = \Psalm\Config\IssueHandler::getAllIssueTypes();
|
|
|
|
|
$all_issues[] = 'ParseError';
|
|
|
|
|
$all_issues[] = 'PluginIssue';
|
|
|
|
|
|
2018-01-29 06:39:21 +01:00
|
|
|
|
sort($all_issues);
|
|
|
|
|
|
|
|
|
|
$code_blocks = self::getCodeBlocksFromDocs();
|
|
|
|
|
|
|
|
|
|
// these cannot have code
|
|
|
|
|
$code_blocks['UnrecognizedExpression'] = true;
|
|
|
|
|
$code_blocks['UnrecognizedStatement'] = true;
|
2019-01-07 14:38:56 +01:00
|
|
|
|
$code_blocks['PluginIssue'] = true;
|
2019-08-04 16:37:36 +02:00
|
|
|
|
$code_blocks['TaintedInput'] = true;
|
2020-11-17 18:44:31 +01:00
|
|
|
|
$code_blocks['TaintedCustom'] = true;
|
2020-11-27 23:02:37 +01:00
|
|
|
|
$code_blocks['ComplexFunction'] = true;
|
|
|
|
|
$code_blocks['ComplexMethod'] = true;
|
2018-01-29 06:39:21 +01:00
|
|
|
|
|
|
|
|
|
$documented_issues = array_keys($code_blocks);
|
|
|
|
|
sort($documented_issues);
|
|
|
|
|
|
2018-04-13 01:42:24 +02:00
|
|
|
|
$this->assertSame(implode("\n", $all_issues), implode("\n", $documented_issues));
|
2018-01-29 06:39:21 +01:00
|
|
|
|
}
|
|
|
|
|
|
2018-01-29 05:41:11 +01:00
|
|
|
|
/**
|
2018-11-06 03:57:36 +01:00
|
|
|
|
* @dataProvider providerInvalidCodeParse
|
2018-01-29 05:41:11 +01:00
|
|
|
|
* @small
|
|
|
|
|
*
|
|
|
|
|
* @param string $code
|
|
|
|
|
* @param string $error_message
|
|
|
|
|
* @param array<string> $error_levels
|
|
|
|
|
* @param bool $check_references
|
|
|
|
|
*
|
|
|
|
|
*/
|
2020-09-12 17:24:05 +02:00
|
|
|
|
public function testInvalidCode($code, $error_message, $error_levels = [], $check_references = false): void
|
2018-01-29 05:41:11 +01:00
|
|
|
|
{
|
2018-07-13 23:44:50 +02:00
|
|
|
|
if (strpos($this->getTestName(), 'SKIPPED-') !== false) {
|
2018-01-29 05:41:11 +01:00
|
|
|
|
$this->markTestSkipped();
|
|
|
|
|
}
|
|
|
|
|
|
2018-02-04 00:52:35 +01:00
|
|
|
|
if ($check_references) {
|
2018-11-11 18:01:14 +01:00
|
|
|
|
$this->project_analyzer->getCodebase()->reportUnusedCode();
|
2019-08-18 20:27:50 +02:00
|
|
|
|
$this->project_analyzer->trackUnusedSuppressions();
|
2018-02-04 00:52:35 +01:00
|
|
|
|
}
|
2018-01-29 05:41:11 +01:00
|
|
|
|
|
2020-11-17 18:44:31 +01:00
|
|
|
|
$is_taint_test = strpos($error_message, 'Tainted') !== false;
|
|
|
|
|
|
2019-11-11 15:59:56 +01:00
|
|
|
|
$is_array_offset_test = strpos($error_message, 'ArrayOffset') && strpos($error_message, 'PossiblyUndefined') !== false;
|
|
|
|
|
|
|
|
|
|
$this->project_analyzer->getConfig()->ensure_array_string_offsets_exist = $is_array_offset_test;
|
|
|
|
|
$this->project_analyzer->getConfig()->ensure_array_int_offsets_exist = $is_array_offset_test;
|
|
|
|
|
|
2018-01-29 05:41:11 +01:00
|
|
|
|
foreach ($error_levels as $error_level) {
|
2018-11-11 18:01:14 +01:00
|
|
|
|
$this->project_analyzer->getCodebase()->config->setCustomErrorLevel($error_level, Config::REPORT_SUPPRESS);
|
2018-01-29 05:41:11 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-02-23 22:22:39 +01:00
|
|
|
|
$this->expectException(\Psalm\Exception\CodeException::class);
|
2019-01-12 16:52:23 +01:00
|
|
|
|
$this->expectExceptionMessageRegExp('/\b' . preg_quote($error_message, '/') . '\b/');
|
2018-01-29 05:41:11 +01:00
|
|
|
|
|
2020-10-30 00:41:10 +01:00
|
|
|
|
$codebase = $this->project_analyzer->getCodebase();
|
|
|
|
|
$codebase->config->visitPreloadedStubFiles($codebase);
|
|
|
|
|
|
2018-01-29 05:41:11 +01:00
|
|
|
|
$file_path = self::$src_dir_path . 'somefile.php';
|
|
|
|
|
|
|
|
|
|
$this->addFile($file_path, $code);
|
|
|
|
|
|
2020-11-17 18:44:31 +01:00
|
|
|
|
if ($is_taint_test) {
|
|
|
|
|
$this->project_analyzer->trackTaintedInputs();
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-28 21:30:56 +01:00
|
|
|
|
$this->analyzeFile($file_path, new Context());
|
2018-01-29 05:41:11 +01:00
|
|
|
|
|
|
|
|
|
if ($check_references) {
|
2019-12-02 21:24:01 +01:00
|
|
|
|
$this->project_analyzer->consolidateAnalyzedData();
|
2018-01-29 05:41:11 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2019-02-23 22:22:39 +01:00
|
|
|
|
* @return array<string,array{string,string,string[],bool}>
|
2018-01-29 05:41:11 +01:00
|
|
|
|
*/
|
2020-09-12 17:24:05 +02:00
|
|
|
|
public function providerInvalidCodeParse(): array
|
2018-01-29 05:41:11 +01:00
|
|
|
|
{
|
|
|
|
|
$invalid_code_data = [];
|
|
|
|
|
|
|
|
|
|
foreach (self::getCodeBlocksFromDocs() as $issue_name => $blocks) {
|
|
|
|
|
switch ($issue_name) {
|
2018-06-22 07:13:49 +02:00
|
|
|
|
case 'MissingThrowsDocblock':
|
|
|
|
|
continue 2;
|
|
|
|
|
|
2019-03-24 21:17:14 +01:00
|
|
|
|
case 'UncaughtThrowInGlobalScope':
|
|
|
|
|
continue 2;
|
|
|
|
|
|
2018-03-06 18:19:50 +01:00
|
|
|
|
case 'InvalidStringClass':
|
|
|
|
|
continue 2;
|
|
|
|
|
|
2018-09-18 23:08:32 +02:00
|
|
|
|
case 'ForbiddenEcho':
|
|
|
|
|
continue 2;
|
|
|
|
|
|
2019-01-07 14:38:56 +01:00
|
|
|
|
case 'PluginClass':
|
|
|
|
|
continue 2;
|
|
|
|
|
|
2020-07-30 16:25:59 +02:00
|
|
|
|
case 'RedundantIdentityWithTrue':
|
|
|
|
|
continue 2;
|
|
|
|
|
|
2020-10-04 05:22:26 +02:00
|
|
|
|
case 'TraitMethodSignatureMismatch':
|
|
|
|
|
continue 2;
|
|
|
|
|
|
2018-01-29 05:41:11 +01:00
|
|
|
|
case 'InvalidFalsableReturnType':
|
|
|
|
|
$ignored_issues = ['FalsableReturnStatement'];
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'InvalidNullableReturnType':
|
|
|
|
|
$ignored_issues = ['NullableReturnStatement'];
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'InvalidReturnType':
|
|
|
|
|
$ignored_issues = ['InvalidReturnStatement'];
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'MixedInferredReturnType':
|
|
|
|
|
$ignored_issues = ['MixedReturnStatement'];
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'MixedStringOffsetAssignment':
|
|
|
|
|
$ignored_issues = ['MixedAssignment'];
|
|
|
|
|
break;
|
|
|
|
|
|
2018-05-08 22:34:08 +02:00
|
|
|
|
case 'ParadoxicalCondition':
|
|
|
|
|
$ignored_issues = ['MissingParamType'];
|
|
|
|
|
break;
|
|
|
|
|
|
2018-01-29 05:41:11 +01:00
|
|
|
|
case 'UnusedClass':
|
|
|
|
|
case 'UnusedMethod':
|
|
|
|
|
$ignored_issues = ['UnusedVariable'];
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
$ignored_issues = [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$invalid_code_data[$issue_name] = [
|
2020-03-21 00:15:06 +01:00
|
|
|
|
$blocks[0],
|
2018-01-29 05:41:11 +01:00
|
|
|
|
$issue_name,
|
|
|
|
|
$ignored_issues,
|
2019-09-19 17:59:43 +02:00
|
|
|
|
strpos($issue_name, 'Unused') !== false
|
|
|
|
|
|| strpos($issue_name, 'Unevaluated') !== false
|
|
|
|
|
|| strpos($issue_name, 'Unnecessary') !== false,
|
2018-01-29 05:41:11 +01:00
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $invalid_code_data;
|
|
|
|
|
}
|
2020-08-16 22:26:54 +02:00
|
|
|
|
|
|
|
|
|
public function testShortcodesAreUnique(): void
|
|
|
|
|
{
|
|
|
|
|
$all_issues = \Psalm\Config\IssueHandler::getAllIssueTypes();
|
|
|
|
|
$all_shortcodes = [];
|
|
|
|
|
|
|
|
|
|
foreach ($all_issues as $issue_type) {
|
|
|
|
|
$issue_class = '\\Psalm\\Issue\\' . $issue_type;
|
|
|
|
|
/** @var int $shortcode */
|
|
|
|
|
$shortcode = $issue_class::SHORTCODE;
|
|
|
|
|
$all_shortcodes[$shortcode][] = $issue_type;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$duplicate_shortcodes = array_filter(
|
|
|
|
|
$all_shortcodes,
|
2020-09-12 17:24:05 +02:00
|
|
|
|
function ($issues): bool {
|
2020-08-16 22:26:54 +02:00
|
|
|
|
return count($issues) > 1;
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$this->assertEquals(
|
|
|
|
|
[],
|
|
|
|
|
$duplicate_shortcodes,
|
|
|
|
|
"Duplicate shortcodes found: \n" . var_export($duplicate_shortcodes, true)
|
|
|
|
|
);
|
|
|
|
|
}
|
2020-11-28 03:48:16 +01:00
|
|
|
|
|
|
|
|
|
/** @dataProvider knownAnnotations */
|
|
|
|
|
public function testAllAnnotationsAreDocumented(string $annotation): void
|
|
|
|
|
{
|
|
|
|
|
if ('' === self::$docContents) {
|
|
|
|
|
foreach (self::ANNOTATION_DOCS as $file) {
|
|
|
|
|
self::$docContents .= file_get_contents(__DIR__ . '/../' . $file);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$this->assertThat(
|
|
|
|
|
self::$docContents,
|
|
|
|
|
$this->conciseExpected($this->stringContains('@psalm-' . $annotation)),
|
|
|
|
|
"'@psalm-$annotation' is not present in the docs"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** @return iterable<string, array{string}> */
|
|
|
|
|
public function knownAnnotations(): iterable
|
|
|
|
|
{
|
|
|
|
|
foreach (DocComment::PSALM_ANNOTATIONS as $annotation) {
|
|
|
|
|
if (in_array('@psalm-' . $annotation, self::INTENTIONALLY_UNDOCUMENTED_ANNOTATIONS, true)) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (in_array('@psalm-' . $annotation, self::WALL_OF_SHAME, true)) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
yield $annotation => [$annotation];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates a constraint wrapper that displays the expected value in a concise form
|
|
|
|
|
*/
|
|
|
|
|
public function conciseExpected(Constraint $inner): Constraint
|
|
|
|
|
{
|
|
|
|
|
return new class ($inner) extends Constraint
|
|
|
|
|
{
|
|
|
|
|
/** @var Constraint */
|
|
|
|
|
private $inner;
|
|
|
|
|
|
|
|
|
|
public function __construct(Constraint $inner)
|
|
|
|
|
{
|
|
|
|
|
$this->inner = $inner;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function toString(): string
|
|
|
|
|
{
|
|
|
|
|
return $this->inner->toString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected function matches($other): bool
|
|
|
|
|
{
|
|
|
|
|
return $this->inner->matches($other);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected function failureDescription($other): string
|
|
|
|
|
{
|
|
|
|
|
return $this->exporter()->shortenedExport($other) . ' ' . $this->toString();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
2018-01-29 05:41:11 +01:00
|
|
|
|
}
|