{"record":{"id":"0756e4a1f7d7758c","repo":"Intervention/image","slug":"height-of-this-class-must-be-greater-than-or-e","errorCode":null,"errorMessage":"Height of {$this::class} must be greater than or equal to 0","messagePattern":"Height of (.+?) must be greater than or equal to 0","errorType":"exception","errorClass":"Intervention\\Image\\Exceptions\\InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"src/Geometry/Rectangle.php","lineNumber":40,"sourceCode":"{\n    /**\n     * Create new rectangle.\n     *\n     * @throws InvalidArgumentException\n     */\n    public function __construct(\n        int $width,\n        int $height,\n        protected PointInterface $pivot = new Point(),\n    ) {\n        if ($width < 0) {\n            throw new InvalidArgumentException(\n                'Width of ' . $this::class . ' must be greater than or equal to 0',\n            );\n        }\n\n        if ($height < 0) {\n            throw new InvalidArgumentException(\n                'Height of ' . $this::class . ' must be greater than or equal to 0',\n            );\n        }\n\n        parent::__construct([\n            new Point(0, 0),\n            new Point($width, 0),\n            new Point($width, $height * -1),\n            new Point(0, $height * -1),\n        ], $pivot);\n    }\n\n    /**\n     * Create rectangle statically.\n     *\n     * @deprecated Use Intervention\\Image\\Size::class instead.\n     *\n     * @throws InvalidArgumentException","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/Intervention/image/blob/5598b9e39751c34afc5cdee84abef77f92c26f68/src/Geometry/Rectangle.php#L22-L58","documentation":"Error \"Height of {$this::class} must be greater than or equal to 0\" thrown in Intervention/image.","triggerScenarios":"Thrown at src/Geometry/Rectangle.php:40 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a height of 0 or more when constructing the Rectangle","Clamp negative computed heights with max(0, $height) before constructing the object","Validate user input that feeds the height so negative values are rejected early"],"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"}