Skip to content

Commit

Permalink
Merge pull request #8 from gsteel/psalm-gha
Browse files Browse the repository at this point in the history
Initial migration to github ci workflows and psalm integration
  • Loading branch information
weierophinney authored Apr 8, 2021
2 parents eeee0dc + 05198b6 commit 7e77be8
Show file tree
Hide file tree
Showing 15 changed files with 333 additions and 100 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: "Continuous Integration"

on:
pull_request:
push:
branches:
- '[0-9]+.[0-9]+.x'
- 'refs/pull/*'

jobs:
matrix:
name: Generate job matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
steps:
- name: Gather CI configuration
id: matrix
uses: laminas/laminas-ci-matrix-action@v1

qa:
name: QA Checks
needs: [matrix]
runs-on: ${{ matrix.operatingSystem }}
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.matrix.outputs.matrix) }}
steps:
- name: ${{ matrix.name }}
uses: laminas/laminas-continuous-integration-action@v1
with:
job: ${{ matrix.job }}
57 changes: 0 additions & 57 deletions .travis.yml

This file was deleted.

3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# laminas-httphandlerrunner

[![Build Status](https://travis-ci.com/laminas/laminas-httphandlerrunner.svg?branch=master)](https://travis-ci.com/laminas/laminas-httphandlerrunner)
[![Coverage Status](https://coveralls.io/repos/github/laminas/laminas-httphandlerrunner/badge.svg?branch=master)](https://coveralls.io/github/laminas/laminas-httphandlerrunner?branch=master)
[![Build Status](https://github.com/laminas/laminas-httphandlerrunner/workflows/Continuous%20Integration/badge.svg)](https://github.com/laminas/laminas-httphandlerrunner/actions?query=workflow%3A"Continuous+Integration")

This library provides utilities for:

Expand Down
7 changes: 5 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
"require-dev": {
"laminas/laminas-coding-standard": "~1.0.0",
"laminas/laminas-diactoros": "^2.1.1",
"phpunit/phpunit": "^9.3"
"phpunit/phpunit": "^9.3",
"psalm/plugin-phpunit": "^0.15.1",
"vimeo/psalm": "^4.6"
},
"autoload": {
"psr-4": {
Expand All @@ -59,7 +61,8 @@
"cs-check": "phpcs",
"cs-fix": "phpcbf",
"test": "phpunit --colors=always",
"test-coverage": "phpunit --colors=always --coverage-clover clover.xml"
"test-coverage": "phpunit --colors=always --coverage-clover clover.xml",
"static-analysis": "psalm --shepherd --stats"
},
"replace": {
"zendframework/zend-httphandlerrunner": "^1.1.0"
Expand Down
228 changes: 228 additions & 0 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.6.2@bca09d74adc704c4eaee36a3c3e9d379e290fc3b">
<file src="src/Emitter/EmitterStack.php">
<MixedArgument occurrences="1">
<code>$index</code>
</MixedArgument>
<MixedAssignment occurrences="1">
<code>$emitter</code>
</MixedAssignment>
<MixedMethodCall occurrences="1">
<code>emit</code>
</MixedMethodCall>
<UndefinedDocblockClass occurrences="3">
<code>InvalidArgumentException</code>
<code>InvalidArgumentException</code>
<code>InvalidArgumentException</code>
</UndefinedDocblockClass>
</file>
<file src="src/Emitter/SapiEmitterTrait.php">
<DocblockTypeContradiction occurrences="1">
<code>headers_sent()</code>
</DocblockTypeContradiction>
<MissingReturnType occurrences="1">
<code>assertNoPreviousOutput</code>
</MissingReturnType>
<MixedArgumentTypeCoercion occurrences="1">
<code>$header</code>
</MixedArgumentTypeCoercion>
</file>
<file src="src/Emitter/SapiStreamEmitter.php">
<MixedArgument occurrences="4">
<code>$first</code>
<code>$first</code>
<code>$length</code>
<code>$remaining</code>
</MixedArgument>
<MixedAssignment occurrences="2">
<code>$length</code>
<code>$remaining</code>
</MixedAssignment>
<MixedOperand occurrences="2">
<code>$last</code>
<code>$remaining</code>
</MixedOperand>
</file>
<file src="src/Exception/InvalidEmitterException.php">
<MissingParamType occurrences="1">
<code>$emitter</code>
</MissingParamType>
</file>
<file src="src/RequestHandlerRunner.php">
<MixedArgument occurrences="2">
<code>$request</code>
<code>$response</code>
</MixedArgument>
<MixedAssignment occurrences="2">
<code>$request</code>
<code>$response</code>
</MixedAssignment>
<MixedInferredReturnType occurrences="2">
<code>ResponseInterface</code>
<code>ServerRequestInterface</code>
</MixedInferredReturnType>
<MixedReturnStatement occurrences="2">
<code>$serverRequestErrorResponseGenerator($exception)</code>
<code>$serverRequestFactory()</code>
</MixedReturnStatement>
</file>
<file src="test/ConfigProviderTest.php">
<MissingReturnType occurrences="2">
<code>testInvocationReturnsArray</code>
<code>testReturnedArrayContainsDependencies</code>
</MissingReturnType>
<MixedFunctionCall occurrences="1">
<code>($this-&gt;provider)()</code>
</MixedFunctionCall>
<UndefinedThisPropertyAssignment occurrences="1">
<code>$this-&gt;provider</code>
</UndefinedThisPropertyAssignment>
<UndefinedThisPropertyFetch occurrences="1">
<code>$this-&gt;provider</code>
</UndefinedThisPropertyFetch>
</file>
<file src="test/Emitter/AbstractEmitterTest.php">
<MissingReturnType occurrences="5">
<code>testDoesNotInjectContentLengthHeaderIfStreamSizeIsUnknown</code>
<code>testDoesNotLetResponseCodeBeOverriddenByPHP</code>
<code>testEmitsMessageBody</code>
<code>testEmitsResponseHeaders</code>
<code>testMultipleSetCookieHeadersAreNotReplaced</code>
</MissingReturnType>
</file>
<file src="test/Emitter/EmitterStackTest.php">
<MissingReturnType occurrences="11">
<code>nonEmitterValues</code>
<code>testCannotPushNonEmitterToStack</code>
<code>testCannotSetNonEmitterToSpecificIndex</code>
<code>testCannotUnshiftNonEmitterToStack</code>
<code>testEmitLoopsThroughEmittersUntilOneReturnsTrueValue</code>
<code>testEmitReturnsFalseIfLastEmmitterReturnsFalse</code>
<code>testEmitReturnsFalseIfNoEmittersAreComposed</code>
<code>testIsAnEmitterImplementation</code>
<code>testIsAnSplStack</code>
<code>testOffsetSetReplacesExistingValue</code>
<code>testUnshiftAddsNewEmitter</code>
</MissingReturnType>
<MixedArgument occurrences="3">
<code>$value</code>
<code>$value</code>
<code>$value</code>
</MixedArgument>
</file>
<file src="test/Emitter/SapiStreamEmitterTest.php">
<InvalidPropertyAssignmentValue occurrences="1">
<code>new SapiStreamEmitter()</code>
</InvalidPropertyAssignmentValue>
<MissingClosureParamType occurrences="5">
<code>$bufferLength</code>
<code>$bufferLength</code>
<code>$bufferLength</code>
<code>$length</code>
<code>$position</code>
</MissingClosureParamType>
<MissingClosureReturnType occurrences="4">
<code>function ($bufferLength) use (&amp; $peakBufferLength) {</code>
<code>function ($bufferLength) use (&amp; $peakBufferLength) {</code>
<code>function ($position, $length = null) use (&amp; $sizeBytes) {</code>
<code>function () use (&amp; $peakMemoryUsage) {</code>
</MissingClosureReturnType>
<MixedArgument occurrences="6">
<code>$first</code>
<code>$last - $first + 1</code>
<code>$length</code>
<code>$position</code>
<code>$sizeBytes</code>
<code>$startPosition</code>
</MixedArgument>
<MixedAssignment occurrences="9">
<code>$first</code>
<code>$last</code>
<code>$length</code>
<code>$peakBufferLength</code>
<code>$peakBufferLength</code>
<code>$peakBufferLength</code>
<code>$peakMemoryUsage</code>
<code>$position</code>
<code>$startPosition</code>
</MixedAssignment>
<MixedFunctionCall occurrences="1">
<code>$closureTrackMemoryUsage()</code>
</MixedFunctionCall>
<MixedOperand occurrences="11">
<code>$first</code>
<code>$first</code>
<code>$last</code>
<code>$last</code>
<code>$last</code>
<code>$maxBufferLength * $rangeBlocks[1]</code>
<code>$peakMemoryUsage</code>
<code>$rangeBlocks[0]</code>
<code>$rangeBlocks[1]</code>
<code>$sizeBytes</code>
<code>($maxBufferLength * $rangeBlocks[1]) + $maxBufferLength</code>
</MixedOperand>
<PossiblyUndefinedVariable occurrences="2">
<code>$first</code>
<code>$last</code>
</PossiblyUndefinedVariable>
</file>
<file src="test/RequestHandlerRunnerTest.php">
<MissingClosureParamType occurrences="2">
<code>$e</code>
<code>$e</code>
</MissingClosureParamType>
<MissingClosureReturnType occurrences="8">
<code>function ($e) use ($exception, $response) {</code>
<code>function ($e) {</code>
<code>function () use ($exception) {</code>
<code>function () use ($request) {</code>
<code>function () {</code>
<code>function () {</code>
<code>function (Throwable $e) use ($response) {</code>
<code>function (Throwable $e) {</code>
</MissingClosureReturnType>
<MissingReturnType occurrences="4">
<code>testRaisesTypeErrorIfServerErrorResponseGeneratorFactoryDoesNotReturnAResponse</code>
<code>testRaisesTypeErrorIfServerRequestFactoryDoesNotReturnARequestInstance</code>
<code>testRunPassesRequestGeneratedByRequestFactoryToHandleWhenNoRequestPassedToRun</code>
<code>testUsesErrorResponseGeneratorToGenerateResponseWhenRequestFactoryRaisesException</code>
</MissingReturnType>
</file>
<file src="test/TestAsset/HeaderStack.php">
<MissingReturnType occurrences="2">
<code>push</code>
<code>reset</code>
</MissingReturnType>
</file>
<file src="test/TestAsset/MockStreamHelper.php">
<MissingParamType occurrences="1">
<code>$contents</code>
</MissingParamType>
<MixedArgument occurrences="2">
<code>$data</code>
<code>$remainingContents</code>
</MixedArgument>
<MixedAssignment occurrences="3">
<code>$data</code>
<code>$remainingContents</code>
<code>$this-&gt;contents</code>
</MixedAssignment>
<MixedInferredReturnType occurrences="3">
<code>string</code>
<code>string</code>
<code>string</code>
</MixedInferredReturnType>
<MixedReturnStatement occurrences="3">
<code>$data</code>
<code>$remainingContents</code>
<code>is_callable($this-&gt;contents) ? ($this-&gt;contents)(0) : $this-&gt;contents</code>
</MixedReturnStatement>
</file>
<file src="test/TestAsset/SapiResponse.php">
<InvalidScalarArgument occurrences="1"/>
<MissingReturnType occurrences="1">
<code>header</code>
</MissingReturnType>
</file>
</files>
33 changes: 33 additions & 0 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0"?>
<psalm
totallyTyped="true"
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"
errorBaseline="psalm-baseline.xml"
>
<projectFiles>
<directory name="src"/>
<directory name="test"/>
<ignoreFiles>
<directory name="vendor"/>
</ignoreFiles>
</projectFiles>

<issueHandlers>
<InternalMethod>
<errorLevel type="suppress">
<referencedMethod name="PHPUnit\Framework\MockObject\Builder\InvocationMocker::method"/>
</errorLevel>
<errorLevel type="suppress">
<referencedMethod name="PHPUnit\Framework\MockObject\Builder\InvocationMocker::willReturn"/>
</errorLevel>
<errorLevel type="suppress">
<referencedMethod name="PHPUnit\Framework\MockObject\Builder\InvocationMocker::with"/>
</errorLevel>
</InternalMethod>
</issueHandlers>
<plugins>
<pluginClass class="Psalm\PhpUnitPlugin\Plugin"/>
</plugins>
</psalm>
Loading

0 comments on commit 7e77be8

Please sign in to comment.