Update Error Docs#14854
Open
phpstan-bot wants to merge 1 commit into
Open
Conversation
- Documented the `new.nonObject` identifier (bleeding edge `InstantiationRule`), reported when instantiating a value that is neither a class-name string nor an object - Verified the example via the playground API (error only fires under bleeding edge) - The `phpunit.attributeRequiresPhpVersion` diff was a source-location refactor (logic moved to AttributeVersionRequirementHelper); existing doc remains accurate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR updates the PHPStan error identifier documentation in
website/errors/.Changes
New:
new.nonObjectAdded documentation for the previously undocumented
new.nonObjectidentifier, reported byPHPStan\Rules\Classes\InstantiationRulewhennew $expris used with a value that is neither a class-name string nor an object (e.g. anint,float,bool, orarray). At runtime PHP throws anErrorin this case.The doc includes:
new $valuewithint $value)class-string, or narrowing the type so it can only hold an objectThe example was verified against the playground API, confirming the error reports (only under bleeding edge, since the rule is gated behind the
newOnNonObjectfeature toggle).Reviewed:
phpunit.attributeRequiresPhpVersionThe commit's
errorsIdentifiers.jsondiff for this identifier was a pure source-location refactor — the rule logic moved fromAttributeRequiresPhpVersionRule.phpto the newAttributeVersionRequirementHelper.php. The error messages and trigger conditions are unchanged, so the existing documentation remains accurate and needs no update.