analyse-with-phpstan

Analyse PHP code with PHPStan

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "analyse-with-phpstan" with this command: npx skills add phpstan/phpstan/phpstan-phpstan-analyse-with-phpstan

Analyse PHP code with PHPStan

Analyse PHP code using the PHPStan playground API at https://api.phpstan.org/analyse . This runs PHPStan across PHP versions 7.2–8.5 and returns errors for each version.

The code to analyse: $ARGUMENTS

Step 1: Prepare the code

Get the PHP code to analyse. If $ARGUMENTS is a file path, read the file contents. The code must start with <?php .

Step 2: Determine settings

Unless the user specified otherwise, use these defaults:

  • level: "10" (strictest)

  • strictRules: false

  • bleedingEdge: false

  • treatPhpDocTypesAsCertain: true

If the user asked for strict rules or bleeding edge, set those to true .

Step 3: Call the playground API

Submit the code via POST:

curl -s -X POST 'https://api.phpstan.org/analyse'
-H 'Content-Type: application/json'
-d '{ "code": "<PHP code, JSON-escaped>", "level": "<level>", "strictRules": <true|false>, "bleedingEdge": <true|false>, "treatPhpDocTypesAsCertain": <true|false>, "saveResult": true }'

The code value must be properly JSON-escaped (escape quotes, backslashes, newlines).

Step 4: Parse the response

The response JSON contains:

  • versionedErrors — array of objects, one per PHP version, each with:

  • phpVersion — integer encoding: e.g. 80400 = PHP 8.4, 70400 = PHP 7.4

  • errors — array of error objects with message , line , identifier , tip (optional), ignorable

  • id — UUID for the saved result

Convert phpVersion integers to readable strings: Math.floor(v / 10000) . Math.floor((v % 10000) / 100) .

Step 5: Present results as markdown

Output the results in this format:

Playground link

https://phpstan.org/r/&#x3C;id>

Settings used

Level: <level> | Strict rules: yes/no | Bleeding edge: yes/no

Errors

Group consecutive PHP versions that have identical errors (same messages, lines, and identifiers) into ranges. For example, if PHP 7.2–8.3 all report the same errors, show them as one group.

If all PHP versions report identical errors, show a single group:

All PHP versions (no differences):

Line Error Identifier

10 Parameter #1 $foo expects string, int given.

argument.type

If errors differ across versions, show separate groups:

PHP 8.0 – 8.5:

Line Error Identifier

10 Parameter #1 $foo expects string, int given.

argument.type

PHP 7.2 – 7.4:

No errors.

If there are no errors on any PHP version, say: No errors found on any PHP version.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

Podfetcher Tools

Search podcasts, browse episodes, and fetch podcast transcripts from Podfetcher using the bundled Node.js CLI, SDK, or MCP server.

Registry SourceRecently Updated
Coding

Code Reviewer Cn

代码审查、重构建议、安全漏洞检查、命名规范、复杂度分析、注释文档生成. Use when you need code reviewer cn capabilities. Triggers on: code reviewer cn, 圈复杂度估算, 嵌套深度检测, 命名风格一致性, 注释率计算与评级, 重复行检测.

Registry SourceRecently Updated
Coding

Encode

Encode - command-line tool for everyday use

Registry SourceRecently Updated
Coding

Melies

AI image and video generation CLI. Generate images, videos, and movie posters using 50+ models including Flux, Kling, Veo, Wan, and more. Text-to-image, text...

Registry SourceRecently Updated
31Profile unavailable