Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies #341

Merged
merged 2 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ jobs:
fail-fast: false
matrix:
php-version:
- 8.0
- 8.1
- 8.2

dependencies:
- highest
Expand Down Expand Up @@ -64,20 +64,14 @@ jobs:
fail-fast: false
matrix:
php-version:
- 8.0
- 8.1
- 8.2

symfony-version:
- 5
- 6
- 7

exclude:
- php-version: 8.0
symfony-version: 6
- php-version: 8.0
symfony-version: 7
- php-version: 8.1
symfony-version: 7

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ vendor/bin/psalm-plugin enable psalm/plugin-symfony

| Symfony Psalm Plugin | PHP | Symfony | Psalm |
|----------------------|------------|---------|-------|
| 5.x | ^7.4, ^8.0 | 5, 6, 7 | 5 |
| 5.x | ^8.0 | 5, 6, 7 | 5 |
| 4.x | ^7.4, ^8.0 | 4, 5, 6 | 4 |
| 3.x | ^7.1, ^8.0 | 4, 5, 6 | 4 |
| 2.x | ^7.1, ^8.0 | 4, 5 | 4 |
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
}
],
"require": {
"php": "^7.4 || ^8.0",
"php": "^8.1",
"ext-simplexml": "*",
"symfony/framework-bundle": "^5.0 || ^6.0 || ^7.0",
"vimeo/psalm": "^5.1"
"vimeo/psalm": "^5.24"
},
"require-dev": {
"symfony/form": "^5.0 || ^6.0 || ^7.0",
Expand Down
15 changes: 6 additions & 9 deletions src/Handler/ContainerHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ class ContainerHandler implements AfterMethodCallAnalysisInterface, AfterClassLi
'Symfony\Bundle\FrameworkBundle\Test\TestContainer',
];

/**
* @var ContainerMeta|null
*/
private static $containerMeta;
private static ?ContainerMeta $containerMeta = null;

/**
* @var array<string> collection of cower-cased class names that are present in the container
Expand Down Expand Up @@ -114,7 +111,7 @@ public static function afterMethodCallAnalysis(AfterMethodCallAnalysisEvent $eve
} else {
try {
$serviceId = \constant($className.'::'.$idArgument->name->name);
} catch (\Exception $e) {
} catch (\Exception) {
return;
}
}
Expand All @@ -133,7 +130,7 @@ public static function afterMethodCallAnalysis(AfterMethodCallAnalysisEvent $eve
}

$class = $service->getClass();
if ($class) {
if (null !== $class) {
$codebase->classlikes->addFullyQualifiedClassName($class);
$event->setReturnTypeCandidate(new Union([new TNamedObject($class)]));
}
Expand All @@ -152,15 +149,15 @@ public static function afterMethodCallAnalysis(AfterMethodCallAnalysisEvent $eve
);
}
}
} catch (ServiceNotFoundException $e) {
} catch (ServiceNotFoundException) {
IssueBuffer::accepts(
new ServiceNotFound($serviceId, new CodeLocation($statements_source, $firstArg->value)),
$statements_source->getSuppressedIssues()
);
}
}

public static function afterClassLikeVisit(AfterClassLikeVisitEvent $event)
public static function afterClassLikeVisit(AfterClassLikeVisitEvent $event): void
{
$codebase = $event->getCodebase();
$statements_source = $event->getStatementsSource();
Expand Down Expand Up @@ -221,7 +218,7 @@ function ($c) use ($methodName) {

private static function followsParameterNamingConvention(string $name): bool
{
if (0 === strpos($name, 'env(')) {
if (str_starts_with($name, 'env(')) {
return true;
}

Expand Down
24 changes: 9 additions & 15 deletions src/Symfony/ContainerMeta.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,19 @@ class ContainerMeta
/**
* @var array<string>
*/
private $classNames = [];
private array $classNames = [];

/**
* @var array<string, string>
*/
private $classLocators = [];
private array $classLocators = [];

/**
* @var array<string, array<string, string>>
*/
private $serviceLocators = [];
private array $serviceLocators = [];

/**
* @var ContainerBuilder
*/
private $container;
private ContainerBuilder $container;

public function __construct(array $containerXmlPaths)
{
Expand Down Expand Up @@ -67,10 +64,7 @@ public function get(string $id, ?string $contextClass = null): Definition
return $definition;
}

/**
* @return mixed|null
*/
public function getParameter(string $key)
public function getParameter(string $key): mixed
{
return $this->container->getParameter($key);
}
Expand Down Expand Up @@ -111,7 +105,7 @@ private function init(array $containerXmlPaths): void
$this->classLocators[$this->container->getDefinition($id)->getClass() ?? $id] = (string) $reference;
} elseif ($definition->hasTag('container.service_locator')) {
continue;
} elseif ($className = $definition->getClass()) {
} elseif (null !== $className = $definition->getClass()) {
$this->classNames[] = $className;
}
}
Expand All @@ -138,10 +132,10 @@ private function addServiceLocator(string $key, string $id, Reference $reference
try {
$definition = $this->getDefinition((string) $reference);
$className = $definition->getClass();
if ($className) {
if (null !== $className) {
$this->classNames[] = $className;
}
} catch (ServiceNotFoundException $e) {
} catch (ServiceNotFoundException) {
}
}

Expand All @@ -155,7 +149,7 @@ private function getDefinition(string $id): Definition
} catch (ServiceNotFoundException $serviceNotFoundException) {
try {
$alias = $this->container->getAlias($id);
} catch (InvalidArgumentException $e) {
} catch (InvalidArgumentException) {
throw $serviceNotFoundException;
}

Expand Down
Loading