first commit - working
This commit is contained in:
Readme.mdcomposer.jsoncomposer.lockgithub-ranking-2018-12-18.csv
src
tests
vendor
autoload.php
bin
composer
ClassLoader.phpInstalledVersions.phpLICENSEautoload_classmap.phpautoload_files.phpautoload_namespaces.phpautoload_psr4.phpautoload_real.phpautoload_static.phpinstalled.jsoninstalled.phpplatform_check.php
doctrine
instantiator
myclabs
deep-copy
.github
LICENSEREADME.mdcomposer.jsonsrc
DeepCopy
DeepCopy.php
Exception
Filter
Matcher
Reflection
TypeFilter
TypeMatcher
deep_copy.phpnikic
php-parser
LICENSEREADME.md
bin
composer.jsongrammar
lib
PhpParser
Builder.php
Builder
ClassConst.phpClass_.phpDeclaration.phpEnumCase.phpEnum_.phpFunctionLike.phpFunction_.phpInterface_.phpMethod.phpNamespace_.phpParam.phpProperty.phpTraitUse.phpTraitUseAdaptation.phpTrait_.phpUse_.php
BuilderFactory.phpBuilderHelpers.phpComment.phpComment
ConstExprEvaluationException.phpConstExprEvaluator.phpError.phpErrorHandler.phpErrorHandler
Internal
JsonDecoder.phpLexer.phpLexer
Emulative.php
NameContext.phpNode.phpTokenEmulator
AttributeEmulator.phpCoaleseEqualTokenEmulator.phpEnumTokenEmulator.phpExplicitOctalEmulator.phpFlexibleDocStringEmulator.phpFnTokenEmulator.phpKeywordEmulator.phpMatchTokenEmulator.phpNullsafeTokenEmulator.phpNumericLiteralSeparatorEmulator.phpReadonlyTokenEmulator.phpReverseEmulator.phpTokenEmulator.php
Node
Arg.phpAttribute.phpAttributeGroup.phpComplexType.phpConst_.phpExpr.php
NodeAbstract.phpNodeDumper.phpNodeFinder.phpNodeTraverser.phpNodeTraverserInterface.phpNodeVisitor.phpExpr
ArrayDimFetch.phpArrayItem.phpArray_.phpArrowFunction.phpAssign.phpAssignOp.php
FunctionLike.phpIdentifier.phpIntersectionType.phpMatchArm.phpName.phpAssignOp
BitwiseAnd.phpBitwiseOr.phpBitwiseXor.phpCoalesce.phpConcat.phpDiv.phpMinus.phpMod.phpMul.phpPlus.phpPow.phpShiftLeft.phpShiftRight.php
AssignRef.phpBinaryOp.phpBinaryOp
BitwiseAnd.phpBitwiseOr.phpBitwiseXor.phpBooleanAnd.phpBooleanOr.phpCoalesce.phpConcat.phpDiv.phpEqual.phpGreater.phpGreaterOrEqual.phpIdentical.phpLogicalAnd.phpLogicalOr.phpLogicalXor.phpMinus.phpMod.phpMul.phpNotEqual.phpNotIdentical.phpPlus.phpPow.phpShiftLeft.phpShiftRight.phpSmaller.phpSmallerOrEqual.phpSpaceship.php
BitwiseNot.phpBooleanNot.phpCallLike.phpCast.phpCast
ClassConstFetch.phpClone_.phpClosure.phpClosureUse.phpConstFetch.phpEmpty_.phpError.phpErrorSuppress.phpEval_.phpExit_.phpFuncCall.phpInclude_.phpInstanceof_.phpIsset_.phpList_.phpMatch_.phpMethodCall.phpNew_.phpNullsafeMethodCall.phpNullsafePropertyFetch.phpPostDec.phpPostInc.phpPreDec.phpPreInc.phpPrint_.phpPropertyFetch.phpShellExec.phpStaticCall.phpStaticPropertyFetch.phpTernary.phpThrow_.phpUnaryMinus.phpUnaryPlus.phpVariable.phpYieldFrom.phpYield_.phpName
NullableType.phpParam.phpScalar.phpScalar
Stmt.phpStmt
Break_.phpCase_.phpCatch_.phpClassConst.phpClassLike.phpClassMethod.phpClass_.phpConst_.phpContinue_.phpDeclareDeclare.phpDeclare_.phpDo_.phpEcho_.phpElseIf_.phpElse_.phpEnumCase.phpEnum_.phpExpression.phpFinally_.phpFor_.phpForeach_.phpFunction_.phpGlobal_.phpGoto_.phpGroupUse.phpHaltCompiler.phpIf_.phpInlineHTML.phpInterface_.phpLabel.phpNamespace_.phpNop.phpProperty.phpPropertyProperty.phpReturn_.phpStaticVar.phpStatic_.phpSwitch_.phpThrow_.phpTraitUse.phpTraitUseAdaptation.php
UnionType.phpVarLikeIdentifier.phpVariadicPlaceholder.phpTraitUseAdaptation
Trait_.phpTryCatch.phpUnset_.phpUseUse.phpUse_.phpWhile_.phpNodeVisitor
CloningVisitor.phpFindingVisitor.phpFirstFindingVisitor.phpNameResolver.phpNodeConnectingVisitor.phpParentConnectingVisitor.php
NodeVisitorAbstract.phpParser.phpParser
ParserAbstract.phpParserFactory.phpPrettyPrinter
PrettyPrinterAbstract.phpphar-io
manifest
CHANGELOG.mdLICENSEREADME.mdcomposer.jsoncomposer.lock
src
ManifestDocumentMapper.phpManifestLoader.phpManifestSerializer.php
exceptions
ElementCollectionException.phpException.phpInvalidApplicationNameException.phpInvalidEmailException.phpInvalidUrlException.phpManifestDocumentException.phpManifestDocumentLoadingException.phpManifestDocumentMapperException.phpManifestElementException.phpManifestLoaderException.php
values
Application.phpApplicationName.phpAuthor.phpAuthorCollection.phpAuthorCollectionIterator.phpBundledComponent.phpBundledComponentCollection.phpBundledComponentCollectionIterator.phpCopyrightInformation.phpEmail.phpExtension.phpLibrary.phpLicense.phpManifest.phpPhpExtensionRequirement.phpPhpVersionRequirement.phpRequirement.phpRequirementCollection.phpRequirementCollectionIterator.phpType.phpUrl.php
xml
AuthorElement.phpAuthorElementCollection.phpBundlesElement.phpComponentElement.phpComponentElementCollection.phpContainsElement.phpCopyrightElement.phpElementCollection.phpExtElement.phpExtElementCollection.phpExtensionElement.phpLicenseElement.phpManifestDocument.phpManifestElement.phpPhpElement.phpRequiresElement.php
version
CHANGELOG.mdLICENSEREADME.mdcomposer.json
src
PreReleaseSuffix.phpVersion.phpVersionConstraintParser.phpVersionConstraintValue.phpVersionNumber.php
constraints
AbstractVersionConstraint.phpAndVersionConstraintGroup.phpAnyVersionConstraint.phpExactVersionConstraint.phpGreaterThanOrEqualToVersionConstraint.phpOrVersionConstraintGroup.phpSpecificMajorAndMinorVersionConstraint.phpSpecificMajorVersionConstraint.phpVersionConstraint.php
exceptions
phpdocumentor
reflection-common
reflection-docblock
LICENSEREADME.mdcomposer.json
src
DocBlock.php
DocBlock
Description.phpDescriptionFactory.phpExampleFinder.phpSerializer.phpStandardTagFactory.phpTag.phpTagFactory.php
DocBlockFactory.phpDocBlockFactoryInterface.phpTags
Exception
Utils.phptype-resolver
LICENSEREADME.mdcomposer.json
src
FqsenResolver.phpPseudoType.php
PseudoTypes
CallableString.phpFalse_.phpHtmlEscapedString.phpIntegerRange.phpList_.phpLiteralString.phpLowercaseString.phpNegativeInteger.phpNonEmptyLowercaseString.phpNonEmptyString.phpNumericString.phpNumeric_.phpPositiveInteger.phpTraitString.phpTrue_.php
Type.phpTypeResolver.phpTypes
AbstractList.phpAggregatedType.phpArrayKey.phpArray_.phpBoolean.phpCallable_.phpClassString.phpCollection.phpCompound.phpContext.phpContextFactory.phpExpression.phpFloat_.phpInteger.phpInterfaceString.phpIntersection.phpIterable_.phpMixed_.phpNever_.phpNull_.phpNullable.phpObject_.phpParent_.phpResource_.phpScalar.phpSelf_.phpStatic_.phpString_.phpThis.phpVoid_.php
phpspec
prophecy
CHANGES.mdLICENSEREADME.mdcomposer.json
src
Prophecy
Argument.php
Argument
ArgumentsWildcard.php
Token
AnyValueToken.phpAnyValuesToken.phpApproximateValueToken.phpArrayCountToken.phpArrayEntryToken.phpArrayEveryEntryToken.phpCallbackToken.phpExactValueToken.phpIdenticalValueToken.phpInArrayToken.phpLogicalAndToken.phpLogicalNotToken.phpNotInArrayToken.phpObjectStateToken.phpStringContainsToken.phpTokenInterface.phpTypeToken.php
Call
Comparator
Doubler
CachedDoubler.php
ClassPatch
ClassPatchInterface.phpDisableConstructorPatch.phpHhvmExceptionPatch.phpKeywordPatch.phpMagicCallPatch.phpProphecySubjectPatch.phpReflectionClassNewInstancePatch.phpSplFileInfoPatch.phpThrowablePatch.phpTraversablePatch.php
DoubleInterface.phpDoubler.phpGenerator
ClassCodeGenerator.phpClassCreator.phpClassMirror.php
LazyDouble.phpNameGenerator.phpNode
ArgumentNode.phpArgumentTypeNode.phpClassNode.phpMethodNode.phpReturnTypeNode.phpTypeNodeAbstract.php
ReflectionInterface.phpTypeHintReference.phpException
Call
Doubler
ClassCreatorException.phpClassMirrorException.phpClassNotFoundException.phpDoubleException.phpDoublerException.phpInterfaceNotFoundException.phpMethodNotExtendableException.phpMethodNotFoundException.phpReturnByReferenceException.php
Exception.phpInvalidArgumentException.phpPrediction
AggregateException.phpFailedPredictionException.phpNoCallsException.phpPredictionException.phpUnexpectedCallsCountException.phpUnexpectedCallsException.php
Prophecy
PhpDocumentor
ClassAndInterfaceTagRetriever.phpClassTagRetriever.phpLegacyClassTagRetriever.phpMethodTagRetrieverInterface.php
Prediction
CallPrediction.phpCallTimesPrediction.phpCallbackPrediction.phpNoCallsPrediction.phpPredictionInterface.php
Promise
Prophecy
MethodProphecy.phpObjectProphecy.phpProphecyInterface.phpProphecySubjectInterface.phpRevealer.phpRevealerInterface.php
Prophet.phpUtil
phpunit
php-code-coverage
ChangeLog.mdLICENSEREADME.mdcomposer.json
src
CodeCoverage.phpCrapIndex.phpDirectory.php
Driver
Exception
BranchAndPathCoverageNotSupportedException.phpDeadCodeDetectionNotSupportedException.phpDirectoryCouldNotBeCreatedException.phpException.phpInvalidArgumentException.phpNoCodeCoverageDriverAvailableException.phpNoCodeCoverageDriverWithPathCoverageSupportAvailableException.phpParserException.phpPathExistsButIsNotDirectoryException.phpPcovNotAvailableException.phpPhpdbgNotAvailableException.phpReflectionException.phpReportAlreadyFinalizedException.phpStaticAnalysisCacheNotConfiguredException.phpTestIdMissingException.phpUnintentionallyCoveredCodeException.phpWriteOperationFailedException.phpWrongXdebugVersionException.phpXdebug2NotEnabledException.phpXdebug3NotEnabledException.phpXdebugNotAvailableException.phpXmlException.php
Filter.phpNode
Percentage.phpProcessedCodeCoverageData.phpRawCodeCoverageData.phpReport
Clover.phpCobertura.phpCrap4j.php
Html
Facade.phpRenderer.php
PHP.phpText.phpRenderer
Dashboard.phpDirectory.phpFile.php
Template
branches.html.distcoverage_bar.html.distcoverage_bar_branch.html.dist
css
dashboard.html.distdashboard_branch.html.distdirectory.html.distdirectory_branch.html.distdirectory_item.html.distdirectory_item_branch.html.distfile.html.distfile_branch.html.distfile_item.html.distfile_item_branch.html.disticons
js
line.html.distlines.html.distmethod_item.html.distmethod_item_branch.html.distpaths.html.distXml
StaticAnalysis
Cache.phpCacheWarmer.phpCachingCoveredFileAnalyser.phpCachingUncoveredFileAnalyser.phpCodeUnitFindingVisitor.phpCoveredFileAnalyser.phpExecutableLinesFindingVisitor.phpIgnoredLinesFindingVisitor.phpParsingCoveredFileAnalyser.phpParsingUncoveredFileAnalyser.phpUncoveredFileAnalyser.php
Version.phpphp-file-iterator
php-invoker
php-text-template
php-timer
phpunit
.phpstorm.meta.phpChangeLog-8.5.mdChangeLog-9.5.mdLICENSEREADME.mdcomposer.jsonphpunitphpunit.xsd
schema
src
Exception.php
Framework
Assert.phpDataProviderTestSuite.phpReorderable.phpSelfDescribing.phpSkippedTest.phpSkippedTestCase.phpTest.phpTestBuilder.phpTestCase.phpTestFailure.phpTestListener.phpTestListenerDefaultImplementation.phpTestResult.phpTestSuite.phpTestSuiteIterator.phpWarningTestCase.php
Assert
Constraint
Boolean
Callback.phpCardinality
Constraint.phpEquality
Exception
Filesystem
IsAnything.phpIsIdentical.phpJsonMatches.phpJsonMatchesErrorMessageProvider.phpMath
Object
Operator
BinaryOperator.phpLogicalAnd.phpLogicalNot.phpLogicalOr.phpLogicalXor.phpOperator.phpUnaryOperator.php
String
IsJson.phpRegularExpression.phpStringContains.phpStringEndsWith.phpStringMatchesFormatDescription.phpStringStartsWith.php
Traversable
ArrayHasKey.phpTraversableContains.phpTraversableContainsEqual.phpTraversableContainsIdentical.phpTraversableContainsOnly.php
Type
Error
ErrorTestCase.phpException
ActualValueIsNotAnObjectException.phpAssertionFailedError.phpCodeCoverageException.phpComparisonMethodDoesNotAcceptParameterTypeException.phpComparisonMethodDoesNotDeclareBoolReturnTypeException.phpComparisonMethodDoesNotDeclareExactlyOneParameterException.phpComparisonMethodDoesNotDeclareParameterTypeException.phpComparisonMethodDoesNotExistException.phpCoveredCodeNotExecutedException.phpError.phpException.phpExpectationFailedException.phpIncompleteTestError.phpInvalidArgumentException.phpInvalidCoversTargetException.phpInvalidDataProviderException.phpMissingCoversAnnotationException.phpNoChildTestSuiteException.phpOutputError.phpPHPTAssertionFailedError.phpRiskyTestError.phpSkippedTestError.phpSkippedTestSuiteError.phpSyntheticError.phpSyntheticSkippedError.phpUnintentionallyCoveredCodeError.phpWarning.php
ExceptionWrapper.phpExecutionOrderDependency.phpIncompleteTest.phpIncompleteTestCase.phpInvalidParameterGroupException.phpMockObject
Api
Builder
ConfigurableMethod.phpException
BadMethodCallException.phpCannotUseAddMethodsException.phpCannotUseOnlyMethodsException.phpClassAlreadyExistsException.phpClassIsFinalException.phpConfigurableMethodsAlreadyInitializedException.phpDuplicateMethodException.phpException.phpIncompatibleReturnValueException.phpInvalidMethodNameException.phpMatchBuilderNotFoundException.phpMatcherAlreadyRegisteredException.phpMethodCannotBeConfiguredException.phpMethodNameAlreadyConfiguredException.phpMethodNameNotConfiguredException.phpMethodParametersAlreadyConfiguredException.phpOriginalConstructorInvocationRequiredException.phpReflectionException.phpReturnValueNotConfiguredException.phpRuntimeException.phpSoapExtensionNotAvailableException.phpUnknownClassException.phpUnknownTraitException.phpUnknownTypeException.php
Generator.phpGenerator
deprecation.tplmocked_class.tplmocked_method.tplmocked_method_void.tplmocked_static_method.tplproxied_method.tplproxied_method_void.tpltrait_class.tplwsdl_class.tplwsdl_method.tpl
Invocation.phpInvocationHandler.phpMatcher.phpMethodNameConstraint.phpMockBuilder.phpMockClass.phpMockMethod.phpMockMethodSet.phpMockObject.phpMockTrait.phpMockType.phpRule
AnyInvokedCount.phpAnyParameters.phpConsecutiveParameters.phpInvocationOrder.phpInvokedAtIndex.phpInvokedAtLeastCount.phpInvokedAtLeastOnce.phpInvokedAtMostCount.phpInvokedCount.phpMethodName.phpParameters.phpParametersRule.php
Stub.phpStub
ConsecutiveCalls.phpException.phpReturnArgument.phpReturnCallback.phpReturnReference.phpReturnSelf.phpReturnStub.phpReturnValueMap.phpStub.php
Verifiable.phpRunner
BaseTestRunner.phpDefaultTestResultCache.phpException.php
Extension
Filter
ExcludeGroupFilterIterator.phpFactory.phpGroupFilterIterator.phpIncludeGroupFilterIterator.phpNameFilterIterator.php
Hook
AfterIncompleteTestHook.phpAfterLastTestHook.phpAfterRiskyTestHook.phpAfterSkippedTestHook.phpAfterSuccessfulTestHook.phpAfterTestErrorHook.phpAfterTestFailureHook.phpAfterTestHook.phpAfterTestWarningHook.phpBeforeFirstTestHook.phpBeforeTestHook.phpHook.phpTestHook.phpTestListenerAdapter.php
NullTestResultCache.phpPhptTestCase.phpResultCacheExtension.phpStandardTestSuiteLoader.phpTestResultCache.phpTestSuiteLoader.phpTestSuiteSorter.phpVersion.phpTextUI
CliArguments
Command.phpDefaultResultPrinter.phpException
Exception.phpReflectionException.phpRuntimeException.phpTestDirectoryNotFoundException.phpTestFileNotFoundException.php
Help.phpResultPrinter.phpTestRunner.phpTestSuiteMapper.phpXmlConfiguration
CodeCoverage
Configuration.phpException.phpFilesystem
Directory.phpDirectoryCollection.phpDirectoryCollectionIterator.phpFile.phpFileCollection.phpFileCollectionIterator.php
Generator.phpGroup
Loader.phpLogging
Migration
MigrationBuilder.phpMigrationBuilderException.phpMigrationException.php
Migrations
ConvertLogTypes.phpCoverageCloverToReport.phpCoverageCrap4jToReport.phpCoverageHtmlToReport.phpCoveragePhpToReport.phpCoverageTextToReport.phpCoverageXmlToReport.phpIntroduceCoverageElement.phpLogToReportMigration.phpMigration.phpMoveAttributesFromFilterWhitelistToCoverage.phpMoveAttributesFromRootToCoverage.phpMoveWhitelistDirectoriesToCoverage.phpMoveWhitelistExcludesToCoverage.phpRemoveCacheTokensAttribute.phpRemoveEmptyFilter.phpRemoveLogTypes.phpUpdateSchemaLocationTo93.php
Migrator.phpPHP
Constant.phpConstantCollection.phpConstantCollectionIterator.phpIniSetting.phpIniSettingCollection.phpIniSettingCollectionIterator.phpPhp.phpPhpHandler.phpVariable.phpVariableCollection.phpVariableCollectionIterator.php
PHPUnit
TestSuite
Util
Annotation
Blacklist.phpColor.phpErrorHandler.phpException.phpExcludeList.phpFileLoader.phpFilesystem.phpFilter.phpGlobalState.phpInvalidDataSetException.phpJson.phpLog
PHP
Printer.phpRegularExpression.phpTest.phpTestDox
CliTestDoxPrinter.phpHtmlResultPrinter.phpNamePrettifier.phpResultPrinter.phpTestDoxPrinter.phpTextResultPrinter.phpXmlResultPrinter.php
TextTestListRenderer.phpType.phpVersionComparisonOperator.phpXdebugFilterScriptGenerator.phpXml.phpXml
Exception.phpFailedSchemaDetectionResult.phpLoader.phpSchemaDetectionResult.phpSchemaDetector.phpSchemaFinder.phpSnapshotNodeList.phpSuccessfulSchemaDetectionResult.phpValidationResult.phpValidator.php
XmlTestListRenderer.phpsebastian
cli-parser
code-unit-reverse-lookup
code-unit
comparator
ChangeLog.mdLICENSEREADME.mdcomposer.json
src
ArrayComparator.phpComparator.phpComparisonFailure.phpDOMNodeComparator.phpDateTimeComparator.phpDoubleComparator.phpExceptionComparator.phpFactory.phpMockObjectComparator.phpNumericComparator.phpObjectComparator.phpResourceComparator.phpScalarComparator.phpSplObjectStorageComparator.phpTypeComparator.php
exceptions
complexity
diff
ChangeLog.mdLICENSEREADME.mdcomposer.json
src
Chunk.phpDiff.phpDiffer.php
Exception
Line.phpLongestCommonSubsequenceCalculator.phpMemoryEfficientLongestCommonSubsequenceCalculator.phpOutput
AbstractChunkOutputBuilder.phpDiffOnlyOutputBuilder.phpDiffOutputBuilderInterface.phpStrictUnifiedDiffOutputBuilder.phpUnifiedDiffOutputBuilder.php
Parser.phpTimeEfficientLongestCommonSubsequenceCalculator.phpenvironment
exporter
global-state
lines-of-code
object-enumerator
object-reflector
recursion-context
resource-operations
type
version
symfony
theseer
tokenizer
webmozart
27
vendor/nikic/php-parser/lib/PhpParser/Internal/DiffElem.php
vendored
Normal file
27
vendor/nikic/php-parser/lib/PhpParser/Internal/DiffElem.php
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace PhpParser\Internal;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class DiffElem
|
||||
{
|
||||
const TYPE_KEEP = 0;
|
||||
const TYPE_REMOVE = 1;
|
||||
const TYPE_ADD = 2;
|
||||
const TYPE_REPLACE = 3;
|
||||
|
||||
/** @var int One of the TYPE_* constants */
|
||||
public $type;
|
||||
/** @var mixed Is null for add operations */
|
||||
public $old;
|
||||
/** @var mixed Is null for remove operations */
|
||||
public $new;
|
||||
|
||||
public function __construct(int $type, $old, $new) {
|
||||
$this->type = $type;
|
||||
$this->old = $old;
|
||||
$this->new = $new;
|
||||
}
|
||||
}
|
164
vendor/nikic/php-parser/lib/PhpParser/Internal/Differ.php
vendored
Normal file
164
vendor/nikic/php-parser/lib/PhpParser/Internal/Differ.php
vendored
Normal file
@ -0,0 +1,164 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace PhpParser\Internal;
|
||||
|
||||
/**
|
||||
* Implements the Myers diff algorithm.
|
||||
*
|
||||
* Myers, Eugene W. "An O (ND) difference algorithm and its variations."
|
||||
* Algorithmica 1.1 (1986): 251-266.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class Differ
|
||||
{
|
||||
private $isEqual;
|
||||
|
||||
/**
|
||||
* Create differ over the given equality relation.
|
||||
*
|
||||
* @param callable $isEqual Equality relation with signature function($a, $b) : bool
|
||||
*/
|
||||
public function __construct(callable $isEqual) {
|
||||
$this->isEqual = $isEqual;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate diff (edit script) from $old to $new.
|
||||
*
|
||||
* @param array $old Original array
|
||||
* @param array $new New array
|
||||
*
|
||||
* @return DiffElem[] Diff (edit script)
|
||||
*/
|
||||
public function diff(array $old, array $new) {
|
||||
list($trace, $x, $y) = $this->calculateTrace($old, $new);
|
||||
return $this->extractDiff($trace, $x, $y, $old, $new);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate diff, including "replace" operations.
|
||||
*
|
||||
* If a sequence of remove operations is followed by the same number of add operations, these
|
||||
* will be coalesced into replace operations.
|
||||
*
|
||||
* @param array $old Original array
|
||||
* @param array $new New array
|
||||
*
|
||||
* @return DiffElem[] Diff (edit script), including replace operations
|
||||
*/
|
||||
public function diffWithReplacements(array $old, array $new) {
|
||||
return $this->coalesceReplacements($this->diff($old, $new));
|
||||
}
|
||||
|
||||
private function calculateTrace(array $a, array $b) {
|
||||
$n = \count($a);
|
||||
$m = \count($b);
|
||||
$max = $n + $m;
|
||||
$v = [1 => 0];
|
||||
$trace = [];
|
||||
for ($d = 0; $d <= $max; $d++) {
|
||||
$trace[] = $v;
|
||||
for ($k = -$d; $k <= $d; $k += 2) {
|
||||
if ($k === -$d || ($k !== $d && $v[$k-1] < $v[$k+1])) {
|
||||
$x = $v[$k+1];
|
||||
} else {
|
||||
$x = $v[$k-1] + 1;
|
||||
}
|
||||
|
||||
$y = $x - $k;
|
||||
while ($x < $n && $y < $m && ($this->isEqual)($a[$x], $b[$y])) {
|
||||
$x++;
|
||||
$y++;
|
||||
}
|
||||
|
||||
$v[$k] = $x;
|
||||
if ($x >= $n && $y >= $m) {
|
||||
return [$trace, $x, $y];
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new \Exception('Should not happen');
|
||||
}
|
||||
|
||||
private function extractDiff(array $trace, int $x, int $y, array $a, array $b) {
|
||||
$result = [];
|
||||
for ($d = \count($trace) - 1; $d >= 0; $d--) {
|
||||
$v = $trace[$d];
|
||||
$k = $x - $y;
|
||||
|
||||
if ($k === -$d || ($k !== $d && $v[$k-1] < $v[$k+1])) {
|
||||
$prevK = $k + 1;
|
||||
} else {
|
||||
$prevK = $k - 1;
|
||||
}
|
||||
|
||||
$prevX = $v[$prevK];
|
||||
$prevY = $prevX - $prevK;
|
||||
|
||||
while ($x > $prevX && $y > $prevY) {
|
||||
$result[] = new DiffElem(DiffElem::TYPE_KEEP, $a[$x-1], $b[$y-1]);
|
||||
$x--;
|
||||
$y--;
|
||||
}
|
||||
|
||||
if ($d === 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
while ($x > $prevX) {
|
||||
$result[] = new DiffElem(DiffElem::TYPE_REMOVE, $a[$x-1], null);
|
||||
$x--;
|
||||
}
|
||||
|
||||
while ($y > $prevY) {
|
||||
$result[] = new DiffElem(DiffElem::TYPE_ADD, null, $b[$y-1]);
|
||||
$y--;
|
||||
}
|
||||
}
|
||||
return array_reverse($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Coalesce equal-length sequences of remove+add into a replace operation.
|
||||
*
|
||||
* @param DiffElem[] $diff
|
||||
* @return DiffElem[]
|
||||
*/
|
||||
private function coalesceReplacements(array $diff) {
|
||||
$newDiff = [];
|
||||
$c = \count($diff);
|
||||
for ($i = 0; $i < $c; $i++) {
|
||||
$diffType = $diff[$i]->type;
|
||||
if ($diffType !== DiffElem::TYPE_REMOVE) {
|
||||
$newDiff[] = $diff[$i];
|
||||
continue;
|
||||
}
|
||||
|
||||
$j = $i;
|
||||
while ($j < $c && $diff[$j]->type === DiffElem::TYPE_REMOVE) {
|
||||
$j++;
|
||||
}
|
||||
|
||||
$k = $j;
|
||||
while ($k < $c && $diff[$k]->type === DiffElem::TYPE_ADD) {
|
||||
$k++;
|
||||
}
|
||||
|
||||
if ($j - $i === $k - $j) {
|
||||
$len = $j - $i;
|
||||
for ($n = 0; $n < $len; $n++) {
|
||||
$newDiff[] = new DiffElem(
|
||||
DiffElem::TYPE_REPLACE, $diff[$i + $n]->old, $diff[$j + $n]->new
|
||||
);
|
||||
}
|
||||
} else {
|
||||
for (; $i < $k; $i++) {
|
||||
$newDiff[] = $diff[$i];
|
||||
}
|
||||
}
|
||||
$i = $k - 1;
|
||||
}
|
||||
return $newDiff;
|
||||
}
|
||||
}
|
61
vendor/nikic/php-parser/lib/PhpParser/Internal/PrintableNewAnonClassNode.php
vendored
Normal file
61
vendor/nikic/php-parser/lib/PhpParser/Internal/PrintableNewAnonClassNode.php
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace PhpParser\Internal;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr;
|
||||
|
||||
/**
|
||||
* This node is used internally by the format-preserving pretty printer to print anonymous classes.
|
||||
*
|
||||
* The normal anonymous class structure violates assumptions about the order of token offsets.
|
||||
* Namely, the constructor arguments are part of the Expr\New_ node and follow the class node, even
|
||||
* though they are actually interleaved with them. This special node type is used temporarily to
|
||||
* restore a sane token offset order.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class PrintableNewAnonClassNode extends Expr
|
||||
{
|
||||
/** @var Node\AttributeGroup[] PHP attribute groups */
|
||||
public $attrGroups;
|
||||
/** @var Node\Arg[] Arguments */
|
||||
public $args;
|
||||
/** @var null|Node\Name Name of extended class */
|
||||
public $extends;
|
||||
/** @var Node\Name[] Names of implemented interfaces */
|
||||
public $implements;
|
||||
/** @var Node\Stmt[] Statements */
|
||||
public $stmts;
|
||||
|
||||
public function __construct(
|
||||
array $attrGroups, array $args, Node\Name $extends = null, array $implements,
|
||||
array $stmts, array $attributes
|
||||
) {
|
||||
parent::__construct($attributes);
|
||||
$this->attrGroups = $attrGroups;
|
||||
$this->args = $args;
|
||||
$this->extends = $extends;
|
||||
$this->implements = $implements;
|
||||
$this->stmts = $stmts;
|
||||
}
|
||||
|
||||
public static function fromNewNode(Expr\New_ $newNode) {
|
||||
$class = $newNode->class;
|
||||
assert($class instanceof Node\Stmt\Class_);
|
||||
// We don't assert that $class->name is null here, to allow consumers to assign unique names
|
||||
// to anonymous classes for their own purposes. We simplify ignore the name here.
|
||||
return new self(
|
||||
$class->attrGroups, $newNode->args, $class->extends, $class->implements,
|
||||
$class->stmts, $newNode->getAttributes()
|
||||
);
|
||||
}
|
||||
|
||||
public function getType() : string {
|
||||
return 'Expr_PrintableNewAnonClass';
|
||||
}
|
||||
|
||||
public function getSubNodeNames() : array {
|
||||
return ['attrGroups', 'args', 'extends', 'implements', 'stmts'];
|
||||
}
|
||||
}
|
281
vendor/nikic/php-parser/lib/PhpParser/Internal/TokenStream.php
vendored
Normal file
281
vendor/nikic/php-parser/lib/PhpParser/Internal/TokenStream.php
vendored
Normal file
@ -0,0 +1,281 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace PhpParser\Internal;
|
||||
|
||||
/**
|
||||
* Provides operations on token streams, for use by pretty printer.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class TokenStream
|
||||
{
|
||||
/** @var array Tokens (in token_get_all format) */
|
||||
private $tokens;
|
||||
/** @var int[] Map from position to indentation */
|
||||
private $indentMap;
|
||||
|
||||
/**
|
||||
* Create token stream instance.
|
||||
*
|
||||
* @param array $tokens Tokens in token_get_all() format
|
||||
*/
|
||||
public function __construct(array $tokens) {
|
||||
$this->tokens = $tokens;
|
||||
$this->indentMap = $this->calcIndentMap();
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the given position is immediately surrounded by parenthesis.
|
||||
*
|
||||
* @param int $startPos Start position
|
||||
* @param int $endPos End position
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function haveParens(int $startPos, int $endPos) : bool {
|
||||
return $this->haveTokenImmediatelyBefore($startPos, '(')
|
||||
&& $this->haveTokenImmediatelyAfter($endPos, ')');
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the given position is immediately surrounded by braces.
|
||||
*
|
||||
* @param int $startPos Start position
|
||||
* @param int $endPos End position
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function haveBraces(int $startPos, int $endPos) : bool {
|
||||
return ($this->haveTokenImmediatelyBefore($startPos, '{')
|
||||
|| $this->haveTokenImmediatelyBefore($startPos, T_CURLY_OPEN))
|
||||
&& $this->haveTokenImmediatelyAfter($endPos, '}');
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the position is directly preceded by a certain token type.
|
||||
*
|
||||
* During this check whitespace and comments are skipped.
|
||||
*
|
||||
* @param int $pos Position before which the token should occur
|
||||
* @param int|string $expectedTokenType Token to check for
|
||||
*
|
||||
* @return bool Whether the expected token was found
|
||||
*/
|
||||
public function haveTokenImmediatelyBefore(int $pos, $expectedTokenType) : bool {
|
||||
$tokens = $this->tokens;
|
||||
$pos--;
|
||||
for (; $pos >= 0; $pos--) {
|
||||
$tokenType = $tokens[$pos][0];
|
||||
if ($tokenType === $expectedTokenType) {
|
||||
return true;
|
||||
}
|
||||
if ($tokenType !== \T_WHITESPACE
|
||||
&& $tokenType !== \T_COMMENT && $tokenType !== \T_DOC_COMMENT) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the position is directly followed by a certain token type.
|
||||
*
|
||||
* During this check whitespace and comments are skipped.
|
||||
*
|
||||
* @param int $pos Position after which the token should occur
|
||||
* @param int|string $expectedTokenType Token to check for
|
||||
*
|
||||
* @return bool Whether the expected token was found
|
||||
*/
|
||||
public function haveTokenImmediatelyAfter(int $pos, $expectedTokenType) : bool {
|
||||
$tokens = $this->tokens;
|
||||
$pos++;
|
||||
for (; $pos < \count($tokens); $pos++) {
|
||||
$tokenType = $tokens[$pos][0];
|
||||
if ($tokenType === $expectedTokenType) {
|
||||
return true;
|
||||
}
|
||||
if ($tokenType !== \T_WHITESPACE
|
||||
&& $tokenType !== \T_COMMENT && $tokenType !== \T_DOC_COMMENT) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function skipLeft(int $pos, $skipTokenType) {
|
||||
$tokens = $this->tokens;
|
||||
|
||||
$pos = $this->skipLeftWhitespace($pos);
|
||||
if ($skipTokenType === \T_WHITESPACE) {
|
||||
return $pos;
|
||||
}
|
||||
|
||||
if ($tokens[$pos][0] !== $skipTokenType) {
|
||||
// Shouldn't happen. The skip token MUST be there
|
||||
throw new \Exception('Encountered unexpected token');
|
||||
}
|
||||
$pos--;
|
||||
|
||||
return $this->skipLeftWhitespace($pos);
|
||||
}
|
||||
|
||||
public function skipRight(int $pos, $skipTokenType) {
|
||||
$tokens = $this->tokens;
|
||||
|
||||
$pos = $this->skipRightWhitespace($pos);
|
||||
if ($skipTokenType === \T_WHITESPACE) {
|
||||
return $pos;
|
||||
}
|
||||
|
||||
if ($tokens[$pos][0] !== $skipTokenType) {
|
||||
// Shouldn't happen. The skip token MUST be there
|
||||
throw new \Exception('Encountered unexpected token');
|
||||
}
|
||||
$pos++;
|
||||
|
||||
return $this->skipRightWhitespace($pos);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return first non-whitespace token position smaller or equal to passed position.
|
||||
*
|
||||
* @param int $pos Token position
|
||||
* @return int Non-whitespace token position
|
||||
*/
|
||||
public function skipLeftWhitespace(int $pos) {
|
||||
$tokens = $this->tokens;
|
||||
for (; $pos >= 0; $pos--) {
|
||||
$type = $tokens[$pos][0];
|
||||
if ($type !== \T_WHITESPACE && $type !== \T_COMMENT && $type !== \T_DOC_COMMENT) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $pos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return first non-whitespace position greater or equal to passed position.
|
||||
*
|
||||
* @param int $pos Token position
|
||||
* @return int Non-whitespace token position
|
||||
*/
|
||||
public function skipRightWhitespace(int $pos) {
|
||||
$tokens = $this->tokens;
|
||||
for ($count = \count($tokens); $pos < $count; $pos++) {
|
||||
$type = $tokens[$pos][0];
|
||||
if ($type !== \T_WHITESPACE && $type !== \T_COMMENT && $type !== \T_DOC_COMMENT) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $pos;
|
||||
}
|
||||
|
||||
public function findRight(int $pos, $findTokenType) {
|
||||
$tokens = $this->tokens;
|
||||
for ($count = \count($tokens); $pos < $count; $pos++) {
|
||||
$type = $tokens[$pos][0];
|
||||
if ($type === $findTokenType) {
|
||||
return $pos;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the given position range contains a certain token type.
|
||||
*
|
||||
* @param int $startPos Starting position (inclusive)
|
||||
* @param int $endPos Ending position (exclusive)
|
||||
* @param int|string $tokenType Token type to look for
|
||||
* @return bool Whether the token occurs in the given range
|
||||
*/
|
||||
public function haveTokenInRange(int $startPos, int $endPos, $tokenType) {
|
||||
$tokens = $this->tokens;
|
||||
for ($pos = $startPos; $pos < $endPos; $pos++) {
|
||||
if ($tokens[$pos][0] === $tokenType) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function haveBracesInRange(int $startPos, int $endPos) {
|
||||
return $this->haveTokenInRange($startPos, $endPos, '{')
|
||||
|| $this->haveTokenInRange($startPos, $endPos, T_CURLY_OPEN)
|
||||
|| $this->haveTokenInRange($startPos, $endPos, '}');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get indentation before token position.
|
||||
*
|
||||
* @param int $pos Token position
|
||||
*
|
||||
* @return int Indentation depth (in spaces)
|
||||
*/
|
||||
public function getIndentationBefore(int $pos) : int {
|
||||
return $this->indentMap[$pos];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the code corresponding to a token offset range, optionally adjusted for indentation.
|
||||
*
|
||||
* @param int $from Token start position (inclusive)
|
||||
* @param int $to Token end position (exclusive)
|
||||
* @param int $indent By how much the code should be indented (can be negative as well)
|
||||
*
|
||||
* @return string Code corresponding to token range, adjusted for indentation
|
||||
*/
|
||||
public function getTokenCode(int $from, int $to, int $indent) : string {
|
||||
$tokens = $this->tokens;
|
||||
$result = '';
|
||||
for ($pos = $from; $pos < $to; $pos++) {
|
||||
$token = $tokens[$pos];
|
||||
if (\is_array($token)) {
|
||||
$type = $token[0];
|
||||
$content = $token[1];
|
||||
if ($type === \T_CONSTANT_ENCAPSED_STRING || $type === \T_ENCAPSED_AND_WHITESPACE) {
|
||||
$result .= $content;
|
||||
} else {
|
||||
// TODO Handle non-space indentation
|
||||
if ($indent < 0) {
|
||||
$result .= str_replace("\n" . str_repeat(" ", -$indent), "\n", $content);
|
||||
} elseif ($indent > 0) {
|
||||
$result .= str_replace("\n", "\n" . str_repeat(" ", $indent), $content);
|
||||
} else {
|
||||
$result .= $content;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$result .= $token;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Precalculate the indentation at every token position.
|
||||
*
|
||||
* @return int[] Token position to indentation map
|
||||
*/
|
||||
private function calcIndentMap() {
|
||||
$indentMap = [];
|
||||
$indent = 0;
|
||||
foreach ($this->tokens as $token) {
|
||||
$indentMap[] = $indent;
|
||||
|
||||
if ($token[0] === \T_WHITESPACE) {
|
||||
$content = $token[1];
|
||||
$newlinePos = \strrpos($content, "\n");
|
||||
if (false !== $newlinePos) {
|
||||
$indent = \strlen($content) - $newlinePos - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add a sentinel for one past end of the file
|
||||
$indentMap[] = $indent;
|
||||
|
||||
return $indentMap;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user