Skip to content

Commit 06c8248

Browse files
authored
Merge pull request #1996 from liborm85/drop-common-package
Remove legacy PHPOffice/Common package, fix PHP 8.0 compatibility
2 parents cf808cb + 40966dd commit 06c8248

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+1773
-163
lines changed

.travis.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,13 @@ matrix:
2424
dist: trusty
2525
- php: 7.0
2626
env: COVERAGE=1
27-
- php: 8.0
28-
env: DEPENDENCIES="--ignore-platform-reqs"
2927
exclude:
3028
- php: 5.3
3129
dist: xenial
3230
- php: 5.4
3331
dist: xenial
3432
- php: 5.5
3533
dist: xenial
36-
allow_failures:
37-
- php: 8.0
3834

3935
cache:
4036
directories:

composer.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@
6060
"require": {
6161
"php": "^5.3.3 || ^7.0 || ^8.0",
6262
"ext-xml": "*",
63-
"laminas/laminas-escaper": "^2.2",
64-
"phpoffice/common": "^0.2.9"
63+
"laminas/laminas-escaper": "^2.2"
6564
},
6665
"require-dev": {
6766
"ext-zip": "*",
@@ -71,7 +70,7 @@
7170
"friendsofphp/php-cs-fixer": "^2.2",
7271
"phpmd/phpmd": "2.*",
7372
"phploc/phploc": "2.* || 3.* || 4.* || 5.* || 6.* || 7.*",
74-
"dompdf/dompdf":"0.8.*",
73+
"dompdf/dompdf":"0.8.* || 1.0.*",
7574
"tecnickcom/tcpdf": "6.*",
7675
"mpdf/mpdf": "5.7.4 || 6.* || 7.* || 8.*",
7776
"php-coveralls/php-coveralls": "1.1.0 || ^2.0"

src/PhpWord/Element/Bookmark.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
namespace PhpOffice\PhpWord\Element;
1919

20-
use PhpOffice\Common\Text as CommonText;
20+
use PhpOffice\PhpWord\Shared\Text as SharedText;
2121

2222
/**
2323
* Bookmark element
@@ -45,7 +45,7 @@ class Bookmark extends AbstractElement
4545
*/
4646
public function __construct($name = '')
4747
{
48-
$this->name = CommonText::toUTF8($name);
48+
$this->name = SharedText::toUTF8($name);
4949
}
5050

5151
/**

src/PhpWord/Element/CheckBox.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
namespace PhpOffice\PhpWord\Element;
1919

20-
use PhpOffice\Common\Text as CommonText;
20+
use PhpOffice\PhpWord\Shared\Text as SharedText;
2121

2222
/**
2323
* Check box element
@@ -55,7 +55,7 @@ public function __construct($name = null, $text = null, $fontStyle = null, $para
5555
*/
5656
public function setName($name)
5757
{
58-
$this->name = CommonText::toUTF8($name);
58+
$this->name = SharedText::toUTF8($name);
5959

6060
return $this;
6161
}

src/PhpWord/Element/Link.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
namespace PhpOffice\PhpWord\Element;
1919

20-
use PhpOffice\Common\Text as CommonText;
20+
use PhpOffice\PhpWord\Shared\Text as SharedText;
2121
use PhpOffice\PhpWord\Style\Font;
2222
use PhpOffice\PhpWord\Style\Paragraph;
2323

@@ -79,8 +79,8 @@ class Link extends AbstractElement
7979
*/
8080
public function __construct($source, $text = null, $fontStyle = null, $paragraphStyle = null, $internal = false)
8181
{
82-
$this->source = CommonText::toUTF8($source);
83-
$this->text = is_null($text) ? $this->source : CommonText::toUTF8($text);
82+
$this->source = SharedText::toUTF8($source);
83+
$this->text = is_null($text) ? $this->source : SharedText::toUTF8($text);
8484
$this->fontStyle = $this->setNewStyle(new Font('text'), $fontStyle);
8585
$this->paragraphStyle = $this->setNewStyle(new Paragraph(), $paragraphStyle);
8686
$this->internal = $internal;

src/PhpWord/Element/ListItem.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
namespace PhpOffice\PhpWord\Element;
1919

20-
use PhpOffice\Common\Text as CommonText;
20+
use PhpOffice\PhpWord\Shared\Text as SharedText;
2121
use PhpOffice\PhpWord\Style\ListItem as ListItemStyle;
2222

2323
/**
@@ -57,7 +57,7 @@ class ListItem extends AbstractElement
5757
*/
5858
public function __construct($text, $depth = 0, $fontStyle = null, $listStyle = null, $paragraphStyle = null)
5959
{
60-
$this->textObject = new Text(CommonText::toUTF8($text), $fontStyle, $paragraphStyle);
60+
$this->textObject = new Text(SharedText::toUTF8($text), $fontStyle, $paragraphStyle);
6161
$this->depth = $depth;
6262

6363
// Version >= 0.10.0 will pass numbering style name. Older version will use old method

src/PhpWord/Element/PreserveText.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
namespace PhpOffice\PhpWord\Element;
1919

20-
use PhpOffice\Common\Text as CommonText;
20+
use PhpOffice\PhpWord\Shared\Text as SharedText;
2121
use PhpOffice\PhpWord\Style\Font;
2222
use PhpOffice\PhpWord\Style\Paragraph;
2323

@@ -59,7 +59,7 @@ public function __construct($text = null, $fontStyle = null, $paragraphStyle = n
5959
$this->fontStyle = $this->setNewStyle(new Font('text'), $fontStyle);
6060
$this->paragraphStyle = $this->setNewStyle(new Paragraph(), $paragraphStyle);
6161

62-
$this->text = CommonText::toUTF8($text);
62+
$this->text = SharedText::toUTF8($text);
6363
$matches = preg_split('/({.*?})/', $this->text, null, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
6464
if (isset($matches[0])) {
6565
$this->text = $matches;

src/PhpWord/Element/Text.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
namespace PhpOffice\PhpWord\Element;
1919

20-
use PhpOffice\Common\Text as CommonText;
20+
use PhpOffice\PhpWord\Shared\Text as SharedText;
2121
use PhpOffice\PhpWord\Style\Font;
2222
use PhpOffice\PhpWord\Style\Paragraph;
2323

@@ -136,7 +136,7 @@ public function getParagraphStyle()
136136
*/
137137
public function setText($text)
138138
{
139-
$this->text = CommonText::toUTF8($text);
139+
$this->text = SharedText::toUTF8($text);
140140

141141
return $this;
142142
}

src/PhpWord/Element/Title.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
namespace PhpOffice\PhpWord\Element;
1919

20-
use PhpOffice\Common\Text as CommonText;
20+
use PhpOffice\PhpWord\Shared\Text as SharedText;
2121
use PhpOffice\PhpWord\Style;
2222

2323
/**
@@ -62,7 +62,7 @@ class Title extends AbstractElement
6262
public function __construct($text, $depth = 1)
6363
{
6464
if (is_string($text)) {
65-
$this->text = CommonText::toUTF8($text);
65+
$this->text = SharedText::toUTF8($text);
6666
} elseif ($text instanceof TextRun) {
6767
$this->text = $text;
6868
} else {

src/PhpWord/Metadata/Protection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
namespace PhpOffice\PhpWord\Metadata;
1919

20-
use PhpOffice\Common\Microsoft\PasswordEncoder;
20+
use PhpOffice\PhpWord\Shared\Microsoft\PasswordEncoder;
2121
use PhpOffice\PhpWord\SimpleType\DocProtect;
2222

2323
/**

src/PhpWord/Reader/MsDoc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
namespace PhpOffice\PhpWord\Reader;
1919

20-
use PhpOffice\Common\Drawing;
2120
use PhpOffice\PhpWord\PhpWord;
21+
use PhpOffice\PhpWord\Shared\Drawing;
2222
use PhpOffice\PhpWord\Shared\OLERead;
2323
use PhpOffice\PhpWord\Style;
2424

src/PhpWord/Reader/ODText.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
namespace PhpOffice\PhpWord\Reader;
1919

20-
use PhpOffice\Common\XMLReader;
2120
use PhpOffice\PhpWord\PhpWord;
21+
use PhpOffice\PhpWord\Shared\XMLReader;
2222

2323
/**
2424
* Reader for ODText

src/PhpWord/Reader/ODText/Content.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717

1818
namespace PhpOffice\PhpWord\Reader\ODText;
1919

20-
use PhpOffice\Common\XMLReader;
2120
use PhpOffice\PhpWord\Element\TrackChange;
2221
use PhpOffice\PhpWord\PhpWord;
22+
use PhpOffice\PhpWord\Shared\XMLReader;
2323

2424
/**
2525
* Content reader

src/PhpWord/Reader/ODText/Meta.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
namespace PhpOffice\PhpWord\Reader\ODText;
1919

20-
use PhpOffice\Common\XMLReader;
2120
use PhpOffice\PhpWord\PhpWord;
21+
use PhpOffice\PhpWord\Shared\XMLReader;
2222

2323
/**
2424
* Meta reader

src/PhpWord/Reader/Word2007.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
namespace PhpOffice\PhpWord\Reader;
1919

20-
use PhpOffice\Common\XMLReader;
2120
use PhpOffice\PhpWord\PhpWord;
21+
use PhpOffice\PhpWord\Shared\XMLReader;
2222
use PhpOffice\PhpWord\Shared\ZipArchive;
2323

2424
/**

src/PhpWord/Reader/Word2007/AbstractPart.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717

1818
namespace PhpOffice\PhpWord\Reader\Word2007;
1919

20-
use PhpOffice\Common\XMLReader;
2120
use PhpOffice\PhpWord\ComplexType\TblWidth as TblWidthComplexType;
2221
use PhpOffice\PhpWord\Element\AbstractContainer;
2322
use PhpOffice\PhpWord\Element\TextRun;
2423
use PhpOffice\PhpWord\Element\TrackChange;
2524
use PhpOffice\PhpWord\PhpWord;
25+
use PhpOffice\PhpWord\Shared\XMLReader;
2626

2727
/**
2828
* Abstract part reader
@@ -95,7 +95,7 @@ public function setRels($value)
9595
/**
9696
* Read w:p.
9797
*
98-
* @param \PhpOffice\Common\XMLReader $xmlReader
98+
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
9999
* @param \DOMElement $domNode
100100
* @param \PhpOffice\PhpWord\Element\AbstractContainer $parent
101101
* @param string $docPart
@@ -202,7 +202,7 @@ private function getHeadingDepth(array $paragraphStyle = null)
202202
/**
203203
* Read w:r.
204204
*
205-
* @param \PhpOffice\Common\XMLReader $xmlReader
205+
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
206206
* @param \DOMElement $domNode
207207
* @param \PhpOffice\PhpWord\Element\AbstractContainer $parent
208208
* @param string $docPart
@@ -320,7 +320,7 @@ protected function readRunChild(XMLReader $xmlReader, \DOMElement $node, Abstrac
320320
/**
321321
* Read w:tbl.
322322
*
323-
* @param \PhpOffice\Common\XMLReader $xmlReader
323+
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
324324
* @param \DOMElement $domNode
325325
* @param mixed $parent
326326
* @param string $docPart
@@ -378,7 +378,7 @@ protected function readTable(XMLReader $xmlReader, \DOMElement $domNode, $parent
378378
/**
379379
* Read w:pPr.
380380
*
381-
* @param \PhpOffice\Common\XMLReader $xmlReader
381+
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
382382
* @param \DOMElement $domNode
383383
* @return array|null
384384
*/
@@ -413,7 +413,7 @@ protected function readParagraphStyle(XMLReader $xmlReader, \DOMElement $domNode
413413
/**
414414
* Read w:rPr
415415
*
416-
* @param \PhpOffice\Common\XMLReader $xmlReader
416+
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
417417
* @param \DOMElement $domNode
418418
* @return array|null
419419
*/
@@ -459,7 +459,7 @@ protected function readFontStyle(XMLReader $xmlReader, \DOMElement $domNode)
459459
/**
460460
* Read w:tblPr
461461
*
462-
* @param \PhpOffice\Common\XMLReader $xmlReader
462+
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
463463
* @param \DOMElement $domNode
464464
* @return string|array|null
465465
* @todo Capture w:tblStylePr w:type="firstRow"
@@ -509,7 +509,7 @@ protected function readTableStyle(XMLReader $xmlReader, \DOMElement $domNode)
509509
/**
510510
* Read w:tblpPr
511511
*
512-
* @param \PhpOffice\Common\XMLReader $xmlReader
512+
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
513513
* @param \DOMElement $domNode
514514
* @return array
515515
*/
@@ -534,7 +534,7 @@ private function readTablePosition(XMLReader $xmlReader, \DOMElement $domNode)
534534
/**
535535
* Read w:tblInd
536536
*
537-
* @param \PhpOffice\Common\XMLReader $xmlReader
537+
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
538538
* @param \DOMElement $domNode
539539
* @return TblWidthComplexType
540540
*/
@@ -552,7 +552,7 @@ private function readTableIndent(XMLReader $xmlReader, \DOMElement $domNode)
552552
/**
553553
* Read w:tcPr
554554
*
555-
* @param \PhpOffice\Common\XMLReader $xmlReader
555+
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
556556
* @param \DOMElement $domNode
557557
* @return array
558558
*/
@@ -620,7 +620,7 @@ private function findPossibleAttribute(XMLReader $xmlReader, \DOMElement $node,
620620
/**
621621
* Read style definition
622622
*
623-
* @param \PhpOffice\Common\XMLReader $xmlReader
623+
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
624624
* @param \DOMElement $parentNode
625625
* @param array $styleDefs
626626
* @ignoreScrutinizerPatch

src/PhpWord/Reader/Word2007/DocPropsCore.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
namespace PhpOffice\PhpWord\Reader\Word2007;
1919

20-
use PhpOffice\Common\XMLReader;
2120
use PhpOffice\PhpWord\PhpWord;
21+
use PhpOffice\PhpWord\Shared\XMLReader;
2222

2323
/**
2424
* Core properties reader

src/PhpWord/Reader/Word2007/DocPropsCustom.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717

1818
namespace PhpOffice\PhpWord\Reader\Word2007;
1919

20-
use PhpOffice\Common\XMLReader;
2120
use PhpOffice\PhpWord\Metadata\DocInfo;
2221
use PhpOffice\PhpWord\PhpWord;
22+
use PhpOffice\PhpWord\Shared\XMLReader;
2323

2424
/**
2525
* Custom properties reader

src/PhpWord/Reader/Word2007/Document.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717

1818
namespace PhpOffice\PhpWord\Reader\Word2007;
1919

20-
use PhpOffice\Common\XMLReader;
2120
use PhpOffice\PhpWord\Element\Section;
2221
use PhpOffice\PhpWord\PhpWord;
22+
use PhpOffice\PhpWord\Shared\XMLReader;
2323

2424
/**
2525
* Document reader
@@ -97,7 +97,7 @@ private function readHeaderFooter($settings, Section &$section)
9797
/**
9898
* Read w:sectPr
9999
*
100-
* @param \PhpOffice\Common\XMLReader $xmlReader
100+
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
101101
* @param \DOMElement $domNode
102102
* @ignoreScrutinizerPatch
103103
* @return array
@@ -141,7 +141,7 @@ private function readSectionStyle(XMLReader $xmlReader, \DOMElement $domNode)
141141
/**
142142
* Read w:p node.
143143
*
144-
* @param \PhpOffice\Common\XMLReader $xmlReader
144+
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
145145
* @param \DOMElement $node
146146
* @param \PhpOffice\PhpWord\Element\Section &$section
147147
*
@@ -170,7 +170,7 @@ private function readWPNode(XMLReader $xmlReader, \DOMElement $node, Section &$s
170170
/**
171171
* Read w:sectPr node.
172172
*
173-
* @param \PhpOffice\Common\XMLReader $xmlReader
173+
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
174174
* @param \DOMElement $node
175175
* @param \PhpOffice\PhpWord\Element\Section &$section
176176
*/

src/PhpWord/Reader/Word2007/Footnotes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
namespace PhpOffice\PhpWord\Reader\Word2007;
1919

20-
use PhpOffice\Common\XMLReader;
2120
use PhpOffice\PhpWord\PhpWord;
21+
use PhpOffice\PhpWord\Shared\XMLReader;
2222

2323
/**
2424
* Footnotes reader

0 commit comments

Comments
 (0)