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

Fix "Deprecated: Non-static method should not be called statically" #16

Merged
merged 3 commits into from
Nov 9, 2018

Conversation

TypicalFence
Copy link
Contributor

When writing classes like in your examples:

use Jgut\Slim\Routing\Mapping\Annotation as JSR;

/**
 * @JSR\Router
 */
class Controller
{
    /**
     * @JSR\Route(pattern="/hello")
     */
    public function doSomething()
    {
    }
}

we would get errors like Deprecated: Non-static method should not be called statically, as a workaround we would just make all the methods static, which worked.

But we also had the problem that we wanted to write Controller Classes, which get a reference to the Container injected.

Because of this, I changed the format in which the class and method gets handed over to Slim, to the way to this section in the documentation describes how it should be done ("Class:method").

Also please note that we are using PHP 7.2.

@coveralls
Copy link

coveralls commented Nov 8, 2018

Coverage Status

Coverage increased (+0.8%) to 99.847% when pulling 452872e on AlexFence:master into 0726a07 on juliangut:master.

@@ -97,7 +97,7 @@ protected function getGroupMetadata(array $mapping, GroupMetadata $parentGroup =
*
* @return RouteMetadata
*/
protected function getRouteMetadata(array $mapping, GroupMetadata $group = null): RouteMetadata
protected function getRouteMetadata($mapping, GroupMetadata $group = null): RouteMetadata
Copy link
Owner

Choose a reason for hiding this comment

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

Why remove this typehint? $mapping is still an array

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I accidentally removed it while I was trying to get it working, I guess. I added it back in!

@juliangut
Copy link
Owner

Can you please review my comment and modify MappingTraitTest https://github.com/juliangut/slim-routing/blob/master/tests/Routing/Mapping/Driver/MappingTraitTest.php#L169 as you did with AnnotationDriverTest ?

@TypicalFence
Copy link
Contributor Author

I made the changes you requested, did I miss anything?

@juliangut juliangut merged commit de57d5e into juliangut:master Nov 9, 2018
@juliangut
Copy link
Owner

Thanks for the PR, new release available

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

Successfully merging this pull request may close these issues.

None yet

3 participants