Skip to content

Error identifiers

Every error this extension reports carries an identifier prefixed laravel.. Identifiers are part of the supported surface: they are what you ignore against, so they are not renamed outside a major release. Message wording is not covered and may be reworded at any time, which is why ignoring by identifier is always preferable to ignoring by message.

parameters:
    ignoreErrors:
        - identifier: laravel.modelMake

An identifier names what was found, not the policy behind it, and never carries a no prefix. Where one concern reports more than one kind of error, the identifiers share a stem: laravel.modelMethodVisibility.scope and laravel.modelMethodVisibility.accessor.

Every identifier

Identifier Reported when Option
laravel.authInRequestScope.facade Auth::user() is used where a $request is already in scope rules.authInRequestScope
laravel.authInRequestScope.helper auth()->user() is used where a $request is already in scope rules.authInRequestScope
laravel.configAccessor A typed config accessor is called for a key of another type rules.configAccessor
laravel.console.undefinedArgument A command reads an argument its signature does not define always
laravel.console.undefinedOption A command reads an option its signature does not define always
laravel.deferrableServiceProvider.missingProvides A deferrable provider does not implement provides() always
laravel.envCallOutsideConfig env() is called outside the config directory rules.envCallOutsideConfig
laravel.events.noConstructor An event with no constructor is dispatched with arguments always
laravel.jobs.noConstructor A job with no constructor is dispatched with arguments always
laravel.missingTranslation A translation key has no translation rules.missingTranslation
laravel.modelAppends $appends names something that is not a computed property rules.modelAppends
laravel.modelForwardingToBuilder A builder method is called on a model instance rules.modelForwardingToBuilder
laravel.modelMake Model::make() is called instead of new Model() rules.modelMake
laravel.modelMethodVisibility.accessor An attribute accessor is public rules.modelMethodVisibility
laravel.modelMethodVisibility.scope A local query scope is public rules.modelMethodVisibility
laravel.modelStaticForwardingToBuilder A builder method is called statically on a model rules.modelStaticForwardingToBuilder
laravel.octaneCompatibility A binding captures the container in a way Octane cannot reuse rules.octaneCompatibility
laravel.relationExistence A builder method names a relation that does not exist always
laravel.unnecessaryCollectionCall A collection method could have been a query instead rules.unnecessaryCollectionCall.enabled
laravel.unnecessaryEnumerableToArrayCall toArray() is called where all() would do the same rules.unnecessaryEnumerableToArrayCall
laravel.unusedView A Blade view is never referenced rules.unusedView
laravel.uselessConstructs.value value() is called with no closure always
laravel.uselessConstructs.with with() returns its argument unchanged always

Errors without a laravel. identifier

Some of what this extension does produces errors under PHPStan's own identifiers, because the extension supplies better type information and PHPStan's ordinary checks then do the reporting. These cannot be ignored separately from the same check elsewhere in your code:

What Identifier
A column name that does not exist, via modelPropertyType argument.type
A Blade view that does not exist, via view-string argument.type
A property that is not a resolved column or accessor property.notFound
Too few or too many arguments to a dispatched job or event arguments.count
A dispatched argument of the wrong type argument.type

The last two are worth knowing about. Dispatch argument types delegates to PHPStan's own argument checking, so only its no-constructor case gets a laravel. identifier. The message still names the job and the constructor, so it is recognisable in output, but you cannot ignore mismatched dispatch arguments by identifier without also ignoring every other argument mismatch in your code.