:octocat: omit parentheses around "new" calls

This commit is contained in:
smiley
2026-03-17 19:05:34 +01:00
parent 3bfa0be1d5
commit 9a38501f5b
59 changed files with 95 additions and 95 deletions
+2 -2
View File
@@ -36,7 +36,7 @@ Render and save to file:
$data = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ';
$file = __DIR__.'/qrcode.eps';
(new QRCode($options))->render($data, $file);
new QRCode($options)->render($data, $file);
```
@@ -46,7 +46,7 @@ Push as file download in a browser:
header('Content-type: application/postscript');
header('Content-Disposition: filename="qrcode.eps"');
echo (new QRCode($options))->render($data);
echo new QRCode($options)->render($data);
exit;
```
+2 -2
View File
@@ -34,7 +34,7 @@ Render the output:
```php
$data = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ';
$out = (new QRCode($options))->render($data); // -> data:application/pdf;base64,...
$out = new QRCode($options)->render($data); // -> data:application/pdf;base64,...
echo $out;
```
@@ -46,7 +46,7 @@ Return the `FPDF` instance (will ignore other output options):
$options->returnResource = true;
/** @var \FPDF $fpdf */
$fpdf = (new QRCode($options))->render($data);
$fpdf = new QRCode($options)->render($data);
// do stuff with the FPDF instance...
+2 -2
View File
@@ -46,7 +46,7 @@ Render the output:
```php
$data = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ';
$out = (new QRCode($options))->render($data); // -> data:image/webp;base64,...
$out = new QRCode($options)->render($data); // -> data:image/webp;base64,...
printf('<img alt="%s" src="%s" />', $alt, $out);
```
@@ -58,7 +58,7 @@ Return the `GdImage` instance (will ignore other output options):
$options->returnResource = true;
/** @var \GdImage $gdImage */
$gdImage = (new QRCode($options))->render($data);
$gdImage = new QRCode($options)->render($data);
// do stuff with the GdImage instance...
$size = imagesx($gdImage);
+2 -2
View File
@@ -49,7 +49,7 @@ Render the output:
```php
$data = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ';
$out = (new QRCode($options))->render($data); // -> data:image/webp;base64,...
$out = new QRCode($options)->render($data); // -> data:image/webp;base64,...
printf('<img alt="%s" src="%s" />', $alt, $out);
```
@@ -61,7 +61,7 @@ Return the `Imagick` instance (will ignore other output options):
$options->returnResource = true;
/** @var \Imagick $imagick */
$imagick = (new QRCode($options))->render($data);
$imagick = new QRCode($options)->render($data);
// do stuff with the Imagick instance...
$imagick->scaleImage(150, 150, true);
+2 -2
View File
@@ -44,7 +44,7 @@ Render the output:
```php
$data = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ';
$out = (new QRCode($options))->render($data); // -> data:image/png;base64,...
$out = new QRCode($options)->render($data); // -> data:image/png;base64,...
printf('<img alt="%s" src="%s" />', $alt, $out);
```
@@ -56,7 +56,7 @@ Return the `ImageInterface` instance (will ignore other output options):
$options->returnResource = true;
/** @var \Intervention\Image\Interfaces\ImageInterface $image */
$image = (new QRCode($options))->render($data);
$image = new QRCode($options)->render($data);
// do stuff with the ImageInterface instance...
+1 -1
View File
@@ -34,7 +34,7 @@ Output in a HTML document (via PHP):
<?php
$data = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ';
$out = (new QRCode($options))->render($data);
$out = new QRCode($options)->render($data);
header('Content-type: text/html');
+1 -1
View File
@@ -53,7 +53,7 @@ Render the output:
```php
$data = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ';
$out = (new QRCode($options))->render($data); // -> data:image/svg+xml;base64,PD94bWwgdmVyc2...
$out = new QRCode($options)->render($data); // -> data:image/svg+xml;base64,PD94bWwgdmVyc2...
printf('<img alt="%s" src="%s" />', $alt, $out);
```
+1 -1
View File
@@ -78,7 +78,7 @@ Render the output:
```php
$data = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ';
$out = (new QRCode($options))->render($data); // -> XML, rendered as SVG
$out = new QRCode($options)->render($data); // -> XML, rendered as SVG
header('Content-type: application/xml');
+2 -2
View File
@@ -16,7 +16,7 @@ header('Content-type: application/json');
$data = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ';
echo (new QRCode($options))->render($data); // -> JSON string
echo new QRCode($options)->render($data); // -> JSON string
```
The associated [JSON schema](https://json-schema.org/specification) can be found over at GitHub: [`qrcode.schema.json`](https://github.com/chillerlan/php-qrcode/blob/main/src/Output/qrcode.schema.json)
@@ -28,7 +28,7 @@ The previous versions of `php-qrcode` (v5 and earlier) just dumped an array repr
which is equivalent to the following:
```php
$matrix = (new QRCode($options))->getQRMatrix(); // -> QRMatrix instance
$matrix = new QRCode($options)->getQRMatrix(); // -> QRMatrix instance
// retrieve the internal matrix as an array of booleans
$json = json_encode($matrix->getMatrix(true), $jsonFlags);
+1 -1
View File
@@ -34,7 +34,7 @@ Output:
```php
$data = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ';
$qrcode = (new QRCode($options))->render($data);
$qrcode = new QRCode($options)->render($data);
echo "\n\n$qrcode\n\n";
```