Skip to content

Commit

Permalink
Re-enabled Psalm (#215)
Browse files Browse the repository at this point in the history
* Started process of re-enabling Psalm

* Removed unnecessary PHPDoc types

* Removed code that optionally would run Psalm during CI

* Fixed some additional Psalm errors

* Switched to using new KeyValuePairIterator for iterating over key value pairs (allows you to extract the key and value directly in a foreach loop)

* Fixed some more Psalm errors

* Fixed more Psalm errors

* Fixed more Psalm errors

* Fixed more Psalm errors

* Fixed more Psalm errors

* Removed accidentally-added composer config

* Updated CHANGELOG, removed errant code from composer.json

* Updated PSR7 composer library version

* Experimenting with signed commits

* Updated a few more Composer dependencies

* Line endings, typo fixes

* Fixed most Psalm errors minus Mockery ones and one that crashes Psalm (intersection type with native interface)

* Ran linter

* Fixed remaining Psalm errors by adding Mockery plugin

Co-authored-by: root <root@Dave-PC.localdomain>
  • Loading branch information
davidbyoung and root committed Mar 19, 2022
1 parent 4d8fc8f commit 7133566
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"psr/http-message": "^1.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.2",
"friendsofphp/php-cs-fixer": "^3.5",
"nyholm/psr7": "^1.2",
"phpunit/phpunit": "~9.5"
},
Expand Down
1 change: 1 addition & 0 deletions src/Psr7/Psr7Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ public function createPsr7Request(IRequest $aphiriaRequest): ServerRequestInterf
$psr7Request = $psr7Request->withParsedBody($parsedBody);
}

/** @psalm-suppress MixedAssignment - The value really could be any type */
foreach ($aphiriaRequest->getProperties() as $key => $value) {
$psr7Request = $psr7Request->withAttribute((string)$key, $value);
}
Expand Down
2 changes: 2 additions & 0 deletions tests/Psr7/Psr7FactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,12 @@ public function testCreatePsr7RequestForMultipartRequestSetsSameUploadedFiles():
/** @var list<UploadedFileInterface> $psr7UploadedFiles */
$psr7UploadedFiles = $psr7Request->getUploadedFiles();
$this->assertCount(2, $psr7UploadedFiles);
/** @psalm-suppress InvalidArrayOffset The PSR-7 stub just uses a generic "array" type rather than array<string, StreamInterface> */
$this->assertSame('file1contents', (string)$psr7UploadedFiles['file1']->getStream());
$this->assertSame('foo.png', $psr7UploadedFiles['file1']->getClientFilename());
$this->assertSame('image/png', $psr7UploadedFiles['file1']->getClientMediaType());
$this->assertSame(\UPLOAD_ERR_OK, $psr7UploadedFiles['file1']->getError());
/** @psalm-suppress InvalidArrayOffset The PSR-7 stub just uses a generic "array" type rather than array<string, StreamInterface> */
$this->assertSame('file2contents', (string)$psr7UploadedFiles['file2']->getStream());
$this->assertSame('bar.png', $psr7UploadedFiles['file2']->getClientFilename());
$this->assertSame('image/png', $psr7UploadedFiles['file2']->getClientMediaType());
Expand Down

0 comments on commit 7133566

Please sign in to comment.