Skip to content
Closed
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
14 changes: 13 additions & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,16 @@ jobs:
php-version: ${{ env.default_php }}
tools: composer
- uses: ramsey/composer-install@v3
- run: composer rector
- run: composer rector

dep-analyser:
runs-on: ubuntu-latest
name: Run Dependency analysis
steps:
- uses: actions/[email protected]
- uses: shivammathur/[email protected]
with:
php-version: ${{ env.default_php }}
tools: composer
- uses: ramsey/composer-install@v3
- run: composer dep-analysis
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"psr/container": "^1.0 || ^2.0",
"psr/http-factory": "^1.0",
"psr/http-message": "^1.0 || ^2.0",
"psr/http-server-handler": "^1.0",
"psr/http-server-middleware": "^1.0",
"spatie/array-to-xml": "^3.3.0",
"webmozart/assert": "^1.10",
Expand All @@ -53,6 +54,7 @@
"phpunit/phpunit": "^11.5.42",
"psalm/plugin-phpunit": "^0.19.5",
"rector/rector": "^2.1",
"shipmonk/composer-dependency-analyser": "^1.8",
"vimeo/psalm": "^6.13.1"
},
"autoload": {
Expand All @@ -72,6 +74,7 @@
],
"cs-check": "phpcs",
"cs-fix": "phpcbf",
"dep-analysis": "composer-dependency-analyser --disable-ext-analysis",
"rector": "rector -n -vv",
"rector:fix": "rector -vv",
"static-analysis": "psalm --shepherd --stats",
Expand Down
68 changes: 67 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@
<referencedClass name="Mezzio\ProblemDetails\Response\CallableResponseFactoryDecorator"/>
</errorLevel>
</InternalClass>
<UndefinedClass>
<errorLevel type="suppress">
<referencedClass name="Mezzio\Container\ResponseFactoryFactory"/>
</errorLevel>
</UndefinedClass>
<DeprecatedTrait>
<errorLevel type="suppress">
<file name="src/ProblemDetailsResponseFactoryFactory.php"/>
Expand Down
12 changes: 0 additions & 12 deletions src/ConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@

namespace Mezzio\ProblemDetails;

use Zend\ProblemDetails\ProblemDetailsMiddleware as LegacyProblemDetailsMiddleware;
use Zend\ProblemDetails\ProblemDetailsNotFoundHandler as LegacyProblemDetailsNotFoundHandler;
use Zend\ProblemDetails\ProblemDetailsResponseFactory as LegacyProblemDetailsResponseFactory;

/**
* Configuration provider for the package.
*
Expand All @@ -29,18 +25,10 @@ public function __invoke(): array

/**
* Returns the container dependencies.
*
* @psalm-suppress UndefinedClass
*/
public function getDependencies(): array
{
return [
// Legacy Zend Framework aliases
'aliases' => [
LegacyProblemDetailsMiddleware::class => ProblemDetailsMiddleware::class,
LegacyProblemDetailsNotFoundHandler::class => ProblemDetailsNotFoundHandler::class,
LegacyProblemDetailsResponseFactory::class => ProblemDetailsResponseFactory::class,
],
Comment on lines -38 to -43
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These aliases cannot be dropped in a minor - that's a BC break. They can be stringified to prevent issues though.

'factories' => [
ProblemDetailsMiddleware::class => ProblemDetailsMiddlewareFactory::class,
ProblemDetailsNotFoundHandler::class => ProblemDetailsNotFoundHandlerFactory::class,
Expand Down
3 changes: 1 addition & 2 deletions src/Psr17ResponseFactoryTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Mezzio\ProblemDetails;

use Mezzio\Container\ResponseFactoryFactory;
use Mezzio\ProblemDetails\Response\CallableResponseFactoryDecorator;
use Psr\Container\ContainerInterface;
use Psr\Http\Message\ResponseFactoryInterface;
Expand Down Expand Up @@ -68,6 +67,6 @@ private function doesConfigurationProvidesDedicatedResponseFactory(ContainerInte
/** @psalm-suppress MixedAssignment */
$deprecatedResponseFactory = $dependencies['factories'][ResponseInterface::class] ?? null;

return $deprecatedResponseFactory !== null && $deprecatedResponseFactory !== ResponseFactoryFactory::class;
return $deprecatedResponseFactory !== null;
Comment on lines -71 to +70
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is in place for BC with callable response factories - it can't be removed in a minor

}
}
8 changes: 0 additions & 8 deletions test/Psr17ResponseFactoryTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use Generator;
use Laminas\Diactoros\Response\TextResponse;
use Mezzio\Container\ResponseFactoryFactory;
use Mezzio\ProblemDetails\Response\CallableResponseFactoryDecorator;
use MezzioTest\ProblemDetails\TestAsset\Psr17ResponseFactoryTraitImplementation;
use PHPUnit\Framework\Attributes\DataProvider;
Expand Down Expand Up @@ -67,13 +66,6 @@ public function testWillUseResponseFactoryInterfaceFromContainerWhenApplicationF
{
$responseFactory = $this->createMock(ResponseFactoryInterface::class);
$container = new InMemoryContainer();
$container->set('config', [
'dependencies' => [
'factories' => [
ResponseInterface::class => ResponseFactoryFactory::class,
],
],
]);
$container->set(ResponseFactoryInterface::class, $responseFactory);
$detectedResponseFactory = ($this->factory)($container);
self::assertSame($responseFactory, $detectedResponseFactory);
Expand Down