From f1c9c4c204b929b1b6636a73fd0f6566288b52b2 Mon Sep 17 00:00:00 2001 From: Joshua Estes Date: Mon, 23 Oct 2023 09:39:00 -0400 Subject: [PATCH 1/4] psalm --- psalm-baseline.xml | 1701 ++++++++++---------------------------------- psalm.xml | 16 +- 2 files changed, 375 insertions(+), 1342 deletions(-) diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 1ae52b6f..6cb9340f 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,88 +1,29 @@ - - - - getOption('working-dir')]]> - - - - - - - - $pkg - - - getOption('working-dir')]]> - - - getSection('packages')]]> - + + + + Application + + + + + mustRun + + + $formatter + + + run - - - $formatter - - - formatter->formatSection('bard', sprintf('Merging "%s" into root composer.json', $pkgComposerJsonFile->getSection('name')))]]> - - - - - - - $pkg - bardConfig]]> - - - decode - - - getOption('working-dir')]]> - getOption('working-dir')]]> - getOption('working-dir')]]> - getOption('working-dir')]]> - getOption('working-dir')]]> - - - - - getSection('name')]]> - - - $bardConfig - $mainComposerFile - + formatSection - - - - - - - - $pkg - - - wait - - - getOption('working-dir')]]> - getOption('working-dir')]]> - - - - $pkgName - - - getSection('packages')]]> - + mustRun @@ -90,78 +31,15 @@ $formatter - - - $releaseVersion - - - getOption('branch')]]> - releaseVersion]]> - releaseVersion]]> - releaseVersion->toString()]]> - releaseVersion->toString()]]> - releaseVersion->toString()]]> - releaseVersion->toString()]]> - releaseVersion->toString()]]> - releaseVersion->toString()]]> - releaseVersion->toString()]]> - releaseVersion->toString()]]> - $version - - - - - - - - - - $pkg - $pkg - isDryRun]]> - $version - - - toString - toString - toString - toString - toString - toString - toString - toString - toString - toString - - - getOption('working-dir')]]> - getOption('working-dir')]]> - getOption('working-dir')]]> - getOption('working-dir')]]> - - - releaseVersion->toString()]]> - releaseVersion->toString()]]> - - - $pkgName - $pkgName - $pkgName - $pkgName - $pkgName - bardConfig->getSection('version')]]> - bardConfig->getSection('version')]]> - - - bardConfig->getSection('version')]]> - - - bardConfig->getSection('packages')]]> - bardConfig->getSection('packages')]]> - - - $bardConfig - + + + mustRun + + + $formatter + + + formatSection mustRun @@ -169,391 +47,103 @@ mustRun - - - - - - $pkg - - - getOption('working-dir')]]> - - - getSection('packages')]]> - + + + mustRun + + + $formatter + + + run - - - $operator - $value - - - config]]> - - - array|int|string|null - self - string - - + + apply - decode - encode - unescapedSlashes - unescapedUnicode - - - apply($this)]]> - config[$section]]]> - json->getEncoder() - ->prettyPrint() - ->unescapedUnicode() - ->unescapedSlashes() - ->encode($this->config)]]> - - - $config - - - config)]]> - config)]]> - - - - - - - - - - - - - - - - - - - - - - - - + + + + + apply + + + + + apply + + + + + apply + + + + + apply + + + - - $pkgPath - $pkgPath - - - - - - - - $config - $namespace - $pkgPath - $pkgPath - - - - - - - - - - - $pkgAutoloadSection - - - - - + + apply + - + - - $pkgPath - $pkgPath - - - - - - - - - - - - $config - $namespace - $pkgPath - $pkgPath - $section - - - - - - - - - - - - - - - $pkgAutoloadSection - - - + + apply + + + $rootProvideSection[$pkg] - - $rootProvideSection[$pkg] - $version - - - $rootProvideSection[$pkg] - - - $rootProvideSection[$pkg] - - - $pkgProvideSection - + + apply + - + $rootReplace[$pkgName] - - $rootReplace[$pkgName] - - - $rootReplace - + + apply + - + $rootRequireDev[$package] - - $rootRequireDev[$package] - $version - - - $rootRequireDev[$package] - - - $rootRequireDev[$package] - - - $pkgRequireDev - + + apply + - + $rootRequire[$package] - - $rootRequire[$package] - $version - - - $rootRequire[$package] - - - $rootReplace - - - $rootRequire[$package] - - - $pkgRequire - - - - - getDate()]]> - getTime()]]> - getZone()->getOffset()]]> - - - - - arrayNode - booleanNode - children - end - end - end - end - - - children - - - - - $config - + + apply + - - - stamps]]> - - - - - $resolver - $resolver - $resolver - - - define - define - define - - - - - $callback - - - $configureOptions - - - self::$configureOptions - - - - - __invoke - - - - - $listener - - - listeners[$event][]]]> - - - iterable - - - listeners[$class]]]> - + + + TableSchemaV2 + - - - $message - - - $columnsWithTypes[$aggregateIdColumn] - $columnsWithTypes[$aggregateVersionColumn] - - - - tableSchema->mapEventDataToColumns($data)]]> - array_keys($columnsWithTypes) - tableSchema->getColumns())]]> - - - null === $id - null === $id - null === $version - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - array - - - - - - + current current current - - method - method - method - method - method - method - method - method - method - method - method - method - method - method - method - method - method - willReturn - willReturn - willReturn - willReturn - willReturn - willReturn - willReturn - willReturn - willReturn - willReturn - willReturn - willReturn - willReturn - willReturn - willReturn - willReturn - expects expects @@ -576,117 +166,61 @@ expects - - - getName - getName - getName - getName - getName - getName - getName - - - - - $data - $object - - - $data - - - AggregateIdInterface - - - $type::fromString($data) - - - - - $data - $object - - - $data - - - AggregateVersionInterface - int - - - toInt - - - toInt()]]> - $type::fromInt($data) - - - - - $data - $object - - - - - - + + + object + + + + + getSupportedTypes + + + $format + + + + + getSupportedTypes + + + $format + + + + + object + + + + MessageInterface - - - getMetadata - getPayload - withMetadata - withPayload - - - withPayload($data['payload'])->withMetadata($data['metadata'])]]> - - - - - $data - $data - - - iterable - iterable - - - - - $data - $data - - - iterable - iterable - + + + + + MessageInterface + + + + + MessageInterface + + + + + getSupportedTypes + + + $format + - - - method - willReturn - + expects - - - $metadata - - - - - - - - - method - willReturn - + expects @@ -694,262 +228,188 @@ $output - - - $metadata[Metadata::EVENT_ID] - - - $metadata[Metadata::EVENT_ID] - - - - - $metadata[Metadata::EVENT_ID] - - - $metadata[Metadata::EVENT_ID] - - - - - $event - - - $event - - - $events - iterable - + + + CqrsBundle + - + + + children + + + + + $config + + + + + getDate()]]> + getTime()]]> + getZone()->getOffset()]]> + + + + + DurationInterface + + + + + IntervalInterface + + + + + OrdinalDateInterface + + + + + RepeatingIntervalInterface + + + + + YearWeekInterface + + + + + CommandMessageHandlerInterface + + + + + QueryMessageHandlerInterface + + + + + QueryMessageInterface + + + + + add + addSubscriber + getListenersForEventName + + + + + ListenerInterface + + + + + sorted[$eventName]]]> + + + + + new + + + string id]]> - - new static($id) - - - - - $msg - + + applyEvent + + AbstractSnapshotableAggregate + - + $version - - - ?AggregateInterface - - - $aggregateClass::buildFromEvents($id, $events) - - - enrich - - - + + + buildFromSnapshot + buildFromSnapshotAndEvents + createSnapshot + + + + + AbstractGenericMessage + + + withPayload($data['payload'])->withMetadata($data['metadata'])]]> SerializableMessageInterface - - - - - - - $message - $msgEnricher - - - MessageInterface - - - enrich - - - $message - - - - - $enricher - - - $enricher - - - - - $provider - - - $provider - $provider - - - getEnrichersForMessage - - - $providers - - - - - $value - - - get - with - + + + MessageHandlerInterface + + + \IteratorAggregate - - get(Metadata::AGGREGATE_ID)]]> - get(Metadata::TIMESTAMP)]]> - - - AggregateIdInterface - string - string - string - - - get(Metadata::AGGREGATE_ID)]]> - get(Metadata::EVENT_ID)]]> - get(Metadata::EVENT_TYPE)]]> - get(Metadata::TIMESTAMP_FORMAT)]]> - - - - - $value - - - get - with - + + count + + + \IteratorAggregate + + count + + + + + NameableMessageInterface + + + + + deserialize + serialize + - - - storage[$id->toString()][$version->toInt()]]]> - - - $message - $ver - - - - - - - - - - - - $v - - - SerializableMessageInterface - array - - - $v - - - serialize()]]> - $messageClass::deserialize($data) - + serialize - - - $data - $handler - - - array - - + + upcast - - - $data - - - - - upcasters[$eventType][]]]> - - - upcasters[$eventType]]]> - - - $eventType - - - - - ?SnapshotInterface - - - storage[$id->toString()] ?? null]]> - storage[$id->toString()] ?? null]]> - - - - - $state - - - $state - - - - - function () { - + + + setAccessible - + $version $version - + 123 - - method - - - getAggregateId - getAggregateId - expects @@ -957,39 +417,7 @@ $result - - - $event - - - $event - - - - - getPayload()]]> - $return - $return - - - getPayload()['key']]]> - - - $msg - $return - - - getAggregateId - getAggregateVersion - getEventId - getEventType - getPayload - getPayload - getTimestamp - getTimestampFormat - toInt - toString - + [], @@ -1014,33 +442,22 @@ serialize - + $enrichers[0] - - - $another - - - $another - - - - - $another - - - $another - - - + + + $enrichers + + + new \stdClass() - + current current @@ -1049,90 +466,58 @@ current - + $message - - - - + + + $handlers + $handlers + current - - - iterable - - - $features - - - $feature - - - $feature - - - - - $toggle - - - toggle]]> - toggle]]> - toggle]]> - - - expects - method - willReturn - - - - - $toggle - - - toggle]]> - - - - + + + jsonSerialize + + + + + \ArrayAccess + \IteratorAggregate + + + self + + + + + FeatureToggleException + + + + + MockObject|ToggleInterface + + + + invalidUtf8Ignore invalidUtf8Substitute throwOnError - withDepth - withFlags - withoutFlags - - - - - $value - - - decode - - - - - asArray + + + + bigintAsString - decode - objectAsArray - - - $return - - - - - $value - - + + + + forceObject hexAmp hexApos @@ -1141,83 +526,22 @@ numericCheck partialOutputOnError preserveZeroFraction - prettyPrint unescapedLineTerminators unescapedSlashes unescapedUnicode - - - - - $decoder - $decoder - $decoder - - - array - - - decode - withDepth - withFlags - - - decode(file_get_contents($filename))]]> - - - - - $value - - - write - - - encode($value)]]> - - - $encoder - $encoder - - - encode - withFlags - - - - - - - - $decoder - $decoder - $decoder - $decoder - $decoder - $decoder - $decoder - - - $decoder - $decoder - $decoder - $decoder - $decoder - $decoder - $decoder - $decoderOther - $decoderOther - $return - - - withFlags - withoutFlags - withoutFlags - withoutFlags - - - test]]> - + + + + + JsonReader + + + + + JsonWriter + + + setAccessible setAccessible @@ -1226,372 +550,81 @@ setAccessible - - - $encoder - $encoder - $encoder - $encoder - $encoder - $encoder - - - $encoder - $encoder - $encoder - $encoder - $encoder - $encoder - $encoderOther - $encoderOther - - - withFlags - withoutFlags - withoutFlags - withoutFlags - + setAccessible setAccessible setAccessible - - - - - - $return - - - test]]> - - - - - bool - bool - bool - bool - bool - bool - bool - bool - - - query(new IsEqualToAmountQuery($amount))]]> - query(new IsGreaterThanAmountQuery($amount))]]> - query(new IsGreaterThanOrEqualToAmountQuery($amount))]]> - query(new IsLessThanAmountQuery($amount))]]> - query(new IsLessThanOrEqualToAmountQuery($amount))]]> - query(new IsNegativeAmountQuery())]]> - query(new IsPositiveAmountQuery())]]> - query(new IsZeroAmountQuery())]]> - - - - - $minorUnit - $numericCode - - - $minorUnit - $numericCode - - - bool - - - query(new IsEqualToCurrencyQuery($currency))]]> - - - - - CurrencyInterface - bool - - - query(new GetCurrencyQuery($currency))]]> - query(new HasCurrencyQuery($currency))]]> - - - + iterable - - $provider - - - $provider - $provider - - - getCurrencies - - - $providers - - - + + iterable - + iterable - - - bool - bool - bool - bool - bool - bool - bool - bool - - - query(new IsEqualToMoneyQuery($money))]]> - query(new IsGreaterThanMoneyQuery($money))]]> - query(new IsGreaterThanOrEqualToMoneyQuery($money))]]> - query(new IsLessThanMoneyQuery($money))]]> - query(new IsLessThanOrEqualToMoneyQuery($money))]]> - query(new IsNegativeMoneyQuery())]]> - query(new IsPositiveMoneyQuery())]]> - query(new IsZeroMoneyQuery())]]> - - - - - $divisor - - - $divisor - - - divisor]]> - - - - - $multiplier - - - $multiplier - - - multiplier]]> - - - - - $divisor - - - $divisor - - - - - $multiplier - - - $multiplier - - - - - $currency - - - $currency - - - - - $currency - - - $currency - + + + ArithmeticException + - - - getCurrencies()]]> - + + + UnknownCurrencyException + - - - $currency - + + + compare + - - - $money - $money - $money - $money1 - $money1 - $money1 - $money1 - $money1 - $money1 - $money1 - $money1 - $money1 - $money1 - $money1 - $money1 - $money1 - $money1 - $money1 - $money1 - $money1 - $money1 - $money1 - $money1 - $money2 - $money2 - $money2 - $money2 - $money2 - $money2 - $money2 - $money2 - $money2 - $money2 - $money2 - $money2 - $money2 - $money2 - $money2 - $money2 - $money2 - $money2 - $money3 - $money3 - $money3 - $money3 - $money3 - $money3 - $money3 - $output - $output - $output - $output - $output - - - add + + add - compare - compare - compare divide - getAmount - getAmount - getAmount - getAmount - getAmount - getAmount - getCurrency - getCurrencyCode - isEqualTo - isEqualTo - isEqualTo - isEqualTo isEqualTo - isEqualTo - isEqualTo - isEqualTo - isEqualTo - isGreaterThan - isGreaterThan - isGreaterThan - isGreaterThan - isGreaterThanOrEqualTo - isGreaterThanOrEqualTo isGreaterThanOrEqualTo - isGreaterThanOrEqualTo - isLessThan - isLessThan - isLessThan - isLessThan - isLessThanOrEqualTo - isLessThanOrEqualTo - isLessThanOrEqualTo isLessThanOrEqualTo isNegative - isNegative - isNegative - isPositive isPositive - isPositive - isZero - isZero isZero multiply subtract - subtract - subtract - + - - - Money::JPY(1000) - + + + getCurrencies()]]> + - - - Money::JPY(1000) - Money::USD(300) - + + + $currency + - - - $output - - - $output - $output - $output - - - getCurrencyCode - + $output $query - + $query - - - iterable - iterable - iterable - + $version - - - getBuild()]]> - getPreRelease()]]> - - - - - - diff --git a/psalm.xml b/psalm.xml index 616e2bb2..63240a3d 100644 --- a/psalm.xml +++ b/psalm.xml @@ -3,18 +3,21 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" - errorLevel="1" + errorLevel="5" resolveFromConfigFile="true" cacheDirectory=".psalm-cache" allowStringToStandInForClass="true" errorBaseline="psalm-baseline.xml" + findUnusedBaselineEntry="true" + findUnusedCode="true" > - + - - - + + + + @@ -23,7 +26,4 @@ - - - From 406c2fd8407c23d6b9520aaf97a367e7d5fabe15 Mon Sep 17 00:00:00 2001 From: Joshua Estes Date: Mon, 23 Oct 2023 09:43:36 -0400 Subject: [PATCH 2/4] see if this works --- .github/workflows/static-analysis.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 2d55be49..6e726fb2 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -4,14 +4,16 @@ on: branches: [main] paths: - '.github/workflows/static-analysis.yml' - - 'packages/**' + - 'src/**' - 'psalm.xml' + - 'psalm-baseline.xml' pull_request: branches: [main] paths: - '.github/workflows/static-analysis.yml' - - 'packages/**' + - 'src/**' - 'psalm.xml' + - 'psalm-baseline.xml' concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} @@ -36,6 +38,7 @@ jobs: php-version: '${{ matrix.php-version }}' coverage: none - run: make composer-install phpunit-install psalm-install + - run: php src/SonsOfPHP/Bard/bin install -n - run: make psalm-github - name: Upload Security Analysis to Github if: github.ref == 'refs/heads/main' From 0078a4e6f7e3d0325e45fdb59dcf2acbe97889c4 Mon Sep 17 00:00:00 2001 From: Joshua Estes Date: Mon, 23 Oct 2023 09:45:50 -0400 Subject: [PATCH 3/4] updates --- .github/workflows/static-analysis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 6e726fb2..00b1ffd2 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -38,7 +38,7 @@ jobs: php-version: '${{ matrix.php-version }}' coverage: none - run: make composer-install phpunit-install psalm-install - - run: php src/SonsOfPHP/Bard/bin install -n + - run: php src/SonsOfPHP/Bard/bin install -n -vvv - run: make psalm-github - name: Upload Security Analysis to Github if: github.ref == 'refs/heads/main' From 09d6bba88625303c7bea8f6930fb7d3a64936cd1 Mon Sep 17 00:00:00 2001 From: Joshua Estes Date: Mon, 23 Oct 2023 09:46:19 -0400 Subject: [PATCH 4/4] lame --- .github/workflows/static-analysis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 00b1ffd2..ccc19eb6 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -38,7 +38,7 @@ jobs: php-version: '${{ matrix.php-version }}' coverage: none - run: make composer-install phpunit-install psalm-install - - run: php src/SonsOfPHP/Bard/bin install -n -vvv + - run: php src/SonsOfPHP/Bard/bin/bard install -n -vvv - run: make psalm-github - name: Upload Security Analysis to Github if: github.ref == 'refs/heads/main'