{"record":{"id":"96a467c5843aee2c","repo":"Intervention/image","slug":"the-polygon-must-have-at-least-3-points","errorCode":null,"errorMessage":"The polygon must have at least 3 points","messagePattern":"The polygon must have at least 3 points","errorType":"exception","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"src/Modifiers/DrawPolygonModifier.php","lineNumber":19,"sourceCode":"<?php\n\ndeclare(strict_types=1);\n\nnamespace Intervention\\Image\\Modifiers;\n\nuse Intervention\\Image\\Exceptions\\InvalidArgumentException;\nuse Intervention\\Image\\Geometry\\Polygon;\nuse Intervention\\Image\\Interfaces\\DrawableInterface;\n\nclass DrawPolygonModifier extends AbstractDrawModifier\n{\n    /**\n     * @throws InvalidArgumentException\n     */\n    public function __construct(public Polygon $drawable)\n    {\n        if ($drawable->count() < 3) {\n            throw new InvalidArgumentException('The polygon must have at least 3 points');\n        }\n    }\n\n    /**\n     * Return object to be drawn.\n     */\n    protected function drawable(): DrawableInterface\n    {\n        return $this->drawable;\n    }\n}\n","sourceCodeStart":1,"sourceCodeEnd":31,"githubUrl":"https://github.com/Intervention/image/blob/5598b9e39751c34afc5cdee84abef77f92c26f68/src/Modifiers/DrawPolygonModifier.php#L1-L31","documentation":"Error \"The polygon must have at least 3 points\" thrown in Intervention/image.","triggerScenarios":"Thrown at src/Modifiers/DrawPolygonModifier.php:19 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide at least 3 points when defining the polygon","Build points with Intervention\\Image\\Geometry\\Point instances, e.g. new Point(10, 20)","Check dynamically built point arrays for dropped or null entries"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5598b9e39751c34afc5cdee84abef77f92c26f68","analyzedAt":"2026-08-23T02:17:31.068Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}