- 필수 기능
- 시작하기
- Glossary
- 표준 속성
- Guides
- Agent
- 통합
- 개방형텔레메트리
- 개발자
- Administrator's Guide
- API
- Datadog Mobile App
- CoScreen
- Cloudcraft
- 앱 내
- 서비스 관리
- 인프라스트럭처
- 애플리케이션 성능
- APM
- Continuous Profiler
- 스팬 시각화
- 데이터 스트림 모니터링
- 데이터 작업 모니터링
- 디지털 경험
- 소프트웨어 제공
- 보안
- AI Observability
- 로그 관리
- 관리
ID: php-code-style/short-class-name
Language: PHP
Severity: Notice
Category: Code Style
This rule suggests that class names in PHP should be descriptive and meaningful, rather than short and non-descriptive. This is important because meaningful class names make your code more readable and maintainable. They provide a clear idea of what the class is for, or what functionality it provides, without having to delve into the details of the class implementation.
Short class names like A
, B
, or C
, on the other hand, are not immediately clear in their purpose, making it difficult for others and yourself to understand what the class is supposed to do at a glance. This can lead to confusion and can make the code harder to work with.
To avoid violating this rule, always give your classes, interfaces, and enums descriptive names. These names should be concise, yet clearly describe what the class, interface, or enum does. For instance, instead of naming a class that handles user authentication as A
, name it UserAuthenticationHandler
. This makes it immediately clear what the class is responsible for, enhancing the readability and maintainability of your code.
<?php
class A {
}
enum B {
}
interface C {
}
<?php
class Foo {
}
enum Bar {
}
interface Baz {
}
|
|
For more information, please read the Code Analysis documentation
Identify code vulnerabilities directly in yourVS Code editor
Identify code vulnerabilities directly inJetBrains products