Skip to content

Fix 7.x builds #1228

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

Merged
merged 9 commits into from
Dec 29, 2017
Merged
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
2 changes: 1 addition & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ tools:
ruleset: phpmd.xml.dist
external_code_coverage:
enabled: true
timeout: 900
timeout: 1200
php_cpd: true
# php_sim: # Temporarily disabled to allow focus on things other than duplicates
# min_mass: 40
Expand Down
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ php:
- 5.6
- 7.0
- 7.1
- 7.2

matrix:
include:
- php: 5.6
env: COVERAGE=1
allow_failures:
- php: 7.0
- php: 7.1
- php: 7.2

cache:
directories:
Expand Down
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ Change Log
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

v0.14.0 (28 Dec 2017)
v0.14.0 (29 Dec 2017)
----------------------
This release fixes several bugs and adds some new features.
This is the last version to support PHP 5.3
This version brings compatibility with PHP 7.0 & 7.1

### Added
- Possibility to control the footnote numbering - @troosan #1068
Expand Down
9 changes: 4 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,22 @@
]
},
"require": {
"php": ">=5.3.3",
"php": "^5.3.3 || ^7.0",
"ext-xml": "*",
"zendframework/zend-escaper": "^2.2",
"zendframework/zend-stdlib": "^2.2 || ^3.0",
"phpoffice/common": "^0.2"
},
"require-dev": {
"phpunit/phpunit": "^4.8.36",
"phpunit/phpunit": "^4.8.36 || ^5.0",
"phpdocumentor/phpdocumentor":"2.*",
"twig/twig":"1.27",
"squizlabs/php_codesniffer": "^2.7",
"friendsofphp/php-cs-fixer": "^2.0",
"phpmd/phpmd": "2.*",
"phploc/phploc": "2.*",
"phploc/phploc": "2.* || 3.* || 4.*",
"dompdf/dompdf":"0.8.*",
"tecnickcom/tcpdf": "6.*",
"mpdf/mpdf": "5.*"
"mpdf/mpdf": "5.* || 6.* || 7.*"
},
"suggest": {
"ext-zip": "Allows writing OOXML and ODF",
Expand Down
17 changes: 12 additions & 5 deletions docs/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,35 @@
Issue tracker is **ONLY** used for reporting bugs. NO NEW FEATURE ACCEPTED! Use [stackoverflow](https://stackoverflow.com/questions/tagged/phpword) for supporting issues.
This is:

- [ ] a bug report
- [ ] a feature request
- [ ] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpword)

# Expected Behavior

Please describe the behavior you are expecting.

# Current Behavior
### Current Behavior

What is the current behavior?

# Failure Information
### Failure Information

Please help provide information about the failure.

## How to Reproduce
### How to Reproduce

Please provide a code sample that reproduces the issue.

```php
<?php
require __DIR__ . '/vendor/autoload.php';

$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection();
$section->...
```

## Context
### Context

* PHP version:
* PHPWord version: 0.14
7 changes: 3 additions & 4 deletions docs/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# Description
### Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.

Fixes # (issue)

# Checklist:
### Checklist:

- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have run phpunit, phpcs, php-cs-fixer, phpmd
- [ ] I have run `composer check` and no errors were reported
- [ ] The new code is covered by unit tests
- [ ] I have update the documentation to describe the changes
20 changes: 0 additions & 20 deletions run_tests.sh

This file was deleted.

12 changes: 6 additions & 6 deletions src/PhpWord/Element/AbstractElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public function setElementIndex($value)
/**
* Get element unique ID
*
* @return int
* @return string
*/
public function getElementId()
{
Expand Down Expand Up @@ -425,18 +425,18 @@ protected function setNewStyle($styleObject, $styleValue = null, $returnObject =
/**
* Set enum value
*
* @param mixed $value
* @param array $enum
* @param mixed $default
* @param string|null $value
* @param string[] $enum
* @param string|null $default
*
* @throws \InvalidArgumentException
* @return mixed
* @return string|null
*
* @todo Merge with the same method in AbstractStyle
*/
protected function setEnumVal($value = null, $enum = array(), $default = null)
{
if ($value != null && trim($value) != '' && !empty($enum) && !in_array($value, $enum)) {
if ($value !== null && trim($value) != '' && !empty($enum) && !in_array($value, $enum)) {
throw new \InvalidArgumentException("Invalid style value: {$value}");
} elseif ($value === null || trim($value) == '') {
$value = $default;
Expand Down
2 changes: 1 addition & 1 deletion src/PhpWord/Element/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public function getOptions()
* @throws \InvalidArgumentException
* @return null|string|TextRun
*/
public function setText($text)
public function setText($text = null)
{
if (isset($text)) {
if (is_string($text) || $text instanceof TextRun) {
Expand Down
2 changes: 0 additions & 2 deletions src/PhpWord/Element/TrackChange.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ public function __construct($author, \DateTime $date = null)
{
$this->author = $author;
$this->date = $date;

return $this;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/PhpWord/Metadata/Protection.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public function getSalt()
/**
* Set salt. Salt HAS to be 16 characters, or an exception will be thrown.
*
* @param $salt
* @param string $salt
* @throws \InvalidArgumentException
* @return self
*/
Expand Down
2 changes: 1 addition & 1 deletion src/PhpWord/Reader/Word2007/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ protected function setRevisionView(XMLReader $xmlReader, PhpWord $phpWord, \DOME
$revisionView = new TrackChangesView();
$revisionView->setMarkup(filter_var($xmlReader->getAttribute('w:markup', $node), FILTER_VALIDATE_BOOLEAN));
$revisionView->setComments($xmlReader->getAttribute('w:comments', $node));
$revisionView->setInsDel($xmlReader->getAttribute('w:insDel', $node));
$revisionView->setInsDel(filter_var($xmlReader->getAttribute('w:insDel', $node), FILTER_VALIDATE_BOOLEAN));
$revisionView->setFormatting(filter_var($xmlReader->getAttribute('w:formatting', $node), FILTER_VALIDATE_BOOLEAN));
$revisionView->setInkAnnotations(filter_var($xmlReader->getAttribute('w:inkAnnotations', $node), FILTER_VALIDATE_BOOLEAN));
$phpWord->getSettings()->setRevisionView($revisionView);
Expand Down
38 changes: 19 additions & 19 deletions src/PhpWord/Shared/Converter.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Converter
/**
* Convert centimeter to twip
*
* @param int $centimeter
* @param float $centimeter
* @return float
*/
public static function cmToTwip($centimeter = 1)
Expand All @@ -44,7 +44,7 @@ public static function cmToTwip($centimeter = 1)
/**
* Convert centimeter to inch
*
* @param int $centimeter
* @param float $centimeter
* @return float
*/
public static function cmToInch($centimeter = 1)
Expand All @@ -55,7 +55,7 @@ public static function cmToInch($centimeter = 1)
/**
* Convert centimeter to pixel
*
* @param int $centimeter
* @param float $centimeter
* @return float
*/
public static function cmToPixel($centimeter = 1)
Expand All @@ -66,7 +66,7 @@ public static function cmToPixel($centimeter = 1)
/**
* Convert centimeter to point
*
* @param int $centimeter
* @param float $centimeter
* @return float
*/
public static function cmToPoint($centimeter = 1)
Expand All @@ -77,8 +77,8 @@ public static function cmToPoint($centimeter = 1)
/**
* Convert centimeter to EMU
*
* @param int $centimeter
* @return int
* @param float $centimeter
* @return float
*/
public static function cmToEmu($centimeter = 1)
{
Expand All @@ -88,8 +88,8 @@ public static function cmToEmu($centimeter = 1)
/**
* Convert inch to twip
*
* @param int $inch
* @return int
* @param float $inch
* @return float
*/
public static function inchToTwip($inch = 1)
{
Expand All @@ -99,7 +99,7 @@ public static function inchToTwip($inch = 1)
/**
* Convert inch to centimeter
*
* @param int $inch
* @param float $inch
* @return float
*/
public static function inchToCm($inch = 1)
Expand All @@ -110,8 +110,8 @@ public static function inchToCm($inch = 1)
/**
* Convert inch to pixel
*
* @param int $inch
* @return int
* @param float $inch
* @return float
*/
public static function inchToPixel($inch = 1)
{
Expand All @@ -121,8 +121,8 @@ public static function inchToPixel($inch = 1)
/**
* Convert inch to point
*
* @param int $inch
* @return int
* @param float $inch
* @return float
*/
public static function inchToPoint($inch = 1)
{
Expand All @@ -132,8 +132,8 @@ public static function inchToPoint($inch = 1)
/**
* Convert inch to EMU
*
* @param int $inch
* @return int
* @param float $inch
* @return float
*/
public static function inchToEmu($inch = 1)
{
Expand All @@ -144,7 +144,7 @@ public static function inchToEmu($inch = 1)
* Convert pixel to twip
*
* @param int $pixel
* @return int
* @return float
*/
public static function pixelToTwip($pixel = 1)
{
Expand Down Expand Up @@ -188,7 +188,7 @@ public static function pixelToEmu($pixel = 1)
* Convert point to twip unit
*
* @param int $point
* @return int
* @return float
*/
public static function pointToTwip($point = 1)
{
Expand All @@ -210,7 +210,7 @@ public static function pointToPixel($point = 1)
* Convert point to EMU
*
* @param int $point
* @return int
* @return float
*/
public static function pointToEmu($point = 1)
{
Expand All @@ -221,7 +221,7 @@ public static function pointToEmu($point = 1)
* Convert EMU to pixel
*
* @param int $emu
* @return int
* @return float
*/
public static function emuToPixel($emu = 1)
{
Expand Down
1 change: 1 addition & 0 deletions src/PhpWord/Shared/Html.php
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,7 @@ private static function parseStyle($attribute, $styles)
private static function parseImage($node, $element)
{
$style = array();
$src = null;
foreach ($node->attributes as $attribute) {
switch ($attribute->name) {
case 'src':
Expand Down
2 changes: 1 addition & 1 deletion src/PhpWord/Shared/Microsoft/PasswordEncoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ private static function getAlgorithm($algorithmName)
/**
* Returns the algorithm ID
*
* @param sting $algorithmName
* @param string $algorithmName
* @return int
*/
public static function getAlgorithmId($algorithmName)
Expand Down
2 changes: 1 addition & 1 deletion src/PhpWord/Shared/ZipArchive.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public function close()
{
if (!$this->usePclzip) {
if ($this->zip->close() === false) {
throw new Exception("Could not close zip file {$this->filename}.");
throw new Exception("Could not close zip file {$this->filename}: ");
}
}

Expand Down
Loading