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

Add laminas-servicemanager:v4 compatibility #65

Merged
merged 1 commit into from
Aug 19, 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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DOCKER_PHP_EXEC := docker compose run php
DOCKER_PHP_EXEC := docker compose run --rm php
PHP_BIN=php -d zend.assertions=1

all: csfix static-analysis test
Expand Down
24 changes: 12 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
],
"require": {
"php": "~8.2.0 || ~8.3.0",
"phpstan/phpstan": "^1.11.9"
"phpstan/phpstan": "^1.11.10"
},
"require-dev": {
"laminas/laminas-cache": "^3.12.2",
"laminas/laminas-cache-storage-adapter-memory": "^2.3.0",
"laminas/laminas-filter": "^2.36.0",
"laminas/laminas-filter": "^2.37.0",
"laminas/laminas-form": "^3.20.0",
"laminas/laminas-hydrator": "^4.15.0",
"laminas/laminas-i18n": "^2.28.0",
Expand All @@ -39,17 +39,17 @@
"slam/php-cs-fixer-extensions": "^3.11.1"
},
"conflict": {
"laminas/laminas-cache": "<3.9",
"laminas/laminas-filter": "<2.29",
"laminas/laminas-form": "<3.8",
"laminas/laminas-hydrator": "<4.10",
"laminas/laminas-i18n": "<2.21",
"laminas/laminas-inputfilter": "<2.22",
"laminas/laminas-cache": "<3.12",
"laminas/laminas-filter": "<2.37",
"laminas/laminas-form": "<3.20",
"laminas/laminas-hydrator": "<4.15",
"laminas/laminas-i18n": "<2.28",
"laminas/laminas-inputfilter": "<2.30",
"laminas/laminas-log": "<2.16",
"laminas/laminas-mail": "<2.21",
"laminas/laminas-mvc": "<3.6",
"laminas/laminas-paginator": "<2.17",
"laminas/laminas-validator": "<2.28"
"laminas/laminas-mail": "<2.25",
"laminas/laminas-mvc": "<3.7",
"laminas/laminas-paginator": "<2.18",
"laminas/laminas-validator": "<2.64"
},
"autoload": {
"psr-4": {
Expand Down
9 changes: 3 additions & 6 deletions src/UnmappedAliasServiceLocatorProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,18 @@
return $this->serviceLocator->get($this->knownUnmappedAliasToClassServices[$id] ?? $id);
}

public function has($id)
public function has($id): bool
{
return $this->serviceLocator->has($id)
|| $this->serviceLocator->has($this->knownUnmappedAliasToClassServices[$id] ?? $id);
}

/**
* @param string $name
* @param null|array<mixed> $options
*
* @return mixed|void
* {@inheritDoc}
*
* @throws ShouldNotHappenException
*/
public function build($name, ?array $options = null)
public function build($name, ?array $options = null): mixed

Check warning on line 47 in src/UnmappedAliasServiceLocatorProxy.php

View check run for this annotation

Codecov / codecov/patch

src/UnmappedAliasServiceLocatorProxy.php#L47

Added line #L47 was not covered by tests
{
throw new ShouldNotHappenException(\sprintf('Why did you call %s?', __METHOD__));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function mainLibrary(): void

public function custom(): void
{
$class = new class() extends AbstractOptions {
$class = new class extends AbstractOptions {
private string $myxyz = 'foo';

public function getMyxyz(string $var): string
Expand All @@ -42,7 +42,7 @@ public function getMyxyz(string $var): string

public function notAbstractOptionsImplementation(): void
{
$class = new class() {
$class = new class {
public function getMyxyz(string $var): string
{
return $var;
Expand Down
6 changes: 3 additions & 3 deletions tests/LaminasIntegration/servicemanagerloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
$app = Application::init([
'modules' => [
'Laminas\Router',
'LaminasPhpStan' => new class() implements ConfigProviderInterface {
'LaminasPhpStan' => new class implements ConfigProviderInterface {
/** @return array<string, array<string, array<string, array<string, string>|Closure|string>>> */
public function getConfig(): array
{
Expand All @@ -33,10 +33,10 @@ public function getConfig(): array
'factories' => [
HeavyService::class => InvokableFactory::class,
'foo_proxy' => static function (): FooService {
return new class() extends FooService {};
return new class extends FooService {};
},
'foo_impl' => static function (): FooInterface {
return new class() implements FooInterface {
return new class implements FooInterface {
public function isFoo(): bool
{
return true;
Expand Down
Loading