Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

PSR-15 support (http-interop/http-server-middleware) + PHP 7.1 #529

Merged
merged 22 commits into from
Dec 11, 2017
Merged

PSR-15 support (http-interop/http-server-middleware) + PHP 7.1 #529

merged 22 commits into from
Dec 11, 2017

Conversation

michalbundyra
Copy link
Member

@michalbundyra michalbundyra commented Nov 20, 2017

  • dropped PHP 5.6 and 7.0
  • updated Travis CI configuration

Requires:

We need update the docs, and remove probably some functionality like double-pass middlewares.

- dropped PHP 5.6 and 7.0
- updated Travis CI configuration
@asgrim
Copy link

asgrim commented Nov 21, 2017

Probably worth linking to the discussion on this for anyone researching: https://discourse.zendframework.com/t/psr-15-compatibility-issues-and-proposal/378

"responsePrototype" has been removed in MiddlewarePipe so it has been added
here to Application as provate property and Application has one more
not mandatory parameter in costructor
Default, as before, response prototype is initialized with
Zend\Diactoros\Response

New wrappers (decorators) are used.
Added return type declaration on "pipe" method of Application.
We return $this, but parrent method has "self" return type declared.
Here we have to use "parent" and in PHPDocs we can point that it is "self".
@weierophinney weierophinney added this to the 3.0.0alpha1 milestone Dec 5, 2017
composer.json Outdated
"zendframework/zend-diactoros": "^1.3.10",
"zendframework/zend-expressive-router": "^2.2",
"zendframework/zend-expressive-router": "dev-feature/psr-15 as 2.2",
Copy link
Member

Choose a reason for hiding this comment

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

You can now pin this to 3.0.x-dev or dev-release-3.0.0.

Copy link
Member Author

Choose a reason for hiding this comment

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

Unfortunately for now we need to have 3.0.x-dev as 2.3 as expressive-*router libraries does not support v3 yet. I'm going to work on it soon.

composer.json Outdated
"type": "git",
"url": "https://github.com/webimpress/zend-expressive-router.git"
}
],
Copy link
Member

Choose a reason for hiding this comment

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

You can remove this now.

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed.

composer.json Outdated
"zendframework/zend-expressive-template": "^1.0.4",
"zendframework/zend-stratigility": "^2.1"
"zendframework/zend-stratigility": "dev-release-3.0.0"
Copy link
Member

Choose a reason for hiding this comment

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

Maybe try one of the following constraints:

  • ^3.0.0@dev
  • ^3.0.0@dev as 3.0.0alpha1
  • ^3.0.0-dev
  • ^3.0.0-dev as 3.0.0alpha1

My understanding is that we should use semver constraints instead of the branch name if an alias exists; I just can't recall off the top of my head what that should look like. Experiment! 😁

Copy link
Member Author

Choose a reason for hiding this comment

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

Looks like ^3.0.0@dev and ^3.0.0-dev are the same, when I try with alias I got error:

Problem 1
- The requested package zendframework/zend-stratigility ^3.0.0@dev as 3.0.0alpha1 exists as zendframework/zend-stratigility[1.0.0, 1.0.1, 1.0.2, 1.1.0, 1.1.1, 1.1.2, 1.1.3, 1.2.0, 1.2.1, 1.3.0, 1.3.1, 1.3.2, 1.3.3, 2.0.0, 2.0.1, 2.1.0, 2.1.1, 2.1.2, dev-develop, 2.2.x-dev, dev-master, 2.1.x-dev, dev-release-3.0.0, 3.0.x-dev] but these are rejected by your constraint.

@michalbundyra
Copy link
Member Author

@weierophinney because we decided to typehint on MiddlewareInterface in Route we have to load all middlewares (also routed) on application start. Before routed middlewares were loaded only when the path was hit, and it was right, IMO. Do you have any suggestion what we can do or we should just revert change in zend-expressive-router?

Other that than we have some issues in test caused by bug in prophecy, please see:
phpspec/prophecy#368
I've already provided fix there (phpspec/prophecy#377) but not sure when we have it released.

@weierophinney
Copy link
Member

@weierophinney because we decided to typehint on MiddlewareInterface in Route we have to load all middlewares (also routed) on application start. Before routed middlewares were loaded only when the path was hit, and it was right, IMO. Do you have any suggestion what we can do or we should just revert change in zend-expressive-router?

This is not true. In the v2 series, route() will create a LazyLoadingMiddleware instance when a middleware service name is provided, and inject that into the Route instance created.

Currently, the only way the middleware passed to a Route instance will NOT be a MiddlewareInterface is if the Route is created manually by the user.

We are waiting for release, this is to have less tests failing...
Now zend-expressive-router RouteResult::fromRouteFailure() requires
parameter. It resolves prophecy issue and it's more clear
because we have to provide parameter explicitly
- Removed default value from $middleware
- added type hint on $name to string
- fixed doc-block
Because we have typehints we are expecting now TypeError.
We have it got in all these cases because we declare strict_types.
$middleware can't be now omitted, in case we pas null we got
InvalidMiddlewareException
@weierophinney
Copy link
Member

@webimpress Do not worry about rebasing; I've almost completed the merge locally, and will push to release-3.0.0 shortly.

@weierophinney weierophinney merged commit 16bb652 into zendframework:release-3.0.0 Dec 11, 2017
weierophinney added a commit that referenced this pull request Dec 11, 2017
PSR-15 support (http-interop/http-server-middleware) + PHP 7.1

Conflicts:
	.travis.yml
	composer.json
	composer.lock
	docs/book/cookbook/passing-data-between-middleware.md
	docs/book/cookbook/setting-locale-without-routing-parameter.md
	docs/book/cookbook/using-routed-middleware-class-as-controller.md
	docs/book/features/middleware-types.md
	docs/book/getting-started/skeleton.md
	src/Application.php
	src/Delegate/NotFoundDelegate.php
	src/MarshalMiddlewareTrait.php
	src/Middleware/DispatchMiddleware.php
	src/Middleware/ImplicitHeadMiddleware.php
	src/Middleware/ImplicitOptionsMiddleware.php
	src/Middleware/LazyLoadingMiddleware.php
	src/Middleware/NotFoundHandler.php
	src/Middleware/RouteMiddleware.php
	test/Application/MarshalMiddlewareTraitTest.php
	test/Application/TestAsset/CallableInteropMiddleware.php
	test/Application/TestAsset/InteropMiddleware.php
	test/ApplicationTest.php
	test/Container/ApplicationFactoryTest.php
	test/IntegrationTest.php
	test/Middleware/DispatchMiddlewareTest.php
	test/Middleware/ImplicitHeadMiddlewareTest.php
	test/Middleware/ImplicitOptionsMiddlewareTest.php
	test/Middleware/LazyLoadingMiddlewareTest.php
	test/Middleware/NotFoundHandlerTest.php
	test/Middleware/RouteMiddlewareTest.php
	test/Router/IntegrationTest.php
	test/TestAsset/CallableInteropMiddleware.php
	test/TestAsset/InteropMiddleware.php
weierophinney added a commit that referenced this pull request Dec 11, 2017
weierophinney added a commit that referenced this pull request Dec 11, 2017
@weierophinney
Copy link
Member

Thanks, @webimpress!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants