Skip to content

Commit

Permalink
I don't think this argument should be optional
Browse files Browse the repository at this point in the history
  • Loading branch information
mgdm committed Jun 2, 2019
1 parent bf34489 commit 19aec89
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/context.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ PHP_METHOD(CairoContext, __construct)
cairo_context_object *context_object;
cairo_surface_object *surface_object;

if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "|o", &surface_zval) == FAILURE) {
if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "o", &surface_zval) == FAILURE) {
return;
}

Expand Down
4 changes: 2 additions & 2 deletions tests/CairoContext/__construct.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if(!extension_loaded('cairo')) die('skip - Cairo extension not available');
?>
--FILE--
<?php
$surface = new Cairo\Surface\Image(CAIRO_FORMAT_ARGB32, 50, 50);
$surface = new Cairo\Surface\Image(Cairo\Surface\ImageFormat::ARGB32, 50, 50);
var_dump($surface);

$context = new Cairo\Context($surface);
Expand Down Expand Up @@ -43,4 +43,4 @@ object(Cairo\Context)#%d (0) {
}
Cairo\Context::__construct() expects exactly 1 parameter, 0 given
Cairo\Context::__construct() expects exactly 1 parameter, 2 given
Cairo\Context::__construct() expects parameter 1 to be Cairo\Surface, integer given
Argument 1 passed to Cairo\Context::__construct() must be an instance of Cairo\Surface, int given

1 comment on commit 19aec89

@geoglis
Copy link

@geoglis geoglis commented on 19aec89 Jun 3, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that this should be optional because u can create a context object and then set a surface via setSurface() method. Otherwise this method gets quite useless.

Please sign in to comment.