Skip to content

Commit

Permalink
update some vendor libraries to resolve PHP 7.0 issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Spreeuw committed Jun 12, 2017
1 parent 04a8feb commit 7ec39fa
Show file tree
Hide file tree
Showing 57 changed files with 2,922 additions and 586 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"require": {
"php": ">=5.3.0",
"dompdf/dompdf": "*"
"dompdf/dompdf": "*",
"phenx/php-svg-lib": "dev-master as 0.2"
}
}
45 changes: 30 additions & 15 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion vendor/phenx/php-svg-lib/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
}
},
"require": {
"sabberworm/php-css-parser": "6.0.*"
"sabberworm/php-css-parser": "8.1.*"
},
"require-dev": {
"phpunit/phpunit": "~5.0"
}
}
10 changes: 5 additions & 5 deletions vendor/phenx/php-svg-lib/src/Svg/Surface/SurfaceCpdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -376,12 +376,12 @@ public function setStyle(Style $style)
$this->style = $style;
$canvas = $this->canvas;

if ($stroke = $style->stroke) {
$canvas->setStrokeColor(array($stroke[0]/255, $stroke[1]/255, $stroke[2]/255), true);
if (is_array($style->stroke) && $stroke = $style->stroke) {
$canvas->setStrokeColor(array((float)$stroke[0]/255, (float)$stroke[1]/255, (float)$stroke[2]/255), true);
}

if ($fill = $style->fill) {
$canvas->setColor(array($fill[0]/255, $fill[1]/255, $fill[2]/255), true);
if (is_array($style->fill) && $fill = $style->fill) {
$canvas->setColor(array((float)$fill[0]/255, (float)$fill[1]/255, (float)$fill[2]/255), true);
}

if ($fillRule = strtolower($style->fillRule)) {
Expand Down Expand Up @@ -483,4 +483,4 @@ public function setFont($family, $style, $weight)

$this->canvas->selectFont("$family.afm");
}
}
}
4 changes: 2 additions & 2 deletions vendor/phenx/php-svg-lib/src/Svg/Surface/SurfaceGmagick.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,11 @@ public function setStyle(Style $style)
$this->style = $style;
$canvas = $this->canvas;

if ($stroke = $style->stroke) {
if (is_array($style->stroke) && $stroke = $style->stroke) {
$canvas->setcolor("stroke", "rgb", $stroke[0] / 255, $stroke[1] / 255, $stroke[2] / 255, null);
}

if ($fill = $style->fill) {
if (is_array($style->fill) && $fill = $style->fill) {
// $canvas->setcolor("fill", "rgb", $fill[0] / 255, $fill[1] / 255, $fill[2] / 255, null);
}

Expand Down
4 changes: 2 additions & 2 deletions vendor/phenx/php-svg-lib/src/Svg/Surface/SurfacePDFLib.php
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ public function setStyle(Style $style)
$this->style = $style;
$canvas = $this->canvas;

if (($stroke = $style->stroke) && $stroke !== "none") {
if ($stroke = $style->stroke && is_array($style->stroke)) {
$canvas->setcolor(
"stroke",
"rgb",
Expand All @@ -326,7 +326,7 @@ public function setStyle(Style $style)
);
}

if (($fill = $style->fill) && $fill !== "none") {
if ($fill = $style->fill && is_array($style->fill)) {
$canvas->setcolor(
"fill",
"rgb",
Expand Down
6 changes: 3 additions & 3 deletions vendor/phenx/php-svg-lib/src/Svg/Tag/Shape.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @package php-svg-lib
* @link http://github.com/PhenX/php-svg-lib
* @author Fabien Ménager <fabien.menager@gmail.com>
* @author Fabien Ménager <fabien.menager@gmail.com>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/

Expand Down Expand Up @@ -33,8 +33,8 @@ protected function after()
if ($this->hasShape) {
$style = $surface->getStyle();

$fill = $style->fill && $style->fill !== "none";
$stroke = $style->stroke && $style->stroke !== "none";
$fill = $style->fill && is_array($style->fill);
$stroke = $style->stroke && is_array($style->stroke);

if ($fill) {
if ($stroke) {
Expand Down
60 changes: 37 additions & 23 deletions vendor/phenx/php-svg-lib/tests/Svg/StyleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,39 +8,53 @@

namespace Svg\Tests;

include_once __DIR__."/../../src/autoload.php";
include_once __DIR__ . "/../../src/autoload.php";

use Svg\Style;

class StyleTest extends \PHPUnit_Framework_TestCase {
public function test_parseColor() {
$this->assertEquals("none", Style::parseColor("none"));
$this->assertEquals(array(255, 0, 0), Style::parseColor("RED"));
$this->assertEquals(array(0, 0, 255), Style::parseColor("blue"));
$this->assertEquals(null, Style::parseColor("foo"));
}
class StyleTest extends \PHPUnit_Framework_TestCase
{

public function test_parseColor()
{
$this->assertEquals("none", Style::parseColor("none"));
$this->assertEquals(array(255, 0, 0), Style::parseColor("RED"));
$this->assertEquals(array(0, 0, 255), Style::parseColor("blue"));
$this->assertEquals(null, Style::parseColor("foo"));
$this->assertEquals(array(0, 0, 0), Style::parseColor("black"));
$this->assertEquals(array(255, 255, 255), Style::parseColor("white"));
$this->assertEquals(array(0, 0, 0), Style::parseColor("#000000"));
$this->assertEquals(array(255, 255, 255), Style::parseColor("#ffffff"));
$this->assertEquals(array(0, 0, 0), Style::parseColor("rgb(0,0,0)"));
$this->assertEquals(array(255, 255, 255), Style::parseColor("rgb(255,255,255)"));
$this->assertEquals(array(0, 0, 0), Style::parseColor("rgb(0, 0, 0)"));
$this->assertEquals(array(255, 255, 255), Style::parseColor("rgb(255, 255, 255)"));
}

public function test_fromAttributes() {
$style = new Style();
public function test_fromAttributes()
{
$style = new Style();

$attributes = array(
"color" => "blue",
"fill" => "#fff",
"stroke" => "none",
);
$attributes = array(
"color" => "blue",
"fill" => "#fff",
"stroke" => "none",
);

$style->fromAttributes($attributes);
$style->fromAttributes($attributes);

$this->assertEquals(array(0, 0, 255), $style->color);
$this->assertEquals(array(255, 255, 255), $style->fill);
$this->assertEquals("none", $style->stroke);
}
$this->assertEquals(array(0, 0, 255), $style->color);
$this->assertEquals(array(255, 255, 255), $style->fill);
$this->assertEquals("none", $style->stroke);
}

public function test_convertSize(){
$this->assertEquals(1, Style::convertSize(1));
public function test_convertSize()
{
$this->assertEquals(1, Style::convertSize(1));
$this->assertEquals(10, Style::convertSize("10px")); // FIXME
$this->assertEquals(10, Style::convertSize("10pt"));
$this->assertEquals(8, Style::convertSize("80%", 10, 72));
$this->assertEquals(8, Style::convertSize("80%", 10, 72));
}

}

3 changes: 3 additions & 0 deletions vendor/sabberworm/php-css-parser/.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ php:
- "5.3"
- "5.5"
- "5.6"
- "7.0"
- "nightly"
- hhvm
script: phpunit .
sudo: false

55 changes: 53 additions & 2 deletions vendor/sabberworm/php-css-parser/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,54 @@
# Revision History

## 8.0

### 8.0.0 (2016-06-30)

* Store source CSS line numbers in tokens and parsing exceptions.
* *No deprecations*

#### Backwards-incompatible changes

* Unrecoverable parser errors throw an exception of type `Sabberworm\CSS\Parsing\SourceException` instead of `\Exception`.

### 8.1.0 (2016-07-19)

* Comments are no longer silently ignored but stored with the object with which they appear (no render support, though). Thanks to @FMCorz.
* The IE hacks using `\0` and `\9` can now be parsed (and rendered) in lenient mode. Thanks (again) to @FMCorz.
* Media queries with or without spaces before the query are parsed. Still no *real* parsing support, though. Sorry…
* PHPUnit is now listed as a dev-dependency in composer.json.
* *No backwards-incompatible changes*
* *No deprecations*

## 7.0

### 7.0.0 (2015-08-24)

* Compatibility with PHP 7. Well timed, eh?
* *No deprecations*

#### Backwards-incompatible changes

* The `Sabberworm\CSS\Value\String` class has been renamed to `Sabberworm\CSS\Value\CSSString`.

### 7.0.1 (2015-12-25)

* No more suppressed `E_NOTICE`
* *No backwards-incompatible changes*
* *No deprecations*

### 7.0.2 (2016-02-11)

* 150 time performance boost thanks to @[ossinkine](https://github.com/ossinkine)
* *No backwards-incompatible changes*
* *No deprecations*

### 7.0.3 (2016-04-27)

* Fixed parsing empty CSS when multibyte is off
* *No backwards-incompatible changes*
* *No deprecations*

## 6.0

### 6.0.0 (2014-07-03)
Expand All @@ -11,7 +60,7 @@

* The parse() method replaces __toString with an optional argument (instance of the OutputFormat class)

### 6.0.1 (2014-08-24)
### 6.0.1 (2015-08-24)

* Remove some declarations in interfaces incompatible with PHP 5.3 (< 5.3.9)
* *No deprecations*
Expand Down Expand Up @@ -92,7 +141,9 @@

### 5.1.2 (2013-10-30)

* Remove the use of consumeUntil in comment parsing. This makes it possible to parse comments such as “/** Perfectly valid **/”
* Remove the use of consumeUntil in comment parsing. This makes it possible to parse comments such as `/** Perfectly valid **/`
* Add fr relative size unit
* Fix some issues with HHVM
* *No backwards-incompatible changes*
* *No deprecations*

Expand Down
4 changes: 2 additions & 2 deletions vendor/sabberworm/php-css-parser/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "Sabberworm/PHP-CSS-Parser"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = "6.0.0"
PROJECT_NUMBER = "7.0.3"

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down Expand Up @@ -152,7 +152,7 @@ FULL_PATH_NAMES = YES
# will be relative from the directory where doxygen is started.
# This tag requires that the tag FULL_PATH_NAMES is set to YES.

STRIP_FROM_PATH =
STRIP_FROM_PATH = ./lib

# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
# path mentioned in the documentation of a class, which tells the reader which
Expand Down
Loading

0 comments on commit 7ec39fa

Please sign in to comment.