programming-php — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited programming-php (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Write clear PHP with explicit types, validated inputs, and small, cohesive functions and objects. Apply modern features where they simplify the task; preserve existing project conventions except for the brace rule below.
PHP is dynamically typed with optional declarations and opt-in strict scalar checking. Types describe values; validation checks inputs; constructors and mutations enforce business invariants.
config.platform, CI, and deployment. Match syntax, extensions, dependencies, and analyzer settings to that minimum. A runtime condition cannot hide unsupported syntax in the same file.composer check-platform-reqs in the target environment. Preserve version constraints unless an upgrade is requested.function name(): void {. For multiline signatures, place the brace after the closing parenthesis and any return type. This overrides PER/PSR-12 brace placement.final, readonly properties, or hooks.declare(strict_types=1); in new PHP files; assess coercion changes before adding it to existing files. Scalar argument strictness follows the caller's file and does not validate external data.mixed; use PHPDoc only for additional contracts such as list<User>, array shapes, and generics. PHPDoc is not runtime validation.DateTimeImmutable for immutable dates.int is not necessarily positive. Use integer minor units or decimal arithmetic for exact money.tryFrom(); use from() when invalid values should throw.===, strict in_array(..., true), and explicit absence checks. empty() conflates zero/false with absence; isset() and ?? conflate null with missing keys. Use array_key_exists() when needed.match for strict selection and ?-> for expected absence. Don't hide unhandled enum cases with a fallback. Named arguments couple callers to parameter names.Use only when the minimum runtime and tooling support them.
| PHP | Useful features | Important limits | |
|---|---|---|---|
| 8.3 | Typed class constants; #[\Override] on methods | Preserve parent/interface contracts. | |
| 8.4 | Property hooks; public private(set) | Keep hooks local and free of I/O. Hooked properties cannot be readonly; restricted setters still permit internal mutation. | |
| 8.4 | array_find(), array_find_key(), array_any(), array_all(); native lazy objects | Use the key variant to distinguish a matched null from absence. Let compatible frameworks manage lazy objects. | |
| 8.5 | `\ | > pipelines; array_first(), array_last()` | Prefer ordinary calls when clearer. Endpoint helpers return null for empty arrays or stored null values. |
| 8.5 | clone($object, [...]); #[\NoDiscard] | Cloning is shallow and does not rerun constructor validation. Preserve invariants. NoDiscard warns about ignored results, not failed operations. | |
| 8.5 | Uri\Rfc3986\Uri, Uri\WhatWg\Url | Choose the required standard; parsing alone does not prevent SSRF or authorize destinations. |
During upgrades, read each crossed version's migration guide. Avoid ordinary dynamic properties (deprecated in 8.2); preserve intentional framework magic. Use explicit ?T $value = null (implicit nullability deprecated in 8.4). Use canonical casts such as (int) and (bool); noncanonical casts and backtick execution are deprecated in 8.5.
JSON_THROW_ON_ERROR, then validate shape and values. Don't cast malformed input into plausible data or deserialize untrusted PHP objects.finally for owned resources. Catch Throwable at execution boundaries where appropriate; don't turn programming bugs into success.Validate a positive integer without coercing strings, floats, or booleans:
<?php
declare(strict_types=1);
function positiveInt(mixed $value): int {
if (!is_int($value) || $value < 1) {
throw new InvalidArgumentException('Expected a positive integer.');
}
return $value;
}positiveInt(2) succeeds; '2', 2.5, true, 0, and null fail. Domain objects must also enforce their own invariants.
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.