Git Product home page Git Product logo

Comments (6)

dseguy avatar dseguy commented on July 19, 2024

Thanks for the has/have fix.

As for interfaces, I added a section 'When not to use it', for interface methods.
(imho), I'd keep the 'public' mention, as it is not always obvious if a method is from an interface or not : as such, I prefer to keep it simple, constant and consistent. But I understand your point.

from clearphp.

Fleshgrinder avatar Fleshgrinder commented on July 19, 2024

I specifically talked about interfaces, classes that implement methods from an interface of course have to specify the visibility. Java is a good example on how this should be done.

interface I {
    function f();
}

class C implements I {
    public function f() {}
}

from clearphp.

jrfnl avatar jrfnl commented on July 19, 2024

Just my two pennies: for auto-documenting code and consistency, I would always recommend making the visibility of methods in an interface explicit.

from clearphp.

Fleshgrinder avatar Fleshgrinder commented on July 19, 2024

manual-documenting

Corrected that for you, it is already auto-documented through the language specification, and the mere fact that a fatal error is emitted if you write anything other than public. 😉

from clearphp.

jrfnl avatar jrfnl commented on July 19, 2024

t is already auto-documented through the language specification

For experienced devs: true. For less experienced devs: not so much. I've even met PHP devs with 5+ years experience who've never come across the docs before, so you're presuming knowledge which may well not be there.

from clearphp.

dseguy avatar dseguy commented on July 19, 2024

@Fleshgrinder : I think I read too fast your initial suggestion. Always visibility for classes's methods. And also for traits.

I'll keep the 'public' recommended for 'interfaces', in the 'when not to use it' section. Personally, I'll probably use your convention.

from clearphp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.