Comments (6)
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.
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.
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.
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.
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.
@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)
- Do Not Include Closing PHP Tag In Example Code HOT 8
- Whitespace HOT 4
- avoid-those-slow-functions.md array_search duplicate HOT 1
- avoid-those-slow-functions.md: Add the uniqid function HOT 1
- Mess with code example in Avoid Redefining Properties HOT 2
- duplicate pages in the Performances group? HOT 1
- Error text in Imported collision HOT 2
- avoid-those-slow-functions has some bad replacements HOT 4
- Suggestion: Add scrutinizer CI to tools and add tools page to annexes HOT 2
- Two rules which are essentially the same ? HOT 2
- Rule copied, but not adjusted HOT 1
- Avoid direct include or require in spl_autoload_register HOT 2
- no-hardcoded-credential - suggest solutions HOT 2
- No Eval HOT 4
- no-double-quote
- Assigning to array with list has changed in PHP 7. HOT 1
- no-dangling-commas HOT 9
- One Tool HOT 1
- no-letter-logical exemple is wrong
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clearphp.