Changelog
All notable changes to custos. Format: Keep a Changelog; versions follow Semantic Versioning.
Unreleased
0.2.5 - 2026-11-22
Added
UnavailableFunctionreports a call to a function PHP only provides from a later version than the project targets (str_contains()in a PHP 5.6 project) or removed before it (each()in a PHP 8 project), unless the project or a package declares it (a polyfill) or afunction_exists()or PHP version check guards the call. LikeUndefinedFunction, it needs every Composer dependency installed, and it stays silent when no target version is configured. Only extensions that ship with the latest PHP are checked, and sodium or zip functions are left alone when the project requires the extension, which PECL builds for older PHP.
Fixed
- Data-flow analysis follows calls to a trait method imported under an alias (
use T { boot as load; }): what the method returns or taints reaches its callers, as for other methods, and a subclass aliasing another method of the trait to that name replaces it. Inside a trait, a private or final method of a trait is no longer taken as the one that runs: the class using the trait may declare its own. Two traits aliasing different methods of a shared trait to one name now conflict, as in PHP. UndefinedClassandUndefinedFunctionno longer report PHPStan's classes, nor the libraries it bundles, in a PHPStan extension: a package whose autoloader loads classes from a phar now makes its namespace, and any name in a file written for it, count as possibly declared, through the command line, the language server and MCP alike. The class name prefixes such an autoloader tests count too, so Rector's classes inrector.phpare not reported either, whether the callback is a closure, or a function or method that the registration names exactly (a method through$this,self,parentor its class, by an array, a string or a first-class callable such as$this->load(...)), declared in any file, a method possibly taken from a trait (under an alias too) or a parent.$thisandstaticstand for the class and its subclasses (throughclass_alias()too), except that$thiskeeps a private method of the class, andselfandparentin a trait for the classes using it and their parents.UndefinedClassandUndefinedFunctionno longer report names of an optional extension used in an instance method when the class's constructor throws unlessextension_loaded()finds the extension, or when the extension's name starts the name (extension_loaded('opendkim')forOpenDKIMSign).- Quick-fixes and the formatter never make a file need a newer PHP version than the project targets (unless the file already needs that version):
custos fixleaves out such a fix and still applies the others, the language server no longer offers it, MCP refuses to prepare it, andcustos formatkeeps the file as written. custos formatno longer turns the invalidarray($a, $b) = $xinto a[$a, $b] = $xdestructuring (PHP 7.1).- A
composer.jsonPHP constraint without a minor version (5.*,>=5,^7 || ^8) now sets the target to that major's lowest version (5.3, 7.0) instead of falling back to 8.4. TypesCastingCanBeUsedno longer suggests(string)$xforstrval($x)[0]and similar below PHP 7.0, where the parenthesized cast cannot be dereferenced.VariableFunctionsUsageno longer rewritescall_user_func($cb, …)to$cb(…)below PHP 7.0 when$cbmay hold a'Class::method'string, which$cb()cannot call before 7.0.
0.2.4 - 2026-11-21
Added
custos formatlays out PHP code: indentation, spaces, line breaks, braces, blank lines and token spellings such as array syntax, keyword case and trailing commas. It keeps the line breaks you wrote and splits lists wider than the line length one item per line. Presets follow PER Coding Style (the default), PSR-1, PSR-12, Symfony, Laravel and Drupal; every setting can be changed in the newformatsection ofcustos.jsonor with--set,.editorconfigfiles apply, and with theautopreset the style of apint.json, PHP-CS-Fixer or Mago configuration is taken over. Risky settings (Yoda comparisons, single quotes, unused imports, strict types...) are opt-in.--checkand--dry-runlist the changes in any report format and exit 1,--diffprints them,--stdinformats standard input,--show-configshows each setting and its source; ignore comments (@custos-format-ignore,@formatter:off, Mago's) keep code as written, and files already formatted are remembered in the cache. See the new Formatting and Format settings pages.- The language server formats documents and ranges with the project's format configuration (
textDocument/formatting,textDocument/rangeFormatting). - MCP:
custos_formatchecks, previews or applies the formatter. Formattingrule (off by default): reports each changecustos formatwould make, with a quick-fix for the change and one for the whole file, so formatting shows inanalyse, the editor and the baseline.- The competitor benchmark compares formatters:
custos format, Laravel Pint, Mago's formatter and PHP-CS-Fixer's layout rules, in check mode.
0.2.3 - 2026-11-20
Changed
- Type checking is on by default at the
provenlevel: a project that sets notypeChecknow gets the rules that report mistakes the code proves (InvalidArgumentType,UndefinedMethod...). Set"typeCheck": "off"to keep the previous behavior.
0.2.2 - 2026-11-20
Added
- Custom rules:
customRulesincustos.json(andcustomRuleFiles) declare a project's own rules as PHP code patterns with metavariables, matched on resolved names, optionally constrained by inferred type, regular expression or excluded patterns, with an optional quick-fix template. They run inanalyse,fix, the language server and the MCP server, and appear incustos rules,custos explainand SARIF output. - Custom rule patterns can span several statements, use statement metavariables (
$S;for one statement,$_;for any run of them) and require or exclude enclosing code (inside,notInside). - A custom rule metavariable can stand for a function, class or method name (
$F(...),new $C(),$C::create(),$X->$M());wheretests the name as it resolves, and a name repeated in two spellings still matches. custos test-rulesruns rules over marked-up fixtures incustos-tests/(customRuleTests) and compares their findings and quick-fixes.- The language server applies edits to
custos.jsonand to custom rule files without a restart, when the editor watches files for it. - Go API for rules written in Go:
github.com/janalis/custos/pkg/custosbuilds a custos binary with extra rules (custos.Main,custos.NewRule,custos.Pattern), andpkg/custos/astexposes the syntax tree. It is unstable until 1.0.
Changed
- The Go module path is now
github.com/janalis/custos.
0.2.1 - 2026-11-19
Added
DocumentedMemberAccessOnNonObject,DocumentedForeachOverNonIterableandDocumentedOperandTypereport member access on a non-object, a loop over a non-iterable value and arithmetic on arrays or plain objects when PHPDoc shows the mistake but native declarations alone do not. They are off by default and part of thetypeCheck: documentedlevel.
Fixed
- PossiblyNullAccess no longer reports a fetch in parentheses that PHP reads quietly, such as
($order->customer) ?? nullorisset(($order->customer)->name).
0.2.0 - 2026-11-19
Added
@psalm-template-contravariantand@phpstan-template-contravariantdeclare templates like the other template tags, and each template keeps the variance its tag declares.- Doc types keep the value of integer literals (
0|1,0x1F,1_000) and understandint-mask<…>,int-mask-of<…>andenum-string<T>;new<T>andtemplate-type<…>no longer read as a class of that name. - Callable doc types keep which parameters are optional, by reference or variadic (
callable(int, string=, float ...$rest): void). - Object shapes (
object{a: int, b?: string}) keep their properties instead of reading as a plainobject. @phpstan-method,@psalm-methodand the prefixed@property,@property-readand@property-writetags declare magic members, and win over the unprefixed tag of the same name.- PhpStorm attributes document types:
#[ArrayShape],#[ObjectShape],#[NoReturn]and#[ExpectedValues], with literals, class constants,valuesFromClassandflagsFromClass. - A doc type naming class constants (
@param Mode::FAST|Mode::SLOW $m) rejects an exact value that none of them holds. - Builtin parameters whose type depends on the PHP version are checked against the type of the configured version.
- The
Documented*type rules compare generic arguments by the variance of each template, through@extendsand@implementstoo:Box<string>is reported whereBox<int>is documented. - The
Documented*type rules compare array and object shapes: a missing required key, a key the sealed shape does not list, or a value of another type is reported. - The
Documented*type rules compare the key types of non-empty arrays. - The
Documented*type rules compare callable signatures: return type, parameter types and the number of required parameters. - The
typeChecksetting ofcustos.json(off,proven,documented) enables the type-checking rules as a group; a rule's ownenabledwins. - New rules, off by default and part of
typeCheck: proven:MemberAccessOnNonObject,ForeachOverNonIterableandInvalidOperandType. ArgumentCountMismatchhas astrictUserArgsoption that also reports extra arguments to project functions that cannot read them.@mixintypes the members of the named class on the class that declares it, and@phpstan-self-outand@psalm-this-outchange the type of the local variable or property a method is called on.- A type checking guide lists the levels, the rules and the declaration formats custos reads.
Fixed
- A class constant in a positional shape entry (
array{self::A, int}) no longer reads as a key namedself.
0.1.16 - 2026-11-18
Added
analysekeeps each checked file's findings in the cache and reports them again, without checking the file, while nothing they depend on changed; the cache also keeps the checked files' declarations, trusted while a file's content is the same. On laravel/framework (Linux, 4 cores), a run with nothing changed took 1.5 s of CPU and 0.7 s against 6.5 s and 2.0 s with 0.1.15's cache (composer: 0.4 s against 2.7 s of CPU), and an edit inside a function body that keeps what it does for its callers has only that file checked again. Findings are the same;--no-cacheturns it off with the rest of the cache.--cpuprofilelabels the samples taken while a rule runs with the rule's ID, sogo tool pprof -tagsshows the time each rule takes.
Changed
- Sixteen rules that trust a local variable's resolved value (ArrayFillNegativeCount, ArrayRandInvalidCount, CollatorSortDiscardsRequiredKeys, CompressionDecoderFormatMismatch, CompressionLevelOutsideSupportedRange, ExplodeEmptySeparator, GdImageDimensionsNotPositive, GmpAutomaticBaseChangesDecimalInput, GmpDivisionByKnownZero, IntlCalendarSecondsPassedAsMilliseconds, ZipEntryIndexPastEnd and the five request-data rules UntrustedHeaderValue, UntrustedNetworkDestination, UntrustedShellCommand, UntrustedSqlConstruction and UnvalidatedRedirectTarget) now share one definition of the bindings that can change it behind its assignments, the union of what each checked before:
++/--on it or an element,catch,foreach,globalandstaticbindings, references (assignments,foreach, array items, captures, by-reference arguments), writes through variable variables,extract(), one-argumentparse_str(),include/require,evaland$GLOBALS, also through the locals assigned into it. A rule no longer trusts the value in such scopes where it did before; a two-argumentparse_str()into another variable, a namespaced function namedextract(), or (for ArrayRandInvalidCount) a write inside a nested function, no longer withdraws the proof. A local passed to a call custos cannot resolve is no longer trusted either, as the callee may take it by reference. - The rule reference and
custos explainstate each rule's PHP range as the rule applies it: ArrayColumnMissingField runs from PHP 5.5, UnpackedNamedArgumentCollision from PHP 8.1 and SimpleXmlLoadFileUsage up to PHP 7.4, and rules that run at every supported version no longer show "PHP ≥ 5.3". Rules without options no longer list an empty options section. Findings are the same. - Output, messages and docs use US spelling: the text report ends with "file(s) analyzed", and files skipped for size or nesting depth are reported as "not analyzed". The
analysecommand keeps its name. - The language server stops an index or cross-file flow build as soon as a later one replaces it (a configuration change, an edit to declarations), instead of finishing it and discarding the result.
Fixed
- A file named on the command line both relatively and absolutely (or once more through its directory written another way) is analyzed and fixed once, not twice.
- The MCP server follows data through dependency functions again when it does not run from the workspace root: it looked for the vendor files relative to its own working directory, found none, and missed findings such as request data reaching a shell command through a library call.
analyse,fixand the language server index the declarations of*.stub.phpand*.api.phpfiles found below a scanned path, as the documentation and the MCP server do: classes and functions declared only there are known to the other files again. These files are still not analyzed.- The MCP server no longer fails every analysis when
custos.jsonnames a baseline that was not generated yet: likeanalyseand the language server, it then suppresses nothing, and picks the file up once it exists. The language server no longer logs an error in that case.
0.1.15 - 2026-11-17
Changed
- The cross-file flow pass numbers the contracts it reads and records which ones each result read as bit sets, instead of sets of names. A cold
analyseorfixuses about 1–3% less CPU; findings are the same. --parse-oncealso keeps a file's inferred types from one cross-file flow summary of the file to the next, within a memory budget, instead of inferring them again. Compared with--parse-oncebefore,analyse --parse-oncefinishes about 3–9% sooner, for up to a fifth more memory at peak (composer's sources). Findings are the same, except possibly where type inference reaches its recursion limit.
0.1.14 - 2026-11-17
Added
analyseandfixtake--memprofile FILEto write a Go allocation profile of the run, next to--cpuprofile.
Changed
analyseandfixrun the garbage collector less often (GOGC=200) under a soft memory limit of three quarters of the physical memory, or of a lower cgroup memory limit on Linux (the process's group or any ancestor). When the memory is unknown, the collector keeps the runtime defaults. AGOGCin the environment,offincluded, leaves the collector alone; aGOMEMLIMITreplaces only the soft limit. See Memory.- The cross-file flow pass allocates less: flow values keep the references and facts they rarely hold apart and take less than half the space, call arguments and contract answers are no longer copied, each pair of contracts is compared once per round, and control-flow graphs start at their expected size. A cold
analyseof a large project allocates about 10% less and finishes about 6% sooner, with a lower memory peak. - Syntax tree walks and name lookups cost less: a walk checks each child once, lower-cased names and dependency summaries are cached in a map read without locks, and names are lower-cased only when they need it. A cold
analyseorfixof a large project finishes about 5% sooner. - Method lookups cost less: the methods a class declares itself, which most lookups of a run ask for, are now cached too instead of resolved again on each use. A cold
analyseuses about 2% less CPU.
Fixed
--parse-onceno longer reports some incomplete analyses at another place than a run without it: looking for adefine()call with a computed name inferred the receiver of every method call of the file, and the analysis of a file it had already searched met the inference limits elsewhere.- The type-check rules no longer see null after a write into one of its offsets, which PHP turns into an array, in more places: a destructuring target (
[$a['x']] = …), an increment ($a['k']++) and a write into a property's offset ($this->items['k'] = 1, also by destructuring or an increment, or through parentheses:($a)['k'] = 1) now drop it as a plain write into a local's offset already did. An object implementing ArrayAccess keeps its type. - ImpossibleTypeComparison and RedundantTypeCheck report a comparison of a local with null or false that they used to leave to DomMissingAttributeCheckedAsNull or XmlParseZeroComparedWithFalse when the local held a
getAttribute()orxml_parse()result only earlier or later in the function, which neither rule reported, and a null-safegetAttribute()call on a receiver that is never null. A copy of such a result ($copy = $id; $copy === null) is reported once, by the owning rule, instead of twice. - A baseline keys each line of a file with lone CR (classic Mac OS) line endings by its own text, as for LF and CRLF files. Lines after the first lone CR used to key as an empty line, so an entry covered any finding of the same rule and message below it. Regenerate the baseline (
--generate-baseline) of a project holding such files, or their recorded findings are reported again. - PossiblyNullAccess, PossiblyNullArgument and the other type-check rules no longer report a value after an early exit of more than eight
&&tests that may have ruled out null for it (if ($a === null && $b === null && …) { return; }): the exit is still not followed past eight tests, but such a value is now left unjudged where later checks test all the other values, and reported only where one of them is tested nowhere on the way. - The type-check rules follow a write into an offset of false (
$x = false; $x[] = 1;, a write into anarray|falseresult, or into anarray|falseproperty:$this->items[] = 1, also one only PHPDoc types, or declaredmixed, once a test such as$this->items === falseshows it held false), which PHP turns into an array: RedundantTypeCheck, ImpossibleTypeComparison, InvalidArgumentType, InvalidReturnType, InvalidPropertyAssignment and their documented counterparts judge the value as that array afterwards, not as false (DocumentedPropertyAssignment no longer reports$this->items = $listinto anarrayproperty). OffsetOperations and the rules reporting an unchecked false result are unchanged. - A
foreachloop writing its key or value into an offset (foreach ($rows as $seen['last'])) now counts as a write into that offset: the variable is an array after a loop over a non-empty array (an array literal, or a value known to be non-empty) and may be an array after any other. RedundantTypeCheck no longer calls$seen === nullalways true after such a loop, and PossiblyNullAccess no longer reports$seen['last']after a loop that runs. - NullPointerException no longer reports a write into an element of a nullable object (
$o['k'] = 1,$o[] = 1,$o['k']++,unset($o['k'])on a?ArrayObject $o): PHP turns null into an array there, so it is not a dereference. Element reads and method calls are still reported.
0.1.13 - 2026-11-13
Changed
Reduce parser and flow storage allocation, avoid redundant tree traversal and repeated flow expression counting, and release dependency source buffers after extracting their metadata.
Refresh competitor benchmark measurements and pinned tool and project versions after the 0.1.12 release.
0.1.12 - 2026-11-13
Added
- ImpossibleTypeComparison (error) and RedundantTypeCheck (warning), both off by default, report a
===/!==whose operands share no value, a==/!=whose operands PHP 8 never finds equal (objects of unrelated classes, an object against an array, null or false, an array against a number or a string), and aninstanceof,is_*()ornullcheck whose answer is always the same, when the code alone (not PHPDoc) decides it. Unknown or mixed values, constants, values written later in a loop, builtins whose return type changes in a later PHP version, classes of dependencies (in Composer'svendor-dir), tests andassert(), other loose comparisons, integer ranges and string lengths stay silent, and so does an always-true lastelseif. Checks other rules already report (CallableParameterUseCaseInTypeContext, NotOptimalIfConditions with its instanceof checks on, ArraySearchUsedAsInArray, XmlParseZeroComparedWithFalse, CollatorComparisonTruthinessReversed, DomMissingAttributeCheckedAsNull) are left to them where they run and report them. - PossiblyNullAccess and PossiblyNullArgument (warnings, off by default) report a value the code alone (not PHPDoc) shows may be null, accessed with
->,::or[], or passed to a parameter whose declared type rejects null. Null checks, early exits (also one taken when several values are all null, once later checks show all of them but one are), destructuring that replaces an earlier null,isset(),?->,??,assert(), PHPDoc assertions, a check of the same call made earlier and a check of a property before a call keep them silent, and so does null passed to a scalar parameter of PHP's own functions outside strict mode, or the inner iterator of PHP's iterator wrappers, which PHP declares nullable but never returns null (anIteratorIteratormay be anAppendIterator, though, and a class of the project may override the method). PossiblyNullAccess reports a value once: an access that only runs after a reported access on the same value is left out, unless a suppression comment or a baseline entry silences that one, a loop may change the value before the next iteration, or the function holds agoto; a generated baseline records every access. NullPointerException leaves to them what they report when they run in the same analysis (not where their check failed), and its suppression comments and baseline entries cover them too. - UndefinedMethod and UndefinedProperty (errors, off by default) report a method call, a property read or a static property access that the receiver's class does not declare, when the code alone (not PHPDoc) shows the class and its whole hierarchy is known. Magic methods,
@method,@propertyand@mixintags,stdClassand#[AllowDynamicProperties], members a subclass or an implementation declares, traits, closures that may be rebound, classes declared twice or conditionally, members PHP declares in another version, andmethod_exists(),is_callable()(also of a'Class::method'string) orproperty_exists()checks keep them silent. - UndefinedFunction and UndefinedClass (off by default) report calls and class names nothing declares. They report only when the project's world is complete: Composer's packages all installed and indexed, every required
ext-*described by the stubs, and nothing the analysis skips (excluded, hidden, symlinked or vendor test directories, files too large to analyze) able to declare the name. Existence, extension and version checks about the name, early exits included, keep them silent. The language server indexes the project again wheninstalled.jsonchanges or whencomposer.jsonchanges its autoload configuration, requirements, suggestions or vendor directory, keeping unsaved edits. - InvalidArgumentType (error) and DocumentedArgumentType (warning), both off by default, report an argument the parameter type can never accept. The first judges the argument by the code alone, where PHP would throw a
TypeError; the second takes PHPDoc into account: a@paramtype, or an argument typed only by PHPDoc. Both follow PHP's weak-mode conversions outsidedeclare(strict_types=1)and check PHP's own functions from PHP 8.0, except those whose stubs declare other parameter types than PHP. A value read from$thisin a closure or an arrow function, which may be bound to another object, is reported only when its type does not depend on that object (by InvalidArgumentType and InvalidReturnType). - InvalidPropertyAssignment (error) and DocumentedPropertyAssignment (warning), both off by default, report a value stored in a property whose type can never accept it, through plain and compound assignments,
??=, by-reference assignments of a local, list destructuring ([$this->a, $this->b] = $pair), foreach keys and values, and++(nullincremented to an integer). The first judges the value by the code alone, where PHP would throw aTypeError; the second also checks@vartypes, made nullable by anulldefault or, on an untyped property, by no default, and values typed only by PHPDoc. Both stay silent on hooked properties, classes with__set, writes the scope cannot perform and readonly writes that may be re-initializations. - InvalidReturnType (error) and DocumentedReturnType (warning), both off by default, report a returned value the function's own return type can never accept, closures and arrow functions included. The first judges the value by the code alone; the second takes PHPDoc into account: a
@returntype, or a value typed only by PHPDoc. Generators,voidandnever,selfandstaticin traits, templates and inherited declarations are left alone. ArgumentCountMismatch(off by default) reports a call that leaves a required parameter without an argument, and a call passing more arguments than a PHP function or method declares. Overrides in subtypes that accept the call, unpacked or unknown named arguments, magic methods and, before PHP 8.0, PHP's own functions are left alone.--parse-once(or"parseOnce": trueincustos.json) parses each analysed file once and keeps its syntax tree from indexing until its analysis, instead of parsing it again in each phase. This trades memory for avoiding repeated parsing; findings are the same.analyseandfixkeep the cross-file summaries of the checked files in the cache, next to the declarations of dependencies. A run after an edit summarizes again only what the edit reaches, as the language server does; the summaries are set aside when declarations, dependency files, the set of checked files or the working directory change. Findings are the same with or without them, and--no-cachebypasses them too.
Changed
- DocumentedReturnType, DocumentedArgumentType and DocumentedPropertyAssignment compare integer and string literals with integer ranges and non-empty strings:
return -1;under@return positive-int,f(0)against@param positive-intand$this->label = ''against@var non-empty-stringare reported, as isf('up')against@param 'asc'|'desc'(literal string values), and the message names the value (not 0.). Inference gives an integer literal its value and a string literal its byte length and value, which a variable keeps only when no write its assignments do not show may have replaced it: through a reference, aglobalorstaticlocal, or a call that may take it by reference, such as one whose function, method or class is named at run time ($fn($n),$obj->$m($n),new $cls($n)), or a write into a string offset ($s[0] = 'x'), which keeps the values of an integer the variable may hold instead and turns a null it may hold into an array, as PHP does. - The NestedPositiveIfStatements quick-fix writes
elseifinstead ofelse ifin a file that useselseifmore often thanelse if. analyseandfixare faster on projects with large classes in dependency cycles: the cross-file summaries no longer rebuild their collection each round, and a file summarized again keeps the summaries of the methods that no changed contract reaches.- The language server updates cross-file summaries much faster after an edit within a dependency cycle: files whose source did not change keep the summaries their contracts still support. Five alternating runs on the same pinned laravel checkout, with four Go processors and 20 edits per run, measured median time including flow updates of 3.063 s to 0.350 s for
Str.phpand 3.071 s to 0.533 s for EloquentModel.php. These measurements apply to those workloads. - The language server reports findings faster in a class with many descendants that inherits many trait methods: ReturnTypeCanBeDeclared no longer looks up, for each descendant, the trait methods it only inherits. In the same paired runs, median time to diagnostics for Eloquent
Model.phpfell from 170 ms to 69 ms;Str.phpstayed around 27 ms.
Fixed
Release notes join source-wrapped prose while preserving Markdown lists, code blocks and explicit line breaks.
Drop null from nullable values after a definite offset write.
Report redundant
is_null()checks of DOM attributes when the specialized comparison rule does not handle the predicate.Use the captured baseline while preparing MCP quick-fixes.
The editor offers to suppress a finding when the baseline hides another finding of the same rule in the file; it used to refuse the suppression comment because the hidden finding still counted after it.
LongInheritanceChain stops at a class of the project's vendor directory as Composer's
vendor-dirconfigures it, instead of at any class under a directory namedvendor: a project directory of that name now counts as the project's own, and a configuredvendor-diras a library.NullPointerException no longer reports the result of
getInnerIterator()of PHP's iterator wrappers (FilterIterator,LimitIteratorand the like), which PHP declares nullable but never returns null once the wrapper is constructed. It still reports it on anIteratorIterator, which may be anAppendIterator, or when a class of the project overrides the method.Type inference no longer reads a local as null after
if ($x !== null) { $x = trim($x); }(the new value was dropped), nor loses an assignment made earlier in the sameelseifbody as the read.Type inference keeps more null checks: a local passed to a by-value parameter of a method inside a branch, or reassigned on one branch after an early exit, a variable assigned in the left operand of
&&(read in its right operand or the body it guards), anif/elsewhose other branchescontinueorbreak, areturninsidetry, a value stored in ado/whilebody and tested by its condition, a test of$a['k'] ?? null, and a property set tox ?? [].The language server no longer replaces the declarations of an open document's unsaved edits with the file on disk: file changes replayed after a re-index skip open documents, and their buffers are indexed again once the rebuild ends.
A condition on a property (
if ($this->buffer === null)) no longer holds past a call that may run project code, which may write the property: rules using PHPDoc types no longer read a property refilled by$this->send()as still null (a DocumentedReturnType false positive).UntrustedForwardedClientAddress takes a proxy check that leaves on failure (
knownProxy($ip) or exit;) or whose stored result is tested ($trusted = knownProxy($ip); if (!$trusted) { return; }) as a guard.ForgottenDebugOutput no longer reports a debug function called after
function_exists()confirmed it through an early exit (if (!function_exists('f')) { return; }), anelsearm, a short-circuit operand or a stored result.DateLastErrorsFalseUnchecked no longer reports
getLastErrors()read after a failed parse when the failure is known from anelseorelseifarm, a short-circuit operand (DateTime::createFromFormat(…) ?: throw …), a stored result, or statements between them that parse nothing.JsonEncodingApiUsage takes a result tested as an operand of
&&,||,andoror($data || throw …;,if ($ready && $data)) as a handled failure.TransactionEarlyReturn accepts a
finallycleanup written as$pdo->inTransaction() && $pdo->rollBack();(or!… || …) or as theelsearm ofif (!$pdo->inTransaction()).UntrustedForwardedClientAddress reports a forwarded-address comparison written as the condition of an
elseifarm; it only looked atifconditions. The earlier conditions of the chain count as proxy guards.MkdirRaceCondition no longer reports a silenced
@mkdir()that only runs onceis_dir()returned false when the guard is an early exit (if (is_dir($d)) { return; }), anelseorelseifarm, or a short-circuit operand (is_dir($d) || @mkdir($d);).VariableFunctionsUsage no longer rewrites
call_user_func([$cb, 'm'])into$cb->m()when$cbis typedcallable: a callable may be a class name, which the direct call cannot take.UnlinkFailureReportedAsSuccess no longer reports the deletion of a
tempnam()file when the namespace declares its owntempnam()(a test double).FileReadFailureUnchecked no longer reports
unserialize()orjson_decode()of a read compared byassertSamewith an expected value typed as neither false nor null (array $expected, an object,[]), or byassertEqualswith a non-empty array or an object: the failure value fails the assertion.Arithmetic operators on a
\GMPor\BcMath\Numberoperand, and shift and bitwise operators on a\GMPoperand, are typed as that object instead of an int or a number, so type-based rules no longer treat the result as a scalar.Generic arguments given to a trait by an
@usetag on theusestatement inside the class (/** @use EnumeratesValues<TKey, TValue> */), as Laravel writes them, are now read; only the class's own doc was. The trait's methods then return, and pass to callbacks, the class's element type, which can add ReturnTypeCanBeDeclared suggestions.PhpUnitTests no longer rewrites to
assertRegExp(),assertNotRegExp(),assertFileNotExists()orassertDirectoryNotExists()when the PHPUnit version is only assumed, not configured or detected: those methods no longer exist from PHPUnit 10. The call is still reported, and the message names both the PHPUnit 9.1 method and the one it replaced.PhpUnitTests treats a
PHP_UNIT_VERSIONthat names no version as unset: the version is taken from the installed PHPUnit when it is indexed, and is otherwise unknown, not PHPUnit 8.
0.1.11 - 2026-11-09
Added
custos self-updateupdates custos the way it was installed: it runsbrew upgradefor Homebrew,composer update janalis/custosfor the Composer package, and replaces a downloaded release binary after checking it againstSHA256SUMS.--checkonly reports whether a release is out.analyseandfixprint a one-line notice when a newer release exists. They check at most once a day, while the command runs (waiting at most a second for it), and only when stderr is a terminal. The check is skipped in CI and whenCUSTOS_NO_UPDATE_CHECKis set.
Changed
- The README shows the time and peak memory of custos and the other tools on the largest benchmarked project, and a compact feature table; notes and sources stay on the benchmark page.
0.1.10 - 2026-11-08
Added
- A benchmark page compares the time, peak memory and findings of custos with PHPStan, Psalm, Phan, Mago, PHP_CodeSniffer, PHP-CS-Fixer and Rector on real projects. A weekly workflow moves every tool and project to its latest release and refreshes the numbers.
- The benchmark page and the README compare what custos and those tools offer: type checking, taint analysis, automatic fixes, formatting, language server, MCP server, baseline, custom rules and SARIF output, each cell linked to the tool's documentation.
Changed
- Faster analysis and fixes, with less memory and the same findings and edits. On laravel/framework (Linux, 4 cores),
custos analyseruns about 2.1 times as fast as in 0.1.9 andcustos fixabout 2.4 times as fast; both need about 20% less memory. Lookups through large class hierarchies are cached once per run, files no longer wait on each other for method lookups, flow analysis does less serial work and no longer keeps every syntax tree, machines with up to 8 cores use all of them for flow analysis, andcustos fixruns only the rules that offer a quick-fix.
0.1.9 - 2026-11-07
Added
- When your code calls a function or method of a dependency, custos summarizes the one file under
vendor/that declares it, on demand and once per run or editor session, so request data passed through library wrappers is followed to their sinks. Files over 512 KB and callables declared more than once are left out. Far fewer calls are reported asunresolved-dispatch(from 2,074 to 331 scopes on one Symfony application) for about 5% more time on a cold run.
Changed
- Flow analysis evaluates the small pure helpers that reshape data on its way to a sink, keeping track of which input each result came from: string transforms (case changes, trims, padding, splitting, joining, replacement, reversal), array builders and queries (
array_mapandarray_filterwith closures or named callbacks,array_column,array_combine,array_merge, slices,array_pad,range,array_unique, strictin_arrayandarray_search,min,max, sums and products),matchandswitchreturns, andforeachloops that build, filter or reduce arrays. Integer overflow, version-dependent errors and uncertain coercions stop the evaluation instead of guessing. - Callables are followed further: local and returned closures, arrow functions, first-class callables, invokable objects, callable names and callbacks given to project functions carry their return values and sinks back to the caller.
- Streams and other resources are tracked through wrapper functions, closures and returned arrays, so StreamUseAfterClose and the failure-check rules see the opens and closes made in helpers.
- Cross-file flow follows dependencies on a first run too: long call chains no longer take one round per file.
--flow-orderis now only a scheduling hint and no longer changes results. - Type inference keeps element types through array unions, spreads, computed keys and documented generics, and no longer drops known types when an impossible narrowing meets a loop or branch join. Loop variables narrowed back to the same type on each iteration are inferred, so fewer files report
inference-recursion. $this->method()in a trait resolves to the trait's own or used method. Long fluent call chains no longer exhaust the analysis depth limit and take linear time.- SuspiciousAssignments checks parameter overwrites against flow: a read through
goto, an arrow function or closure created before the overwrite,compact(),get_defined_vars()orfunc_get_arg()prevents the report, while introspection after the overwrite does not. - Builtin calls bind positional, named and unpacked arguments alike; CurlSslServerSpoofing reads the resolved option and value.
- NotOptimalRegularExpressions checks constant heredoc and nowdoc patterns. The PHPUnit rules read metadata attributes and
@depends cloneorshallowClone. PdoPlaceholderBindingMismatch keeps a known parameter set through conditional rebinding of the same parameters. - Flow analysis allocates much less per edit; the background flow update after an edit in the language server takes about 20% longer because of the dependency summaries, while diagnostics are published as quickly.
Fixed
- Calls through an interface, an abstract method or an overridable method no longer yield a complete value from the declared body: the result keeps what that body may return but no longer proves facts an override could contradict.
- DisconnectedForeachInstruction treats a nullsafe call (
?->) like->when deciding whether its receiver depends on the iteration. - DynamicCallsToScopeIntrospection and the other value checks consider both results of a short ternary (
$a ?: $b). UnqualifiedReference skips the global namespace block of a file that mixes namespaces. - CascadeStringReplacement's quick-fix no longer drops the merged elements when the target list is an empty array literal, and calls with an empty search or replacement list are merged when the fix provably keeps the result and the order of conversions.
0.1.8 - 2026-11-04
Added
- Without a
comparisonStyleincustos.json, the comparison style comes from the project's PHP-CS-Fixer configuration (itsyoda_stylerule, or the@Symfonyand@PhpCsFixerrule sets) or from Mago'syoda-conditionsrule. Projects formatted tonull === $xno longer get every comparison reported, and quick-fixes write the order they keep. custos analyseandcustos fixcache the declarations of the files they only index (vendor/and the rest ofpaths) between runs, in the user cache directory or$CUSTOS_CACHE_DIR;--no-cacheturns it off. Checking one file of a project with 20,000 vendor files went from about 6 s to 0.4 s of CPU time. The language server builds its startup index from the same cache.--flow-order(or"flow": {"order": true}incustos.json) keeps the order in which cross-file flow was summarized, so the next run summarizes each file after the ones it calls: about 12% faster on symfony/src, and long call chains are followed to the end instead of being reported as unresolved.
Changed
- Type inference knows more values: subclasses documented on declared types, elements created by nested writes, the matches of
preg_match_all()andpreg_replace_callback(),staticlocals, closure parameters from documented callback signatures, returns inherited through{@inheritDoc}, array casts,$thisin traits declaring@phpstan-require-extends, and types imported with@phpstan-import-type. - The command line, the language server and the MCP server discover files alike.
custos analyseandcustos fixindex every file underpathseven when the command line names only some, so cross-file results no longer depend on the files a run checks.excludeapplies undervendor/too, and entries such asvar/cachematch at any depth. php-src's*.stub.phpand Drupal's*.api.phpfiles are indexed but not analyzed, and a file named twice is analyzed and fixed once. - The language server publishes an edited file's diagnostics before it updates the cross-file flow summaries: under 100 ms instead of 15 s or more on symfony/console's Application.php. It summarizes again only the files an edit can change when that provably gives the same result (40% less CPU time there), and no longer rebuilds every summary when a file is opened.
- A crash on one file no longer ends a run or a server: the file gets an
internalfinding and theinternal-failurestatus. Quick-fixes apply whole or not at all, and a fixing pass that would add syntax errors is undone.custos fixreads each file once instead of three times. - A
-rulerun loads the project index like a full run, so it reports and fixes what a full run does. - Taint and value tracking reach further: chains of more than eight wrapper functions across files (past 32 files, calls are reported as
unresolved-dispatch), recursive functions passing their argument to a sink, and methods called on a nullable receiver or reaching__call(). - A
.php-versionfile at the project root sets the PHP version when neithercustos.jsonnorcomposer.jsondoes.
Fixed
- Fewer false positives and safer quick-fixes across 89 rules. The failure-check rules (FileReadFailureUnchecked, JsonEncodingApiUsage, StreamOpenFailureUnchecked, PregReplaceFailureUnchecked and others) take PHPUnit and
webmozart/assertassertions, typed PHP parameters and test exits such as$this->fail()as checks. UnnecessaryAssertion, OnlyWritesOnParameter, ReturnTypeCanBeDeclared, TypeUnsafeArraySearch, TypeUnsafeComparison, NullPointerException and the PHPUnit rules report far less on real projects. - Quick-fixes of NestedPositiveIfStatements, MissingOrEmptyGroupStatement, the
str_contains()family and others keep comments, indentation, needed parentheses and the code'selseifspelling. - Flow analysis keeps what it proved before a later
includeoreval, narrows through a test stored in a condition (if ($negated = str_starts_with($line, '!'))), and no longer lets a value flow back through a loop from a block that returns. $this,selfandstaticin the constructor arguments of an anonymous class refer to the class that creates it.- The MCP server applies
flow.assertionsand readsexcluderelative to each scanned path. TheexcludedPathsof HardcodedCredentialAtKnownSink fall back to the project or workspace root instead of the working directory. - The taint rules no longer carry request data through
mysqli_num_rows()and the other functions returning a number.
0.1.7 - 2026-10-21
Added
custos mcpserves project analysis, rule knowledge, semantic navigation, resumable checkpoints and prepared fixes to AI agents over stdio or authenticated Streamable HTTP, confined to workspace roots and identity permissions. It handles large vendor trees, filters and summarizes findings, and Composer's launcher points it at the consuming project.- The language server applies the project baseline, like
custos analyse, and reloads it when the file changes. - Rule pages show a native badge, and large sidebar groups are split by initial letter.
Changed
- Discovery skips hidden directories (
.phpunit.cache,.php-cs-fixer…) below each scanned path. --allno longer enables rules thatcustos.jsonturns off;--rulestill runs exactly the rules it names.- A rule entry in the language server's
initializationOptionsoverrides the project's entry field by field instead of replacing it. - The language server recomputes only the flow summaries an edit can affect and skips analyses superseded while waiting; whole-project runs no longer contend on symbol lookups.
- Type inference knows many more types: callback parameters of array functions, inherited
@paramtypes, constant and literal array shapes, more array builtins, appended rows, conditional return types (Symfony's$container->get(), Prophecy'sreveal()), generic constructors, traits, iterators,class-string<T>,self/parentand by-reference outputs. - Type narrowing understands more ways of writing a check (exits, loose comparisons, substring and length tests, saved results, guards on values of unknown type), and rules that look for a guard now read it from type narrowing, which removes false positives across the failure-check rules, NullPointerException and the stream, socket and process checks.
- In checks that need a proof, a guard stops counting where the value may change unseen (a project call, a reference write,
eval(), a jump label). - Rule pages and
custos explainread better: no unreferenced spec labels or boilerplate, and option descriptions say what they do.
Fixed
- Fewer false positives in NullPointerException, CallableParameterUseCaseInTypeContext, MagicMethodsValidity, DateLastErrorsFalseUnchecked, UnlinkFailureReportedAsSuccess, OffsetOperations, CsvEscapeDefaultDependency, HeapIterationConsumesCollection and XslTransformationFailureConsumed.
- Type narrowing no longer keeps facts that stopped being true (reassigned properties,
staticlocals, loop-carried values), no longer treats a namespacedis_*()function as PHP's, and respects the PHP version foror throw. - Checks that need a proof reject tests that prove nothing: a comparison the declared type rules out, a hooked or magic property, or a property written through another variable.
Security
- Require Go 1.27.2 to include current HTTP, TLS and root-confinement fixes.
0.1.6 - 2026-10-19
Added
- Analysis gaps, places where a rule stopped at a work bound instead of answering, are reported apart from findings in JSON, SARIF, the CLI summary and editor logs.
- The
flow.assertionssetting (off by default) letsassert()calls count as guards, assuming assertions run and a failed one stops execution.
Changed
- Re-analysis after an edit is faster: a file's functions are analyzed once for summaries and findings, and results that read no changed summary are kept. Repeated builtin and method lookups are cached.
- Documentation matches the binary more closely, and the rule index shows each rule's origin (native or EA-modeled).
Fixed
- UnescapedHtmlOutput understands far more HTML contexts (script and style text, URL, event-handler,
styleandsrcdocattributes, unquoted and data attributes) and more escaping functions, follows request superglobals rewritten or refilled before output, reports every unsafe part of an output statement and highlights the exact value. - Failure-check rules accept webmozart/assert and PHPUnit assertions and guards on properties, report assertions that would pass with the failure value, and count PHP's own methods and duplicated library functions as string consumers.
- The flow analysis follows
gotothroughfinally, generators acrossyield, constant conditions, integer ranges, loops, references, globals written in other functions and try blocks that cannot throw, so findings are both more complete and less noisy. - Unpacked and named arguments are no longer read as omitted or misplaced by argument checks.
- Type inference handles more PHPDoc forms, enum cases, typed constants, by-reference outputs of PHP functions, property hooks and version-specific builtin signatures; documentation availability tags no longer restrict PHP versions.
- Fewer false positives in ExitStatusReadWithoutNormalExitCheck, NonVoidFunctionFallsThrough, ReadLoopProcessesEofFailure and the cURL and socket zero-result checks.
- An unterminated backtick no longer crashes fix preparation, and signature fixes are withheld when a class hierarchy is only partly known.
0.1.5 - 2026-10-14
Added
IsIterableCanBeUsedoffers a quick-fix for an adjacentis_array($v) || $v instanceof Traversablepair on a plain variable.- Security rules cover more sinks: interpolated,
printand SVG/XHTML output, the backtick operator and string-formproc_open, remote stream reads,curl_setopt_arraydestinations, LDAP filters escaped for the wrong context, bit-or permission modes and cURL basic authentication set throughCURLOPT_URL. - The flow analysis follows functions containing
switch,match (true)andgoto, by-reference outputs, silenced calls,globalvariables written by other functions andstaticlocals, so value, failure-check and request-data rules report in more places.
Changed
- Project analysis is faster on large projects: summaries are computed in parallel, built once instead of per file, and a file is not analyzed again when nothing it calls changed. Very long functions and files with many
gotolabels no longer exhaust the analysis budget or take seconds.
Fixed
- Quick-fixes no longer produce invalid PHP or change behavior: they add needed parentheses, keep comments, respect keywords, closing tags, heredocs and PHP-version differences, and are withheld (the finding is still reported) when the rewrite could duplicate, drop or reorder side effects.
- Code-style, control-flow, performance, language-migration and PHPUnit rewrites are withheld where the result could differ; PHPUnit rewrites ignore same-named methods of other classes.
- Calls using named arguments, argument unpacking or first-class callable syntax are no longer misread by argument-position checks.
- Variables that can change through references,
global,extract(), variable variables, destructuring,foreachtargets or code PHP runs implicitly (conversions to text, magic methods, destructors, autoloading, callbacks) are no longer treated as stable. - Failure-check rules accept many more guard forms (early exits,
or exit, stored tests, never-returning calls,switchandmatchallow-lists, type predicates,isset/emptyon an element), and no longer let a check vouch for a later, unchecked assignment or for a value that agotocarries past it. - Request-data rules track array elements, references, by-reference parameters, statement bindings,
extract()andparse_str()more precisely, report request data combined with unknown values, and no longer report numbers, booleans orswitch/match-selected values.UnescapedHtmlOutputexamines every part of an output statement. - Architecture and unused-code rules respect property hooks, abstract and promoted properties, trait methods,
__sleep()lists and PHP-version differences of built-in classes. - Inspections that skip unreachable code no longer skip code a
gotolabel makes reachable, nor property hooks after a top-levelreturn. - HTTP, cookie, PDO, mysqli and SQLite rules compare names case-insensitively and tolerate SQL comments and state restored elsewhere.
- Malformed input no longer makes some rules skip the file.
0.1.4 - 2026-10-10
Fixed
- Boolean ternary simplification now requires opposite arms, and array membership rewrites preserve strictness and key evaluation.
- Array deduplication and list checks require compatible values and stable evaluation; indexed append checks avoid sparse-array false positives.
- Substring-to-array-access fixes require safe offsets, preserve source evaluation, and respect PHP-version differences.
- String checks and PHP 8 string-function rewrites preserve byte semantics by excluding multibyte operations and mixed string units.
- Ignored immutable date results now offer an assignment fix when receiver ownership and the modification can be proven safe.
- Replacement backreference fixes handle all supported references in one pass while preserving string quoting and escaping.
0.1.3 - 2026-10-10
Added
- Native PHP rules covering references, generators and fibers, arrays, JSON, cryptography, HTTP, cURL, databases, processes, streams, text, images and extension contracts. Each has an independent specification and own fixtures; intent-sensitive policies remain opt-in.
- Safe fixes for NaN comparisons, ZIP opening, OpenSSL verification, literal regex replacements, normalized query keys and sodium nonce lengths.
- Separate native rule metadata that survives upstream fact extraction; native rules use custos IDs and have no upstream conformance requirement.
- Bounded flow analysis with project function and method summaries, resource state tracking and context-specific validation; editor summaries include unsaved document changes.
Changed
- Documentation diagrams now render with Mermaid.
Fixed
- Native rules handle branch reachability, mutation, callbacks, namespace resolution and PHP-version constraints more accurately, reducing false positives and withholding fixes when their safety cannot be proven.
0.1.2 - 2026-10-10
Fixed
- More accurate PHP parsing and recovery from invalid syntax.
- Better type inference for generics, arrays, callbacks, generators and nullsafe expressions.
- More accurate declaration and property resolution, reducing false positives.
- GitHub releases now include the release notes from this changelog.
0.1.1 - 2026-10-08
Changed
- A suppression comment right before a call argument or an array item now applies to that argument or item, so one line of a multi-line call or array can be suppressed without silencing the whole statement.
Fixed
- Parser: in permissive mode, a property or promoted-parameter default followed by hooks is no longer read as a legacy
$a{0}offset. - JsonEncodingApiUsage fixes keep named arguments (appending
flags:orassociative:by name), extend a namedflags:value instead of giving up, parenthesise low-precedence flags ($p ? A : Bno longer becomes(JSON_THROW_ON_ERROR | $p) ? A : B), and write\JSON_THROW_ON_ERRORwhen the file qualifies its global constants. - MultiAssignmentUsage: consecutive offset reads from a string (
$a = $s[0]; $b = $s[1];) are no longer told to destructure, which would assignnullfrom a string. - NotOptimalIfConditions: filesystem calls (
is_file(),is_dir(),file_exists(), …) are no longer considered cheaper than in-memory checks; an operand is no longer moved ahead of a neighbour that narrows one of its variables (null/false comparison,instanceof,is_*()); property reads that run code (a PHP 8.4gethook, a virtual, abstract or interface property,__get()) cost like a method call and are never reordered; reads on an unknown receiver are left out of the comparison. - NotOptimalRegularExpressions: an escaped backslash before
.or$(\\\\.in a single-quoted pattern) no longer hides the metacharacter, so/sand/Dare not called pointless when they matter. - NullPointerException: a named argument is checked against the parameter of that name; a nullsafe check followed by an early exit, a
match (true)arm guarded by a nullsafe check, and a loop condition re-checked after acontinuenow narrow the variable; a property write no longer undoes a null check. - PhpUnitTests:
assertTrue(is_resource($h))/assertFalse(is_resource($h))are no longer rewritten toassertIsResource()/assertIsNotResource(), which treat a closed resource as a resource;empty()checks becomeassertEmpty()/assertNotEmpty()only when the operand is known to be a scalar, an array or null (PHPUnit countsCountableobjects), andassertTrue(!empty($x))names the assertion its fix writes. - PropertyInitializationFlaws: a property default equal to the default of the constructor parameter assigned to it is kept (objects built without the constructor, such as old serialized messages, still see it).
- ProperNullCoalescingOperatorUsage: a scalar fallback of another scalar type (
$id ?? 'new') and an array fallback for an iterable object ($node->attributes ?? [], a DoctrineCollection) are no longer reported. - SlowArrayOperationsInLoop: a
forcondition measuring a value the loop body visibly writes (element assignment,[] =,array_push(),unset(), reassignment) is no longer reported: its length changes on purpose. - StaticInvocationViaThis: with
EXCEPT_PHPUNIT_ASSERTIONS, an abstract restatement of a PHPUnit assertion (a trait'sabstract public static function assertIsResource(…)) called through$thisis exempt like PHPUnit's own assertions. - TraitsPropertiesConflicts: a trait property that re-declares a parent property only to attach attributes is no longer reported; a hooked property composed with a same-named trait property is an error, while the parent's hooks are ignored when a trait re-declares its property.
- UnnecessaryAssertion: a value reached through a nullsafe chain (
$r->find()?->sidebar()) is no longer said to be guaranteed by the last call's declared return type: the chain can yieldnull. - UnnecessaryCasting: a
(string)cast in a concatenation is reported only when its operand is known to be a string, int or float, not on nullable,bool,mixedor__toString()operands. - VariableFunctionsUsage:
call_user_func('name', …)is kept when a same-named namespace function or ause functionshadows the global function at the call (a wrapper reaching the builtin).
0.1.0 - 2026-10-08
First public release.
Added
- 178 EA-modeled PHP rules in 12 groups (probable bugs, performance, security, control flow, code style, unused code, PHPUnit, language-level migration 5.3 → 8.5, …), 108 of them with quick-fixes. Rules follow the target PHP version. Rule IDs are compatible with Php Inspections (EA Extended), so existing
@noinspectioncomments keep working;@custos-ignoreworks too. See the rule reference. - CLI:
analyse(text, json, checkstyle, github and sarif output;--fail-on; baselines for legacy code),fix(--dry-run,--diff, parallel),rules,explain,lsp,version. - Language server: diagnostics, quick-fixes, fix-all, "suppress for this statement" code action, and a background project index kept current through file watching. Setup guides for Neovim, Helix, VS Code, PhpStorm, Sublime Text and Emacs.
- Configuration through an optional
custos.json(paths, rules and their options, baseline); the PHP target falls back tocomposer.json. - Own PHP 5.3–8.5 parser (lossless, error tolerant) and semantic layer: a symbol index with embedded JetBrains phpstorm-stubs, type inference with narrowing, and PHPDoc support (generics and
@template, type aliases, array shapes, conditional return types,@param-out, phpstan/psalm assertions). - Distribution: release archives for Linux, macOS and Windows (amd64, arm64), a Homebrew cask (
brew install janalis/tap/custos) and a Composer package (composer require --dev janalis/custos) whose launcher downloads the checksum-verified binary. - Documentation site: https://janalis.github.io/custos/ (user guide, one page per rule with examples and quick-fix results, contributor guide).
- custos is a clean-room implementation and intentionally differs from upstream where upstream behavior is wrong (false positives, fixes that change semantics or produce invalid PHP).
Security
- Hostile input cannot crash, hang or exhaust the analyzer: nesting depth, file size (10 MB), syntax errors and findings per file are capped, PHPDoc types are parsed in linear time, and known quadratic paths were removed.
- Only regular files are read, with size caps;
pathsandbaselinemust stay inside the project;custos fixnever writes through symlinks; the language server rejects malformed or oversized messages.
