Skip to content

Commit 54d50f2

Browse files
committed
Update type hints, improve test assertions, and raise PHP requirement.
The code now uses nullable type hints for better clarity and stricter type enforcement. The deprecated assertInternalType method is replaced with assertIsInt in tests to ensure compatibility with newer PHPUnit versions. The minimum required PHP version in the composer.json file is increased to 7.1 due to the use of nullable type hints, which are incompatible with PHP 5.6.
1 parent f13791c commit 54d50f2

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"source": "https://github.com/vanderlee/phpSyllable/"
2323
},
2424
"require": {
25-
"php": ">=5.6",
25+
"php": ">=7.1",
2626
"ext-json": "*",
2727
"ext-libxml": "*",
2828
"ext-mbstring": "*",

src/Syllable.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public function getHyphen()
162162
/**
163163
* @param Cache $cache
164164
*/
165-
public function setCache(Cache $cache = null)
165+
public function setCache(?Cache $cache = null)
166166
{
167167
$this->cache = $cache;
168168
}
@@ -598,8 +598,8 @@ private function parseHtmlText($html)
598598
*/
599599
private function hyphenateHtmlDom(
600600
DOMNode $node,
601-
DOMNodeList $excludeNodes = null,
602-
DOMNodeList $includeNodes = null,
601+
?DOMNodeList $excludeNodes = null,
602+
?DOMNodeList $includeNodes = null,
603603
$split = true
604604
) {
605605
if ($node->hasChildNodes()) {

tests/src/SyllableTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,8 @@ public function testCache($cacheClass, $language, $cacheDirectory, $cacheFile, $
171171
$this->assertNotEmpty($this->object->getCache()->__get('patterns'));
172172
$this->assertGreaterThan(0, $this->object->getCache()->__get('max_pattern'));
173173
$this->assertNotEmpty($this->object->getCache()->__get('hyphenation'));
174-
$this->assertInternalType('int', $this->object->getCache()->__get('left_min_hyphen'));
175-
$this->assertInternalType('int', $this->object->getCache()->__get('right_min_hyphen'));
174+
$this->assertIsInt($this->object->getCache()->__get('left_min_hyphen'));
175+
$this->assertIsInt($this->object->getCache()->__get('right_min_hyphen'));
176176
}
177177

178178
public function dataCacheVersionMatchesCacheFileVersionIsRelaxed()

0 commit comments

Comments
 (0)