Skip to content

Commit

Permalink
Merge pull request #36 from gsteel/psalm
Browse files Browse the repository at this point in the history
Initialises Psalm
  • Loading branch information
Ocramius committed Jul 21, 2022
2 parents b9a3f88 + 4adb726 commit dfdb42d
Show file tree
Hide file tree
Showing 6 changed files with 4,482 additions and 1,599 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@
/phpcs.xml export-ignore
/phpunit.xml.dist export-ignore
/test/ export-ignore
/psalm.xml export-ignore
/psalm-baseline.xml export-ignore
/.psr-container.php.stub export-ignore
24 changes: 24 additions & 0 deletions .psr-container.php.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

namespace Psr\Container {
/**
* Provides automatic type inference for Psalm when retrieving a service from a container using a FQCN
*/
interface ContainerInterface
{
/**
* @param string|class-string $id
* @return bool
*/
public function has(string $id);

/**
* @template T
* @psalm-param string|class-string<T> $id
* @psalm-return ($id is class-string ? T : mixed)
*/
public function get(string $id);
}
}
7 changes: 5 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@
"laminas/laminas-uri": "^2.9.1",
"laminas/laminas-view": "^2.14.2",
"phpspec/prophecy-phpunit": "^2.0.1",
"phpunit/phpunit": "^9.5.10"
"phpunit/phpunit": "^9.5.10",
"psalm/plugin-phpunit": "^0.17.0",
"vimeo/psalm": "^4.24"
},
"suggest": {
"laminas/laminas-config": "^3.7, to provide page configuration (optional, as arrays and Traversables are also allowed)",
Expand All @@ -73,7 +75,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"
},
"conflict": {
"zendframework/zend-navigation": "*"
Expand Down
Loading

0 comments on commit dfdb42d

Please sign in to comment.