Skip to content

Commit 00c3cee

Browse files
authored
Merge branch 'main' into testscript
2 parents 916eb13 + cb3ce4c commit 00c3cee

File tree

8 files changed

+34
-37
lines changed

8 files changed

+34
-37
lines changed

.github/workflows/code_analysis.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ jobs:
3636
name: 'Tests'
3737
run: vendor/bin/phpunit
3838

39-
-
40-
name: 'Check Active Classes'
41-
run: vendor/bin/class-leak check src --ansi --skip-suffix "TypeExtension"
42-
4339
name: ${{ matrix.actions.name }}
4440
runs-on: ubuntu-latest
4541

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/vendor
22
composer.lock
3+
.idea
34

45
# phpunit 10+
56
/.phpunit.cache

README.md

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,32 @@
22

33
[![Downloads total](https://img.shields.io/packagist/dt/symplify/phpstan-extensions.svg?style=flat-square)](https://packagist.org/packages/symplify/phpstan-extensions/stats)
44

5+
<br>
6+
57
## Install
68

79
```bash
810
composer require symplify/phpstan-extensions --dev
911
```
1012

11-
Update config:
12-
13-
```yaml
14-
# phpstan.neon
15-
includes:
16-
- 'vendor/symplify/phpstan-extensions/config/config.neon'
17-
```
13+
<b>
1814

19-
## Use
15+
## Symplify Error Formatter
2016

21-
### Symplify Error Formatter
17+
Update your `phpstan.neon` config:
2218

23-
*Works best with [anthraxx/intellij-awesome-console](https://github.com/anthraxx/intellij-awesome-console)*
19+
```yaml
20+
parameters:
21+
errorFormat: symplify
22+
```
2423
2524
- Do you want to **click the error and get right to the line in the file** it's reported at?
2625
- Do you want to **copy-paste regex escaped error to your `ignoreErrors`**?
2726

27+
Works best with [anthraxx/intellij-awesome-console](https://github.com/anthraxx/intellij-awesome-console)
28+
2829
```bash
29-
vendor/bin/phpstan analyse src --level max --error-format symplify
30+
vendor/bin/phpstan analyse src
3031
```
3132

3233
@@ -41,9 +42,9 @@ src/Command/ReleaseCommand.php:51
4142

4243
<br>
4344

44-
### Return Type Extensions
45+
## Improved Symfony Types
4546

46-
#### `Symplify\PHPStanExtensions\ReturnTypeExtension\ContainerGetTypeExtension`
47+
#### `ContainerGetTypeExtension`
4748

4849
With Symfony container and type as an argument, you always know **the same type is returned**:
4950

@@ -60,7 +61,9 @@ $container->get(Type::class);
6061
$this->get(Type::class);
6162
```
6263

63-
#### `Symplify\PHPStanExtensions\ReturnTypeExtension\KernelGetContainerAfterBootReturnTypeExtension`
64+
<br>
65+
66+
#### `KernelGetContainerAfterBootReturnTypeExtension`
6467

6568
After Symfony Kernel boot, `getContainer()` always returns the container:
6669

@@ -82,7 +85,9 @@ $kernel->getContainer();
8285
// Reality: ContainerInterface ✅
8386
```
8487

85-
#### `Symplify\PHPStanExtensions\ReturnTypeExtension\SplFileInfoTolerantReturnTypeExtension`
88+
<br>
89+
90+
#### `SplFileInfoTolerantReturnTypeExtension`
8691

8792
Symfony Finder finds only existing files (obviously), so the `getRealPath()` always return `string`:
8893

@@ -101,10 +106,4 @@ foreach ($finder as $fileInfo) {
101106

102107
<br>
103108

104-
## Report Issues
105-
106-
In case you are experiencing a bug or want to request a new feature head over to the [Symplify monorepo issue tracker](https://github.com/symplify/symplify/issues)
107-
108-
## Contribute
109-
110-
The sources of this package are contained in the Symplify monorepo. We welcome contributions for this package on [symplify/symplify](https://github.com/symplify/symplify).
109+
Happy coding!

composer.json

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,14 @@
88
"phpstan/phpstan": "^2.0"
99
},
1010
"require-dev": {
11-
"illuminate/container": "^10.39",
12-
"phpstan/extension-installer": "^1.3",
13-
"phpunit/phpunit": "^10.3",
11+
"illuminate/container": "^11.0",
12+
"phpstan/extension-installer": "^1.4",
13+
"phpunit/phpunit": "^11.4",
1414
"rector/rector": "^2.0",
1515
"symfony/dependency-injection": "^6.4",
1616
"symfony/finder": "^6.2",
1717
"symplify/easy-coding-standard": "^12.0",
18-
"symplify/phpstan-rules": "^14.0",
19-
"tomasvotruba/class-leak": "^1.1.2",
18+
"symplify/phpstan-rules": "^14.1",
2019
"tracy/tracy": "^2.9"
2120
},
2221
"autoload": {
@@ -41,13 +40,11 @@
4140
},
4241
"scripts": {
4342
"check-cs": "vendor/bin/ecs check --ansi",
44-
"fix-cs": "vendor/bin/ecs check --fix --ansi",
43+
"fix-cs": "vendor/bin/ecs check --fix",
44+
"phpstan": "vendor/bin/phpstan analyse",
4545
"test": "vendor/bin/phpunit",
46-
"phpstan": "vendor/bin/phpstan analyse --ansi --error-format symplify",
4746
"rector": "vendor/bin/rector process --dry-run --ansi"
4847
},
49-
"minimum-stability": "dev",
50-
"prefer-stable": true,
5148
"config": {
5249
"sort-packages": true,
5350
"platform-check": false,

phpstan.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ includes:
33

44
parameters:
55
level: 8
6+
errorFormat: symplify
67

78
paths:
89
- src

src/Console/Terminal.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ private static function readFromProcess(string $command): ?string
127127

128128
private static function getAnsiconWidth(): ?int
129129
{
130-
if (!is_string(\getenv('ANSICON'))) {
130+
if (! is_string(\getenv('ANSICON'))) {
131131
return null;
132132
}
133133

src/ErrorFormatter/SymplifyErrorFormatter.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ private function printSingleError(Error $error, OutputStyle $outputStyle): void
136136
$itemMessage = sprintf(" - '%s'", $regexMessage);
137137
$this->writeln($itemMessage);
138138

139+
if ($error->getIdentifier() !== null && $error->canBeIgnored()) {
140+
$this->writeln(' 🪪 ' . $error->getIdentifier());
141+
}
142+
139143
$this->separator();
140144
$outputStyle->newLine();
141145
}

src/TypeResolver/ClassConstFetchReturnTypeResolver.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
use PhpParser\Node\Identifier;
1111
use PhpParser\Node\Name;
1212
use PHPStan\Reflection\MethodReflection;
13-
use PHPStan\Reflection\ParametersAcceptorSelector;
1413
use PHPStan\Type\MixedType;
1514
use PHPStan\Type\ObjectType;
1615
use PHPStan\Type\Type;

0 commit comments

Comments
 (0)