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

Allow registering middleware as string with RouteCollection. #11412

Merged
merged 2 commits into from Nov 9, 2017

Conversation

Projects
None yet
4 participants
@ADmad
Member

ADmad commented Nov 7, 2017

Given that MiddlewareQueue accepts string names for middlewares, I don't see any reason for preventing use of strings when registering middlewares with RouteBuilder/RouteCollection.

@codecov-io

This comment has been minimized.

Show comment
Hide comment
@codecov-io

codecov-io Nov 7, 2017

Codecov Report

Merging #11412 into master will increase coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #11412      +/-   ##
============================================
+ Coverage     93.11%   93.12%   +0.01%     
  Complexity    13007    13007              
============================================
  Files           436      436              
  Lines         33697    33695       -2     
============================================
+ Hits          31376    31379       +3     
+ Misses         2321     2316       -5
Impacted Files Coverage Δ Complexity Δ
src/Routing/RouteCollection.php 93.1% <ø> (-0.08%) 25 <0> (ø)
src/Routing/RouteBuilder.php 99.58% <ø> (ø) 87 <0> (ø) ⬇️
src/Cache/Engine/FileEngine.php 90.16% <0%> (+1.09%) 73% <0%> (ø) ⬇️
src/Cache/CacheRegistry.php 100% <0%> (+4%) 11% <0%> (ø) ⬇️
src/Cache/CacheEngine.php 93.61% <0%> (+4.25%) 19% <0%> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e6e3179...2579df6. Read the comment docs.

codecov-io commented Nov 7, 2017

Codecov Report

Merging #11412 into master will increase coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #11412      +/-   ##
============================================
+ Coverage     93.11%   93.12%   +0.01%     
  Complexity    13007    13007              
============================================
  Files           436      436              
  Lines         33697    33695       -2     
============================================
+ Hits          31376    31379       +3     
+ Misses         2321     2316       -5
Impacted Files Coverage Δ Complexity Δ
src/Routing/RouteCollection.php 93.1% <ø> (-0.08%) 25 <0> (ø)
src/Routing/RouteBuilder.php 99.58% <ø> (ø) 87 <0> (ø) ⬇️
src/Cache/Engine/FileEngine.php 90.16% <0%> (+1.09%) 73% <0%> (ø) ⬇️
src/Cache/CacheRegistry.php 100% <0%> (+4%) 11% <0%> (ø) ⬇️
src/Cache/CacheEngine.php 93.61% <0%> (+4.25%) 19% <0%> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e6e3179...2579df6. Read the comment docs.

@markstory markstory added this to the 3.5.6 milestone Nov 7, 2017

@markstory markstory added the routing label Nov 7, 2017

{
if (is_string($middleware)) {
throw new RuntimeException("The '$name' middleware is not a callable object.");
}

This comment has been minimized.

@markstory

markstory Nov 7, 2017

Member

Should we check that the argument is a non-string callable or a valid class name and error out early?

@markstory

markstory Nov 7, 2017

Member

Should we check that the argument is a non-string callable or a valid class name and error out early?

This comment has been minimized.

@ADmad

ADmad Nov 8, 2017

Member

I don't think that's necessary. MiddlewareQueue also accepts middleware name like Foo which it expands to class name using App::className() when the queue is run.

@ADmad

ADmad Nov 8, 2017

Member

I don't think that's necessary. MiddlewareQueue also accepts middleware name like Foo which it expands to class name using App::className() when the queue is run.

This comment has been minimized.

@markstory
@markstory

markstory Nov 9, 2017

Member

ok

@markstory markstory merged commit bba3ec1 into master Nov 9, 2017

6 checks passed

codecov/patch Coverage not affected when comparing e6e3179...2579df6
Details
codecov/project 93.12% (+0.01%) compared to e6e3179
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
stickler-ci No lint errors found.

@markstory markstory deleted the routing-middleware-string branch Nov 9, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment