Skip to content

Commit 1b3c5e6

Browse files
uses psalm as phar
1 parent d4a6463 commit 1b3c5e6

File tree

10 files changed

+40
-18
lines changed

10 files changed

+40
-18
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
/web
77
/bin/
88
!/bin/box.phar
9+
!/bin/psalm.phar
910
phparkitect.phar
1011
composer.lock
1112
.php-version

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ csfix: ## it launches cs fix
3636
bin/php-cs-fixer fix -v
3737

3838
psalm: ## it launches psalm
39-
bin/psalm
39+
bin/psalm.phar
4040

4141
build: ## it launches all the build
4242
composer install

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
"require-dev": {
3838
"roave/security-advisories": "dev-master",
3939
"symfony/var-dumper": "^3.0|^4.0|^5.0|^6.0|^7.0",
40-
"vimeo/psalm": "^4.6",
4140
"phpunit/phpunit": "^7.5|^9.0|^10.0",
4241
"mikey179/vfsstream": "^1.6",
4342
"phpspec/prophecy": "^1.10",
@@ -55,7 +54,8 @@
5554
}
5655
},
5756
"config": {
58-
"bin-dir": "bin"
57+
"bin-dir": "bin",
58+
"sort-packages": true
5959
},
6060
"bin": [
6161
"bin-stub/phparkitect"

psalm.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
55
xmlns="https://getpsalm.org/schema/config"
66
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
7-
7+
findUnusedCode="false"
8+
findUnusedBaselineEntry="false"
89
allowStringToStandInForClass="true"
910
>
1011
<projectFiles>

src/Analyzer/ClassDescription.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
declare(strict_types=1);
34

45
namespace Arkitect\Analyzer;
@@ -46,6 +47,7 @@ class ClassDescription
4647
* @param list<FullyQualifiedClassName> $interfaces
4748
* @param ?FullyQualifiedClassName $extends
4849
* @param list<FullyQualifiedClassName> $attributes
50+
* @param list<string> $docBlock
4951
*/
5052
public function __construct(
5153
FullyQualifiedClassName $FQCN,

src/Analyzer/FileVisitor.php

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
declare(strict_types=1);
34

45
namespace Arkitect\Analyzer;
@@ -30,7 +31,7 @@ public function enterNode(Node $node): void
3031

3132
foreach ($node->implements as $interface) {
3233
$this->classDescriptionBuilder
33-
->addInterface($interface->toString(), $interface->getLine());
34+
->addInterface($interface->toString(), $interface->getLine());
3435
}
3536

3637
if (!$node->isAnonymous() && null !== $node->extends) {
@@ -76,7 +77,8 @@ public function enterNode(Node $node): void
7677
*
7778
* @see FileVisitorTest::test_it_should_return_errors_for_const_outside_namespace
7879
*/
79-
if ($node instanceof Node\Expr\ClassConstFetch
80+
if (
81+
$node instanceof Node\Expr\ClassConstFetch
8082
&& method_exists($node->class, 'toString')
8183
) {
8284
if ($this->isSelfOrStaticOrParent($node->class->toString())) {
@@ -93,7 +95,8 @@ public function enterNode(Node $node): void
9395
*
9496
* @see FileVisitorTest::test_should_returns_all_dependencies
9597
*/
96-
if ($node instanceof Node\Expr\StaticCall
98+
if (
99+
$node instanceof Node\Expr\StaticCall
97100
&& method_exists($node->class, 'toString')
98101
) {
99102
if ($this->isSelfOrStaticOrParent($node->class->toString())) {
@@ -104,7 +107,8 @@ public function enterNode(Node $node): void
104107
->addDependency(new ClassDependency($node->class->toString(), $node->getLine()));
105108
}
106109

107-
if ($node instanceof Node\Expr\Instanceof_
110+
if (
111+
$node instanceof Node\Expr\Instanceof_
108112
&& method_exists($node->class, 'toString')
109113
) {
110114
if ($this->isSelfOrStaticOrParent($node->class->toString())) {
@@ -114,11 +118,13 @@ public function enterNode(Node $node): void
114118
->addDependency(new ClassDependency($node->class->toString(), $node->getLine()));
115119
}
116120

117-
if ($node instanceof Node\Expr\New_
121+
if (
122+
$node instanceof Node\Expr\New_
118123
&& !($node->class instanceof Node\Expr\Variable)
119124
) {
120-
if ((method_exists($node->class, 'isAnonymous') && $node->class->isAnonymous())
121-
|| !method_exists($node->class, 'toString')) {
125+
if ((method_exists($node->class, 'isAnonymous') && true === $node->class->isAnonymous())
126+
|| !method_exists($node->class, 'toString')
127+
) {
122128
return;
123129
}
124130

@@ -215,7 +221,7 @@ public function enterNode(Node $node): void
215221
$returnType = $node->returnType;
216222
if ($returnType instanceof Node\Name\FullyQualified) {
217223
$this->classDescriptionBuilder
218-
->addDependency(new ClassDependency($returnType->toString(), $returnType->getLine()));
224+
->addDependency(new ClassDependency($returnType->toString(), $returnType->getLine()));
219225
}
220226
}
221227
}
@@ -271,7 +277,7 @@ private function addParamDependency(Node\Param $node): void
271277
$type = $nullableType->type;
272278
}
273279

274-
if (method_exists($type, 'isSpecialClassName') && $type->isSpecialClassName()) {
280+
if (method_exists($type, 'isSpecialClassName') && true === $type->isSpecialClassName()) {
275281
return;
276282
}
277283

src/CLI/Command/Check.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int
9797
$startTime = microtime(true);
9898

9999
try {
100-
$verbose = $input->getOption('verbose');
101-
$stopOnFailure = $input->getOption(self::STOP_ON_FAILURE_PARAM);
102-
$useBaseline = $input->getOption(self::USE_BASELINE_PARAM);
103-
$skipBaseline = $input->getOption(self::SKIP_BASELINE_PARAM);
104-
$ignoreBaselineLinenumbers = $input->getOption(self::IGNORE_BASELINE_LINENUMBERS_PARAM);
100+
$verbose = (bool) $input->getOption('verbose');
101+
$stopOnFailure = (bool) $input->getOption(self::STOP_ON_FAILURE_PARAM);
102+
$useBaseline = (string) $input->getOption(self::USE_BASELINE_PARAM);
103+
$skipBaseline = (bool) $input->getOption(self::SKIP_BASELINE_PARAM);
104+
$ignoreBaselineLinenumbers = (bool) $input->getOption(self::IGNORE_BASELINE_LINENUMBERS_PARAM);
105105

106106
if (true !== $skipBaseline && !$useBaseline && file_exists(self::DEFAULT_BASELINE_FILENAME)) {
107107
$useBaseline = self::DEFAULT_BASELINE_FILENAME;

src/ClassSet.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
<?php
2+
23
declare(strict_types=1);
34

45
namespace Arkitect;
56

67
use Symfony\Component\Finder\Finder;
78

9+
/**
10+
* @template-implements \IteratorAggregate<string, \SplFileInfo>
11+
*/
812
class ClassSet implements \IteratorAggregate
913
{
1014
/** @var string */

src/Rules/ParsingErrors.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
<?php
2+
23
declare(strict_types=1);
34

45
namespace Arkitect\Rules;
56

67
use Arkitect\Exceptions\IndexNotFoundException;
78

9+
/**
10+
* @template-implements \IteratorAggregate<ParsingError>
11+
*/
812
class ParsingErrors implements \IteratorAggregate, \Countable
913
{
1014
/**

src/Rules/Violations.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,16 @@
77
use Arkitect\Exceptions\FailOnFirstViolationException;
88
use Arkitect\Exceptions\IndexNotFoundException;
99

10+
/**
11+
* @template-implements \IteratorAggregate<Violation>
12+
*/
1013
class Violations implements \IteratorAggregate, \Countable, \JsonSerializable
1114
{
1215
/**
1316
* @var Violation[]
1417
*/
1518
private $violations;
19+
1620
/**
1721
* @var bool
1822
*/

0 commit comments

Comments
 (0)