Skip to content
AgileLogics
2 min read

Comments & Code Style

Prerequisites: Constructor property promotion

// A single-line comment
# Also a single-line comment (less common)

/*
 * A multi-line comment
 */

/**
 * A PHPDoc comment — documents a function or class, read by IDEs
 * for autocomplete and by tools like PHPStan for type checking.
 *
 * @param string $name The person to greet
 */
function greet(string $name): string { }

Convention (per the community PSR-12 standard): camelCase for methods and variables, PascalCase for class names, 4 spaces for indentation (never tabs).