Skip to content
This repository has been archived by the owner on Dec 3, 2023. It is now read-only.

Commit

Permalink
[PHPStan] Set compatible with upcoming PHPStan 1.6.x with set NodeCon…
Browse files Browse the repository at this point in the history
…nectingVisitor tags (#4029)

Co-authored-by: GitHub Action <[email protected]>
  • Loading branch information
samsonasik and actions-user authored Apr 15, 2022
1 parent 41f4366 commit 7eaf54e
Show file tree
Hide file tree
Showing 17 changed files with 47 additions and 13 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"nikic/php-parser": "^4.13.2",
"phar-io/version": "^3.2",
"phpstan/phpdoc-parser": "^1.2",
"phpstan/phpstan": "^1.4.8",
"phpstan/phpstan": "^1.5.6",
"react/child-process": "^0.6.4",
"react/event-loop": "^1.2",
"react/socket": "^1.11",
Expand Down
3 changes: 2 additions & 1 deletion packages/astral/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"nette/utils": "^3.2",
"symfony/dependency-injection": "^6.0",
"symplify/smart-file-system": "^10.3",
"phpstan/phpstan": "^1.4.8",
"phpstan/phpstan": "^1.5.6",
"phpstan/phpdoc-parser": "^1.2",
"symfony/config": "^6.0",
"nikic/php-parser": "^4.13.2",
Expand All @@ -35,6 +35,7 @@
},
"phpstan": {
"includes": [
"config/config.neon",
"config/services.neon"
]
}
Expand Down
3 changes: 3 additions & 0 deletions packages/astral/config/config.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
conditionalTags:
PhpParser\NodeVisitor\NodeConnectingVisitor:
phpstan.parser.richParserNodeVisitor: true
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,26 @@ final class StaticVersionResolver
*/
public const RELEASE_DATE = '@release_date@';

/**
* @var string
*/
private const GIT = 'git';

public static function resolvePackageVersion(): string
{
$pointsAtProcess = new Process(['git', 'tag', '--points-at'], __DIR__);
$pointsAtProcess = new Process([self::GIT, 'tag', '--points-at'], __DIR__);
if ($pointsAtProcess->run() !== Command::SUCCESS) {
throw new VersionException(
'You must ensure to run compile from composer git repository clone and that git binary is available.'
);
}

$tag = trim($pointsAtProcess->getOutput());
if ($tag) {
if ($tag !== '' && $tag !== '0') {
return $tag;
}

$process = new Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);
$process = new Process([self::GIT, 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);
if ($process->run() !== Command::SUCCESS) {
throw new VersionException(
'You must ensure to run compile from composer git repository clone and that git binary is available.'
Expand All @@ -52,7 +57,7 @@ public static function resolvePackageVersion(): string

public static function resolverReleaseDateTime(): DateTime
{
$process = new Process(['git', 'log', '-n1', '--pretty=%ci', 'HEAD'], __DIR__);
$process = new Process([self::GIT, 'log', '-n1', '--pretty=%ci', 'HEAD'], __DIR__);
if ($process->run() !== Command::SUCCESS) {
throw new VersionException(
'You must ensure to run compile from composer git repository clone and that git binary is available.'
Expand Down
3 changes: 2 additions & 1 deletion packages/latte-phpstan-compiler/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"nette/utils": "^3.2",
"nette/application": "^3.1",
"latte/latte": "^2.11",
"phpstan/phpstan": "^1.4.8",
"phpstan/phpstan": "^1.5.6",
"symplify/astral": "^10.3",
"symplify/package-builder": "^10.3",
"symplify/template-phpstan-compiler": "^10.3"
Expand All @@ -35,6 +35,7 @@
},
"phpstan": {
"includes": [
"config/config.neon",
"config/services.neon"
]
}
Expand Down
3 changes: 3 additions & 0 deletions packages/latte-phpstan-compiler/config/config.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
conditionalTags:
PhpParser\NodeVisitor\NodeConnectingVisitor:
phpstan.parser.richParserNodeVisitor: true
2 changes: 1 addition & 1 deletion packages/phpstan-extensions/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "MIT",
"require": {
"php": ">=8.0",
"phpstan/phpstan": "^1.4.8",
"phpstan/phpstan": "^1.5.6",
"symplify/package-builder": "^10.3",
"symplify/smart-file-system": "^10.3",
"symplify/astral": "^10.3"
Expand Down
4 changes: 4 additions & 0 deletions packages/phpstan-extensions/config/config.neon
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
conditionalTags:
PhpParser\NodeVisitor\NodeConnectingVisitor:
phpstan.parser.richParserNodeVisitor: true

includes:
- symplify.error_formatter.neon

Expand Down
3 changes: 2 additions & 1 deletion packages/phpstan-latte-rules/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "MIT",
"require": {
"php": ">=8.0",
"phpstan/phpstan": "^1.4.8",
"phpstan/phpstan": "^1.5.6",
"latte/latte": "^2.11",
"symplify/astral": "^10.3",
"symplify/rule-doc-generator-contracts": "^10.3",
Expand Down Expand Up @@ -38,6 +38,7 @@
},
"phpstan": {
"includes": [
"config/config.neon",
"config/rules.neon",
"config/services.neon"
]
Expand Down
3 changes: 3 additions & 0 deletions packages/phpstan-latte-rules/config/config.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
conditionalTags:
PhpParser\NodeVisitor\NodeConnectingVisitor:
phpstan.parser.richParserNodeVisitor: true
3 changes: 2 additions & 1 deletion packages/phpstan-rules/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"nikic/php-parser": "^4.13.2",
"nette/utils": "^3.2",
"phpstan/phpdoc-parser": "^1.2",
"phpstan/phpstan": "^1.4.8",
"phpstan/phpstan": "^1.5.6",
"symplify/astral": "^10.3",
"symplify/composer-json-manipulator": "^10.3",
"symplify/package-builder": "^10.3",
Expand Down Expand Up @@ -54,6 +54,7 @@
},
"phpstan": {
"includes": [
"config/config.neon",
"config/services/services.neon",
"packages/cognitive-complexity/config/cognitive-complexity-services.neon",
"packages/symfony/config/services.neon",
Expand Down
3 changes: 3 additions & 0 deletions packages/phpstan-rules/config/config.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
conditionalTags:
PhpParser\NodeVisitor\NodeConnectingVisitor:
phpstan.parser.richParserNodeVisitor: true
2 changes: 1 addition & 1 deletion packages/rule-doc-generator/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"require-dev": {
"phpunit/phpunit": "^9.5",
"phpstan/phpstan": "^1.4.8",
"phpstan/phpstan": "^1.5.6",
"friendsofphp/php-cs-fixer": "^3.7"
},
"autoload": {
Expand Down
2 changes: 1 addition & 1 deletion packages/symfony-static-dumper/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"require-dev": {
"doctrine/annotations": "^1.13",
"doctrine/cache": "^1.12",
"phpstan/phpstan": "^1.4.8",
"phpstan/phpstan": "^1.5.6",
"phpunit/phpunit": "^9.5",
"symfony/framework-bundle": "^6.0",
"symfony/twig-bundle": "^6.0"
Expand Down
3 changes: 2 additions & 1 deletion packages/template-phpstan-compiler/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"nette/utils": "^3.2",
"symplify/astral": "^10.3",
"symplify/package-builder": "^10.3",
"phpstan/phpstan": "^1.4.8"
"phpstan/phpstan": "^1.5.6"
},
"require-dev": {
"phpunit/phpunit": "^9.5",
Expand All @@ -31,6 +31,7 @@
},
"phpstan": {
"includes": [
"config/config.neon",
"config/services.neon"
]
}
Expand Down
3 changes: 3 additions & 0 deletions packages/template-phpstan-compiler/config/config.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
conditionalTags:
PhpParser\NodeVisitor\NodeConnectingVisitor:
phpstan.parser.richParserNodeVisitor: true
5 changes: 5 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
conditionalTags:
PhpParser\NodeVisitor\NodeConnectingVisitor:
phpstan.parser.richParserNodeVisitor: true

includes:
- packages/astral/config/services.neon
- packages/phpstan-extensions/config/config.neon
Expand Down Expand Up @@ -489,6 +493,7 @@ parameters:
- packages/easy-coding-standard/src/Application/EasyCodingStandardApplication.php
- packages/easy-coding-standard/packages/*/Application/*FileProcessor.php
- packages/php-config-printer/src/NodeFactory/Service/ServiceOptionNodeFactory.php
- packages/php-config-printer/src/Printer/SmartPhpConfigPrinter.php

-
message: '#Complete known array shape to the method @return type#'
Expand Down

0 comments on commit 7eaf54e

Please sign in to comment.