?????????? ????????? - ??????????????? - /home/agenciai/public_html/cd38d8/Baseline.zip
???????
PK �(\�p+} } ) Exception/CannotLoadBaselineException.phpnu �[��� <?php declare(strict_types=1); /* * This file is part of PHPUnit. * * (c) Sebastian Bergmann <sebastian@phpunit.de> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace PHPUnit\Runner\Baseline; use PHPUnit\Runner\Exception; use RuntimeException; /** * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit * * @internal This class is not covered by the backward compatibility promise for PHPUnit */ final class CannotLoadBaselineException extends RuntimeException implements Exception { } PK �(\�q��� � * Exception/FileDoesNotHaveLineException.phpnu �[��� <?php declare(strict_types=1); /* * This file is part of PHPUnit. * * (c) Sebastian Bergmann <sebastian@phpunit.de> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace PHPUnit\Runner\Baseline; use function sprintf; use PHPUnit\Runner\Exception; use RuntimeException; /** * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit * * @internal This class is not covered by the backward compatibility promise for PHPUnit */ final class FileDoesNotHaveLineException extends RuntimeException implements Exception { public function __construct(string $file, int $line) { parent::__construct( sprintf( 'File "%s" does not have line %d', $file, $line, ), ); } } PK �(\��-# # RelativePathCalculator.phpnu �[��� <?php declare(strict_types=1); /* * This file is part of PHPUnit. * * (c) Sebastian Bergmann <sebastian@phpunit.de> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace PHPUnit\Runner\Baseline; use function array_fill; use function array_merge; use function array_slice; use function assert; use function count; use function explode; use function implode; use function str_replace; use function strpos; use function substr; use function trim; /** * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit * * @internal This class is not covered by the backward compatibility promise for PHPUnit * * @see Copied from https://github.com/phpstan/phpstan-src/blob/1.10.33/src/File/ParentDirectoryRelativePathHelper.php */ final class RelativePathCalculator { /** * @psalm-var non-empty-string $baselineDirectory */ private readonly string $baselineDirectory; /** * @psalm-param non-empty-string $baselineDirectory */ public function __construct(string $baselineDirectory) { $this->baselineDirectory = $baselineDirectory; } /** * @psalm-param non-empty-string $filename * * @psalm-return non-empty-string */ public function calculate(string $filename): string { $result = implode('/', $this->parts($filename)); assert($result !== ''); return $result; } /** * @psalm-param non-empty-string $filename * * @psalm-return list<non-empty-string> */ public function parts(string $filename): array { $schemePosition = strpos($filename, '://'); if ($schemePosition !== false) { $filename = substr($filename, $schemePosition + 3); assert($filename !== ''); } $parentParts = explode('/', trim(str_replace('\\', '/', $this->baselineDirectory), '/')); $parentPartsCount = count($parentParts); $filenameParts = explode('/', trim(str_replace('\\', '/', $filename), '/')); $filenamePartsCount = count($filenameParts); $i = 0; for (; $i < $filenamePartsCount; $i++) { if ($parentPartsCount < $i + 1) { break; } $parentPath = implode('/', array_slice($parentParts, 0, $i + 1)); $filenamePath = implode('/', array_slice($filenameParts, 0, $i + 1)); if ($parentPath !== $filenamePath) { break; } } if ($i === 0) { return [$filename]; } $dotsCount = $parentPartsCount - $i; assert($dotsCount >= 0); return array_merge(array_fill(0, $dotsCount, '..'), array_slice($filenameParts, $i)); } } PK �(\@G��� � Generator.phpnu �[��� <?php declare(strict_types=1); /* * This file is part of PHPUnit. * * (c) Sebastian Bergmann <sebastian@phpunit.de> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace PHPUnit\Runner\Baseline; use PHPUnit\Event\EventFacadeIsSealedException; use PHPUnit\Event\Facade; use PHPUnit\Event\Test\DeprecationTriggered; use PHPUnit\Event\Test\NoticeTriggered; use PHPUnit\Event\Test\PhpDeprecationTriggered; use PHPUnit\Event\Test\PhpNoticeTriggered; use PHPUnit\Event\Test\PhpWarningTriggered; use PHPUnit\Event\Test\WarningTriggered; use PHPUnit\Event\UnknownSubscriberTypeException; use PHPUnit\Runner\FileDoesNotExistException; use PHPUnit\TextUI\Configuration\Source; use PHPUnit\TextUI\Configuration\SourceFilter; /** * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit * * @internal This class is not covered by the backward compatibility promise for PHPUnit */ final class Generator { private Baseline $baseline; private readonly Source $source; /** * @throws EventFacadeIsSealedException * @throws UnknownSubscriberTypeException */ public function __construct(Facade $facade, Source $source) { $facade->registerSubscribers( new TestTriggeredDeprecationSubscriber($this), new TestTriggeredNoticeSubscriber($this), new TestTriggeredPhpDeprecationSubscriber($this), new TestTriggeredPhpNoticeSubscriber($this), new TestTriggeredPhpWarningSubscriber($this), new TestTriggeredWarningSubscriber($this), ); $this->baseline = new Baseline; $this->source = $source; } public function baseline(): Baseline { return $this->baseline; } /** * @throws FileDoesNotExistException * @throws FileDoesNotHaveLineException */ public function testTriggeredIssue(DeprecationTriggered|NoticeTriggered|PhpDeprecationTriggered|PhpNoticeTriggered|PhpWarningTriggered|WarningTriggered $event): void { if ($event->wasSuppressed() && !$this->isSuppressionIgnored($event)) { return; } if ($this->restrict($event) && !SourceFilter::instance()->includes($event->file())) { return; } $this->baseline->add( Issue::from( $event->file(), $event->line(), null, $event->message(), ), ); } private function restrict(DeprecationTriggered|NoticeTriggered|PhpDeprecationTriggered|PhpNoticeTriggered|PhpWarningTriggered|WarningTriggered $event): bool { if ($event instanceof WarningTriggered || $event instanceof PhpWarningTriggered) { return $this->source->restrictWarnings(); } if ($event instanceof NoticeTriggered || $event instanceof PhpNoticeTriggered) { return $this->source->restrictNotices(); } return $this->source->restrictDeprecations(); } private function isSuppressionIgnored(DeprecationTriggered|NoticeTriggered|PhpDeprecationTriggered|PhpNoticeTriggered|PhpWarningTriggered|WarningTriggered $event): bool { if ($event instanceof WarningTriggered) { return $this->source->ignoreSuppressionOfWarnings(); } if ($event instanceof PhpWarningTriggered) { return $this->source->ignoreSuppressionOfPhpWarnings(); } if ($event instanceof PhpNoticeTriggered) { return $this->source->ignoreSuppressionOfPhpNotices(); } if ($event instanceof NoticeTriggered) { return $this->source->ignoreSuppressionOfNotices(); } if ($event instanceof PhpDeprecationTriggered) { return $this->source->ignoreSuppressionOfPhpDeprecations(); } return $this->source->ignoreSuppressionOfDeprecations(); } } PK �(\����� � Issue.phpnu �[��� <?php declare(strict_types=1); /* * This file is part of PHPUnit. * * (c) Sebastian Bergmann <sebastian@phpunit.de> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace PHPUnit\Runner\Baseline; use const FILE_IGNORE_NEW_LINES; use function assert; use function file; use function is_file; use function sha1; use PHPUnit\Runner\FileDoesNotExistException; /** * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit * * @internal This class is not covered by the backward compatibility promise for PHPUnit */ final class Issue { /** * @psalm-var non-empty-string */ private readonly string $file; /** * @psalm-var positive-int */ private readonly int $line; /** * @psalm-var non-empty-string */ private readonly string $hash; /** * @psalm-var non-empty-string */ private readonly string $description; /** * @psalm-param non-empty-string $file * @psalm-param positive-int $line * @psalm-param ?non-empty-string $hash * @psalm-param non-empty-string $description * * @throws FileDoesNotExistException * @throws FileDoesNotHaveLineException */ public static function from(string $file, int $line, ?string $hash, string $description): self { if ($hash === null) { $hash = self::calculateHash($file, $line); } return new self($file, $line, $hash, $description); } /** * @psalm-param non-empty-string $file * @psalm-param positive-int $line * @psalm-param non-empty-string $hash * @psalm-param non-empty-string $description */ private function __construct(string $file, int $line, string $hash, string $description) { $this->file = $file; $this->line = $line; $this->hash = $hash; $this->description = $description; } /** * @psalm-return non-empty-string */ public function file(): string { return $this->file; } /** * @psalm-return positive-int */ public function line(): int { return $this->line; } /** * @psalm-return non-empty-string */ public function hash(): string { return $this->hash; } /** * @psalm-return non-empty-string */ public function description(): string { return $this->description; } public function equals(self $other): bool { return $this->file() === $other->file() && $this->line() === $other->line() && $this->hash() === $other->hash() && $this->description() === $other->description(); } /** * @psalm-param non-empty-string $file * @psalm-param positive-int $line * * @throws FileDoesNotExistException * @throws FileDoesNotHaveLineException * * @psalm-return non-empty-string */ private static function calculateHash(string $file, int $line): string { $lines = @file($file, FILE_IGNORE_NEW_LINES); if ($lines === false && !is_file($file)) { throw new FileDoesNotExistException($file); } $key = $line - 1; if (!isset($lines[$key])) { throw new FileDoesNotHaveLineException($file, $line); } $hash = sha1($lines[$key]); assert($hash !== ''); return $hash; } } PK �(\�!�� � Writer.phpnu �[��� <?php declare(strict_types=1); /* * This file is part of PHPUnit. * * (c) Sebastian Bergmann <sebastian@phpunit.de> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace PHPUnit\Runner\Baseline; use function assert; use function dirname; use function file_put_contents; use XMLWriter; /** * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit * * @internal This class is not covered by the backward compatibility promise for PHPUnit */ final class Writer { /** * @psalm-param non-empty-string $baselineFile */ public function write(string $baselineFile, Baseline $baseline): void { $pathCalculator = new RelativePathCalculator(dirname($baselineFile)); $writer = new XMLWriter; $writer->openMemory(); $writer->setIndent(true); $writer->startDocument(); $writer->startElement('files'); $writer->writeAttribute('version', (string) Baseline::VERSION); foreach ($baseline->groupedByFileAndLine() as $file => $lines) { assert(!empty($file)); $writer->startElement('file'); $writer->writeAttribute('path', $pathCalculator->calculate($file)); foreach ($lines as $line => $issues) { $writer->startElement('line'); $writer->writeAttribute('number', (string) $line); $writer->writeAttribute('hash', $issues[0]->hash()); foreach ($issues as $issue) { $writer->startElement('issue'); $writer->writeCData($issue->description()); $writer->endElement(); } $writer->endElement(); } $writer->endElement(); } $writer->endElement(); file_put_contents($baselineFile, $writer->outputMemory()); } } PK �(\ 8�Z� � - Subscriber/TestTriggeredWarningSubscriber.phpnu �[��� <?php declare(strict_types=1); /* * This file is part of PHPUnit. * * (c) Sebastian Bergmann <sebastian@phpunit.de> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace PHPUnit\Runner\Baseline; use PHPUnit\Event\Test\WarningTriggered; use PHPUnit\Event\Test\WarningTriggeredSubscriber; use PHPUnit\Runner\FileDoesNotExistException; /** * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit * * @internal This class is not covered by the backward compatibility promise for PHPUnit */ final class TestTriggeredWarningSubscriber extends Subscriber implements WarningTriggeredSubscriber { /** * @throws FileDoesNotExistException * @throws FileDoesNotHaveLineException */ public function notify(WarningTriggered $event): void { $this->generator()->testTriggeredIssue($event); } } PK �(\B��� � 0 Subscriber/TestTriggeredPhpWarningSubscriber.phpnu �[��� <?php declare(strict_types=1); /* * This file is part of PHPUnit. * * (c) Sebastian Bergmann <sebastian@phpunit.de> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace PHPUnit\Runner\Baseline; use PHPUnit\Event\Test\PhpWarningTriggered; use PHPUnit\Event\Test\PhpWarningTriggeredSubscriber; use PHPUnit\Runner\FileDoesNotExistException; /** * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit * * @internal This class is not covered by the backward compatibility promise for PHPUnit */ final class TestTriggeredPhpWarningSubscriber extends Subscriber implements PhpWarningTriggeredSubscriber { /** * @throws FileDoesNotExistException * @throws FileDoesNotHaveLineException */ public function notify(PhpWarningTriggered $event): void { $this->generator()->testTriggeredIssue($event); } } PK �(\]���� � 4 Subscriber/TestTriggeredPhpDeprecationSubscriber.phpnu �[��� <?php declare(strict_types=1); /* * This file is part of PHPUnit. * * (c) Sebastian Bergmann <sebastian@phpunit.de> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace PHPUnit\Runner\Baseline; use PHPUnit\Event\Test\PhpDeprecationTriggered; use PHPUnit\Event\Test\PhpDeprecationTriggeredSubscriber; use PHPUnit\Runner\FileDoesNotExistException; /** * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit * * @internal This class is not covered by the backward compatibility promise for PHPUnit */ final class TestTriggeredPhpDeprecationSubscriber extends Subscriber implements PhpDeprecationTriggeredSubscriber { /** * @throws FileDoesNotExistException * @throws FileDoesNotHaveLineException */ public function notify(PhpDeprecationTriggered $event): void { $this->generator()->testTriggeredIssue($event); } } PK �(\���� � Subscriber/Subscriber.phpnu �[��� <?php declare(strict_types=1); /* * This file is part of PHPUnit. * * (c) Sebastian Bergmann <sebastian@phpunit.de> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace PHPUnit\Runner\Baseline; /** * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit * * @internal This class is not covered by the backward compatibility promise for PHPUnit */ abstract class Subscriber { private readonly Generator $generator; public function __construct(Generator $generator) { $this->generator = $generator; } protected function generator(): Generator { return $this->generator; } } PK �(\�k9�� � , Subscriber/TestTriggeredNoticeSubscriber.phpnu �[��� <?php declare(strict_types=1); /* * This file is part of PHPUnit. * * (c) Sebastian Bergmann <sebastian@phpunit.de> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace PHPUnit\Runner\Baseline; use PHPUnit\Event\Test\NoticeTriggered; use PHPUnit\Event\Test\NoticeTriggeredSubscriber; use PHPUnit\Runner\FileDoesNotExistException; /** * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit * * @internal This class is not covered by the backward compatibility promise for PHPUnit */ final class TestTriggeredNoticeSubscriber extends Subscriber implements NoticeTriggeredSubscriber { /** * @throws FileDoesNotExistException * @throws FileDoesNotHaveLineException */ public function notify(NoticeTriggered $event): void { $this->generator()->testTriggeredIssue($event); } } PK �(\D�a� � 1 Subscriber/TestTriggeredDeprecationSubscriber.phpnu �[��� <?php declare(strict_types=1); /* * This file is part of PHPUnit. * * (c) Sebastian Bergmann <sebastian@phpunit.de> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace PHPUnit\Runner\Baseline; use PHPUnit\Event\Test\DeprecationTriggered; use PHPUnit\Event\Test\DeprecationTriggeredSubscriber; use PHPUnit\Runner\FileDoesNotExistException; /** * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit * * @internal This class is not covered by the backward compatibility promise for PHPUnit */ final class TestTriggeredDeprecationSubscriber extends Subscriber implements DeprecationTriggeredSubscriber { /** * @throws FileDoesNotExistException * @throws FileDoesNotHaveLineException */ public function notify(DeprecationTriggered $event): void { $this->generator()->testTriggeredIssue($event); } } PK �(\ٴ��� � / Subscriber/TestTriggeredPhpNoticeSubscriber.phpnu �[��� <?php declare(strict_types=1); /* * This file is part of PHPUnit. * * (c) Sebastian Bergmann <sebastian@phpunit.de> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace PHPUnit\Runner\Baseline; use PHPUnit\Event\Test\PhpNoticeTriggered; use PHPUnit\Event\Test\PhpNoticeTriggeredSubscriber; use PHPUnit\Runner\FileDoesNotExistException; /** * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit * * @internal This class is not covered by the backward compatibility promise for PHPUnit */ final class TestTriggeredPhpNoticeSubscriber extends Subscriber implements PhpNoticeTriggeredSubscriber { /** * @throws FileDoesNotExistException * @throws FileDoesNotHaveLineException */ public function notify(PhpNoticeTriggered $event): void { $this->generator()->testTriggeredIssue($event); } } PK �(\���*6 6 Baseline.phpnu �[��� <?php declare(strict_types=1); /* * This file is part of PHPUnit. * * (c) Sebastian Bergmann <sebastian@phpunit.de> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace PHPUnit\Runner\Baseline; /** * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit * * @internal This class is not covered by the backward compatibility promise for PHPUnit */ final class Baseline { public const VERSION = 1; /** * @psalm-var array<non-empty-string, array<positive-int, list<Issue>>> */ private array $issues = []; public function add(Issue $issue): void { if (!isset($this->issues[$issue->file()])) { $this->issues[$issue->file()] = []; } if (!isset($this->issues[$issue->file()][$issue->line()])) { $this->issues[$issue->file()][$issue->line()] = []; } $this->issues[$issue->file()][$issue->line()][] = $issue; } public function has(Issue $issue): bool { if (!isset($this->issues[$issue->file()][$issue->line()])) { return false; } foreach ($this->issues[$issue->file()][$issue->line()] as $_issue) { if ($_issue->equals($issue)) { return true; } } return false; } /** * @psalm-return array<string, array<positive-int, list<Issue>>> */ public function groupedByFileAndLine(): array { return $this->issues; } } PK �(\\z�S S Reader.phpnu �[��� <?php declare(strict_types=1); /* * This file is part of PHPUnit. * * (c) Sebastian Bergmann <sebastian@phpunit.de> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace PHPUnit\Runner\Baseline; use const DIRECTORY_SEPARATOR; use function assert; use function dirname; use function is_file; use function realpath; use function sprintf; use function str_replace; use function trim; use DOMElement; use DOMXPath; use PHPUnit\Util\Xml\Loader as XmlLoader; use PHPUnit\Util\Xml\XmlException; /** * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit * * @internal This class is not covered by the backward compatibility promise for PHPUnit */ final class Reader { /** * @psalm-param non-empty-string $baselineFile * * @throws CannotLoadBaselineException */ public function read(string $baselineFile): Baseline { if (!is_file($baselineFile)) { throw new CannotLoadBaselineException( sprintf( 'Cannot read baseline %s, file does not exist', $baselineFile, ), ); } try { $document = (new XmlLoader)->loadFile($baselineFile); } catch (XmlException $e) { throw new CannotLoadBaselineException( sprintf( 'Cannot read baseline: %s', trim($e->getMessage()), ), ); } $version = (int) $document->documentElement->getAttribute('version'); if ($version !== Baseline::VERSION) { throw new CannotLoadBaselineException( sprintf( 'Cannot read baseline %s, version %d is not supported', $baselineFile, $version, ), ); } $baseline = new Baseline; $baselineDirectory = dirname(realpath($baselineFile)); $xpath = new DOMXPath($document); foreach ($xpath->query('file') as $fileElement) { assert($fileElement instanceof DOMElement); $file = $baselineDirectory . DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $fileElement->getAttribute('path')); foreach ($xpath->query('line', $fileElement) as $lineElement) { assert($lineElement instanceof DOMElement); $line = (int) $lineElement->getAttribute('number'); $hash = $lineElement->getAttribute('hash'); foreach ($xpath->query('issue', $lineElement) as $issueElement) { assert($issueElement instanceof DOMElement); $description = $issueElement->textContent; assert($line > 0); assert(!empty($hash)); assert(!empty($description)); $baseline->add(Issue::from($file, $line, $hash, $description)); } } } return $baseline; } } PK �(\�p+} } ) Exception/CannotLoadBaselineException.phpnu �[��� PK �(\�q��� � * � Exception/FileDoesNotHaveLineException.phpnu �[��� PK �(\��-# # � RelativePathCalculator.phpnu �[��� PK �(\@G��� � # Generator.phpnu �[��� PK �(\����� � "