Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use rector to update to php7.4 #220

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- php74
pull_request:

jobs:
Expand Down Expand Up @@ -43,7 +44,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
php-versions: ['7.4', '8.0', '8.1', '8.2', '8.3']
steps:
- uses: actions/checkout@v3

Expand Down
17 changes: 17 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\TypeDeclaration\Rector\ClassMethod\AddVoidReturnTypeWhereNoReturnRector;

return RectorConfig::configure()
->withPaths([
__DIR__ . '/src',
__DIR__ . '/tests',
])

->withPhpSets(php74: true)
->withRules([
AddVoidReturnTypeWhereNoReturnRector::class,
]);
5 changes: 1 addition & 4 deletions src/Fonts/TrueTypeFontFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@ public function getFamily(): string

public function getWeight(): float
{
if (isset($this->weightClass)) {
return $this->weightClass;
}
return $this->subfamily === 'Bold' || $this->subfamily === 'Bold Italic' ? 700 : 400;
return $this->weightClass ?? ($this->subfamily === 'Bold' || $this->subfamily === 'Bold Italic' ? 700 : 400);
}

public function isItalic(): bool
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Embedded/SVGForeignObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
class SVGForeignObject extends SVGNodeContainer
{
const TAG_NAME = 'foreignObject';
public const TAG_NAME = 'foreignObject';

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Embedded/SVGImage.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
class SVGImage extends SVGNodeContainer
{
const TAG_NAME = 'image';
public const TAG_NAME = 'image';

/**
* @param string|null $href The image path, URL or URI.
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Filters/SVGFEBlend.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
class SVGFEBlend extends SVGNodeContainer
{
const TAG_NAME = 'feBlend';
public const TAG_NAME = 'feBlend';

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Filters/SVGFEColorMatrix.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
class SVGFEColorMatrix extends SVGNodeContainer
{
const TAG_NAME = 'feColorMatrix';
public const TAG_NAME = 'feColorMatrix';

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Filters/SVGFEComponentTransfer.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
class SVGFEComponentTransfer extends SVGNodeContainer
{
const TAG_NAME = 'feComponentTransfer';
public const TAG_NAME = 'feComponentTransfer';

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Filters/SVGFEComposite.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
class SVGFEComposite extends SVGNodeContainer
{
const TAG_NAME = 'feComposite';
public const TAG_NAME = 'feComposite';

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Filters/SVGFEConvolveMatrix.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
class SVGFEConvolveMatrix extends SVGNodeContainer
{
const TAG_NAME = 'feConvolveMatrix';
public const TAG_NAME = 'feConvolveMatrix';

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Filters/SVGFEDiffuseLighting.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
class SVGFEDiffuseLighting extends SVGNodeContainer
{
const TAG_NAME = 'feDiffuseLighting';
public const TAG_NAME = 'feDiffuseLighting';

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Filters/SVGFEDisplacementMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
class SVGFEDisplacementMap extends SVGNodeContainer
{
const TAG_NAME = 'feDisplacementMap';
public const TAG_NAME = 'feDisplacementMap';

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Filters/SVGFEDistantLight.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
class SVGFEDistantLight extends SVGNodeContainer
{
const TAG_NAME = 'feDistantLight';
public const TAG_NAME = 'feDistantLight';

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Filters/SVGFEDropShadow.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
class SVGFEDropShadow extends SVGNodeContainer
{
const TAG_NAME = 'feDropShadow';
public const TAG_NAME = 'feDropShadow';

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Filters/SVGFEFlood.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
class SVGFEFlood extends SVGNodeContainer
{
const TAG_NAME = 'feFlood';
public const TAG_NAME = 'feFlood';

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Filters/SVGFEFuncA.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
class SVGFEFuncA extends SVGNodeContainer
{
const TAG_NAME = 'feFuncA';
public const TAG_NAME = 'feFuncA';

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Filters/SVGFEFuncB.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
class SVGFEFuncB extends SVGNodeContainer
{
const TAG_NAME = 'feFuncB';
public const TAG_NAME = 'feFuncB';

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Filters/SVGFEFuncG.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
class SVGFEFuncG extends SVGNodeContainer
{
const TAG_NAME = 'feFuncG';
public const TAG_NAME = 'feFuncG';

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Filters/SVGFEFuncR.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
class SVGFEFuncR extends SVGNodeContainer
{
const TAG_NAME = 'feFuncR';
public const TAG_NAME = 'feFuncR';

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Filters/SVGFEGaussianBlur.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
class SVGFEGaussianBlur extends SVGNodeContainer
{
const TAG_NAME = 'feGaussianBlur';
public const TAG_NAME = 'feGaussianBlur';

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Filters/SVGFEImage.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
class SVGFEImage extends SVGNodeContainer
{
const TAG_NAME = 'feImage';
public const TAG_NAME = 'feImage';

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Filters/SVGFEMerge.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
class SVGFEMerge extends SVGNodeContainer
{
const TAG_NAME = 'feMerge';
public const TAG_NAME = 'feMerge';

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Filters/SVGFEMergeNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
class SVGFEMergeNode extends SVGNodeContainer
{
const TAG_NAME = 'feMergeNode';
public const TAG_NAME = 'feMergeNode';

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Filters/SVGFEMorphology.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
class SVGFEMorphology extends SVGNodeContainer
{
const TAG_NAME = 'feMorphology';
public const TAG_NAME = 'feMorphology';

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Filters/SVGFEOffset.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
class SVGFEOffset extends SVGNodeContainer
{
const TAG_NAME = 'feOffset';
public const TAG_NAME = 'feOffset';

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Filters/SVGFEPointLight.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
class SVGFEPointLight extends SVGNodeContainer
{
const TAG_NAME = 'fePointLight';
public const TAG_NAME = 'fePointLight';

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Filters/SVGFESpecularLighting.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
class SVGFESpecularLighting extends SVGNodeContainer
{
const TAG_NAME = 'feSpecularLighting';
public const TAG_NAME = 'feSpecularLighting';

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Filters/SVGFESpotLight.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
class SVGFESpotLight extends SVGNodeContainer
{
const TAG_NAME = 'feSpotLight';
public const TAG_NAME = 'feSpotLight';

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Filters/SVGFETile.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
class SVGFETile extends SVGNodeContainer
{
const TAG_NAME = 'feTile';
public const TAG_NAME = 'feTile';

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Filters/SVGFETurbulence.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
class SVGFETurbulence extends SVGNodeContainer
{
const TAG_NAME = 'feTurbulence';
public const TAG_NAME = 'feTurbulence';

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Filters/SVGFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
class SVGFilter extends SVGNodeContainer
{
const TAG_NAME = 'filter';
public const TAG_NAME = 'filter';

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Presentation/SVGAnimate.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
class SVGAnimate extends SVGNodeContainer
{
const TAG_NAME = 'animate';
public const TAG_NAME = 'animate';

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Presentation/SVGAnimateMotion.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
class SVGAnimateMotion extends SVGNodeContainer
{
const TAG_NAME = 'animateMotion';
public const TAG_NAME = 'animateMotion';

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Presentation/SVGAnimateTransform.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
class SVGAnimateTransform extends SVGNodeContainer
{
const TAG_NAME = 'animateTransform';
public const TAG_NAME = 'animateTransform';

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Presentation/SVGLinearGradient.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
class SVGLinearGradient extends SVGNodeContainer
{
const TAG_NAME = 'linearGradient';
public const TAG_NAME = 'linearGradient';

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Presentation/SVGMPath.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
class SVGMPath extends SVGNodeContainer
{
const TAG_NAME = 'mpath';
public const TAG_NAME = 'mpath';

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Presentation/SVGRadialGradient.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
class SVGRadialGradient extends SVGNodeContainer
{
const TAG_NAME = 'radialGradient';
public const TAG_NAME = 'radialGradient';

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Presentation/SVGSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
class SVGSet extends SVGNodeContainer
{
const TAG_NAME = 'set';
public const TAG_NAME = 'set';

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Presentation/SVGStop.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
class SVGStop extends SVGNodeContainer
{
const TAG_NAME = 'stop';
public const TAG_NAME = 'stop';

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Presentation/SVGView.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
class SVGView extends SVGNodeContainer
{
const TAG_NAME = 'view';
public const TAG_NAME = 'view';

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/SVGNodeContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function addChild(SVGNode $node, int $index = null): SVGNodeContainer
$node->parent->removeChild($node);
}

$index = ($index !== null) ? $index : count($this->children);
$index = $index ?? count($this->children);

// insert and set new parent
array_splice($this->children, $index, 0, [$node]);
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Shapes/SVGCircle.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/
class SVGCircle extends SVGNodeContainer
{
const TAG_NAME = 'circle';
public const TAG_NAME = 'circle';

/**
* @param mixed $cx The center's x coordinate.
Expand Down
Loading
Loading