Skip to content
This repository has been archived by the owner on Nov 22, 2024. It is now read-only.

Commit

Permalink
Allow php 8.4 + composer bump --dev-only + laminas/laminas-coding-sta…
Browse files Browse the repository at this point in the history
…ndard:^3 + phpunit/phpunit:^10.5.38

Signed-off-by: fezfez <demonchaux.stephane@gmail.com>
  • Loading branch information
fezfez committed Nov 17, 2024
1 parent 012aa68 commit 4e2cc98
Show file tree
Hide file tree
Showing 28 changed files with 460 additions and 530 deletions.
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@
"dealerdirect/phpcodesniffer-composer-installer": true
},
"platform": {
"php": "8.0.99"
"php": "8.1.99"
}
},
"require": {
"php": "~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0",
"php": "~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0",
"ext-json": "*",
"laminas/laminas-stdlib": "^3.6",
"psr/container": "^1.0"
},
"require-dev": {
"laminas/laminas-coding-standard": "~2.4.0",
"laminas/laminas-coding-standard": "^3.0.1",
"laminas/laminas-filter": "~2.23.0",
"laminas/laminas-i18n": "~2.19.0",
"laminas/laminas-servicemanager": "~3.19.0",
"phpunit/phpunit": "~9.5.25"
"phpunit/phpunit": "^10.5.38"
},
"conflict": {
"container-interop/container-interop": "<1.2.0",
Expand Down
865 changes: 394 additions & 471 deletions composer.lock

Large diffs are not rendered by default.

51 changes: 29 additions & 22 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,25 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true">
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./src</directory>
</include>
</coverage>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="./vendor/autoload.php"
colors="true"
cacheDirectory=".phpunit.cache"
failOnDeprecation="true"
failOnNotice="true"
failOnWarning="true"
failOnPhpunitDeprecation="false"
displayDetailsOnPhpunitDeprecations="true"
displayDetailsOnTestsThatTriggerDeprecations="true"
displayDetailsOnTestsThatTriggerNotices="true"
displayDetailsOnTestsThatTriggerWarnings="true">

<testsuites>
<testsuite name="laminas-config Test Suite">
<directory>./test</directory>
</testsuite>
</testsuites>

<php>
<env name="TESTS_LAMINAS_CONFIG_YAML_ENABLED" value="false"/>
<env name="TESTS_LAMINAS_CONFIG_YAML_LIB_INCLUDE" value=""/>
<env name="TESTS_LAMINAS_CONFIG_WRITER_YAML_CALLBACK" value=""/>
<env name="TESTS_LAMINAS_CONFIG_READER_YAML_CALLBACK" value=""/>
</php>
<testsuites>
<testsuite name="laminas-config Test Suite">
<directory>./test</directory>
</testsuite>
</testsuites>
<php>
<env name="TESTS_LAMINAS_CONFIG_YAML_ENABLED" value="false"/>
<env name="TESTS_LAMINAS_CONFIG_YAML_LIB_INCLUDE" value=""/>
<env name="TESTS_LAMINAS_CONFIG_WRITER_YAML_CALLBACK" value=""/>
<env name="TESTS_LAMINAS_CONFIG_READER_YAML_CALLBACK" value=""/>
</php>
<source>
<include>
<directory suffix=".php">./src</directory>
</include>
</source>
</phpunit>
1 change: 0 additions & 1 deletion src/AbstractConfigFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $
* Create service with name (SM v3)
*
* @param string $requestedName
* @param array $options
* @return string|mixed|array
*/
public function __invoke(Containerinterface $container, $requestedName, ?array $options = null)
Expand Down
1 change: 0 additions & 1 deletion src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ class Config implements Countable, Iterator, ArrayAccess
* Data is read-only unless $allowModifications is set to true
* on construction.
*
* @param array $array
* @param bool $allowModifications
*/
public function __construct(array $array, $allowModifications = false)
Expand Down
1 change: 0 additions & 1 deletion src/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ public static function fromFile($filename, $returnConfigObject = false, $useIncl
/**
* Read configuration from multiple files and merge them.
*
* @param array $files
* @param bool $returnConfigObject
* @param bool $useIncludePath
* @return array|Config
Expand Down
1 change: 0 additions & 1 deletion src/Processor/Constant.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ public function getTokens()
* the class constant value; otherwise, delegates to the parent.
*
* @param mixed $value
* @param array $replacements
* @return mixed
*/
protected function doProcess($value, array $replacements)
Expand Down
1 change: 0 additions & 1 deletion src/Processor/Token.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,6 @@ public function processValue($value)
* Applies replacement map to the given value by modifying the value itself
*
* @param mixed $value
* @param array $replacements
* @return mixed
* @throws Exception\InvalidArgumentException If the provided value is a read-only {@see Config}.
*/
Expand Down
3 changes: 0 additions & 3 deletions src/Reader/Ini.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ function ($error, $message = '') {
/**
* Process data from the parsed ini file.
*
* @param array $data
* @return array
*/
protected function process(array $data)
Expand Down Expand Up @@ -261,7 +260,6 @@ private function buildNestedSection($sections, $value)
/**
* Process a section.
*
* @param array $section
* @return array
*/
protected function processSection(array $section)
Expand All @@ -280,7 +278,6 @@ protected function processSection(array $section)
*
* @param string $key
* @param string $value
* @param array $config
* @throws Exception\RuntimeException
*/
protected function processKey($key, $value, array &$config)
Expand Down
1 change: 0 additions & 1 deletion src/Reader/JavaProperties.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ public function fromString($string)
/**
* Process the array for @include
*
* @param array $data
* @return array
* @throws Exception\RuntimeException If an @include key is found.
*/
Expand Down
1 change: 0 additions & 1 deletion src/Reader/Json.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ public function fromString($string)
/**
* Process the array for @include
*
* @param array $data
* @return array
* @throws Exception\RuntimeException
*/
Expand Down
1 change: 0 additions & 1 deletion src/Reader/Yaml.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ public function fromString($string)
/**
* Process the array for @include
*
* @param array $data
* @return array
* @throws Exception\RuntimeException
*/
Expand Down
1 change: 0 additions & 1 deletion src/Writer/AbstractWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ public function toString($config)
}

/**
* @param array $config
* @return string
*/
abstract protected function processConfig(array $config);
Expand Down
3 changes: 0 additions & 3 deletions src/Writer/Ini.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ public function shouldRenderWithoutSections()
/**
* processConfig(): defined by AbstractWriter.
*
* @param array $config
* @return string
*/
public function processConfig(array $config)
Expand Down Expand Up @@ -111,7 +110,6 @@ public function processConfig(array $config)
/**
* Add a branch to an INI string recursively.
*
* @param array $config
* @param array $parents
* @return string
*/
Expand Down Expand Up @@ -163,7 +161,6 @@ protected function prepareValue($value)
* Root elements that are not assigned to any section needs to be on the
* top of config.
*
* @param array $config
* @return array
*/
protected function sortRootElements(array $config)
Expand Down
1 change: 0 additions & 1 deletion src/Writer/JavaProperties.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public function __construct($delimiter = self::DELIMITER_DEFAULT)
/**
* processConfig(): defined by AbstractWriter.
*
* @param array $config
* @return string
* @throws Exception\UnprocessableConfigException For non-scalar values in the $config array.
*/
Expand Down
1 change: 0 additions & 1 deletion src/Writer/Json.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class Json extends AbstractWriter
/**
* processConfig(): defined by AbstractWriter.
*
* @param array $config
* @return string
* @throws Exception\RuntimeException If encoding errors occur.
*/
Expand Down
3 changes: 0 additions & 3 deletions src/Writer/PhpArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ class PhpArray extends AbstractWriter
/**
* processConfig(): defined by AbstractWriter.
*
* @param array $config
* @return string
*/
public function processConfig(array $config)
Expand Down Expand Up @@ -142,8 +141,6 @@ function ($error, $message = '') use ($filename) {
/**
* Recursively processes a PHP config array structure into a readable format.
*
* @param array $config
* @param array $arraySyntax
* @param int $indentLevel
* @return string
*/
Expand Down
2 changes: 0 additions & 2 deletions src/Writer/Xml.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ class Xml extends AbstractWriter
/**
* processConfig(): defined by AbstractWriter.
*
* @param array $config
* @return string
*/
public function processConfig(array $config)
Expand Down Expand Up @@ -45,7 +44,6 @@ public function processConfig(array $config)
* Add a branch to an XML object recursively.
*
* @param string $branchName
* @param array $config
* @return void
* @throws Exception\RuntimeException
*/
Expand Down
1 change: 0 additions & 1 deletion src/Writer/Yaml.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ public function setYamlEncoder($yamlEncoder)
/**
* processConfig(): defined by AbstractWriter.
*
* @param array $config
* @return string
* @throws Exception\RuntimeException
*/
Expand Down
8 changes: 8 additions & 0 deletions test/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@
*/
class ConfigTest extends TestCase
{
private array $all;
private array $numericData;
private array $menuData1;
private array $toCombineA;
private array $toCombineB;
private array $leadingdot;
private array $invalidkey;

protected function setUp(): void
{
// Arrays representing common config configurations
Expand Down
6 changes: 3 additions & 3 deletions test/FactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ class FactoryTest extends TestCase
*/
protected function getTestAssetFileName($ext)
{
if (empty($this->tmpfiles[$ext])) {
$this->tmpfiles[$ext] = tempnam(sys_get_temp_dir(), 'laminas-config-writer') . '.' . $ext;
if (empty($this->tmpFiles[$ext])) {
$this->tmpFiles[$ext] = tempnam(sys_get_temp_dir(), 'laminas-config-writer') . '.' . $ext;
}
return $this->tmpfiles[$ext];
return $this->tmpFiles[$ext];
}

protected function setUp(): void
Expand Down
2 changes: 1 addition & 1 deletion test/Processor/ConstantTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ConstantTest extends TestCase
/**
* @return array
*/
public function constantProvider()
public static function constantProvider()
{
if (! defined('LAMINAS_CONFIG_PROCESSOR_CONSTANT_TEST')) {
define('LAMINAS_CONFIG_PROCESSOR_CONSTANT_TEST', 'test-key');
Expand Down
2 changes: 1 addition & 1 deletion test/Reader/JavaPropertiesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function testAllowsSpecifyingAlternateKeyValueDelimiter()
/**
* @return array
*/
public function invalidDelimiters()
public static function invalidDelimiters()
{
return [
'null' => [null],
Expand Down
8 changes: 8 additions & 0 deletions test/ReaderPluginManagerCompatibilityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,12 @@ protected function getInstanceOf()
{
return ReaderInterface::class;
}

public function testLoadingInvalidElementRaisesException()
{
$manager = $this->getPluginManager();
$manager->setInvokableClass('test', \InvalidArgumentException::class);
$this->expectException($this->getServiceNotFoundException());
$manager->get('test');
}
}
4 changes: 2 additions & 2 deletions test/StandaloneReaderPluginManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class StandaloneReaderPluginManagerTest extends TestCase
/**
* @return string[][]
*/
public function supportedConfigExtensions()
public static function supportedConfigExtensions()
{
return [
'ini' => ['ini', Reader\Ini::class],
Expand Down Expand Up @@ -53,7 +53,7 @@ public function testCanRetrieveReaderByExtension($extension, $expectedType)
/**
* @return string[][]
*/
public function supportedConfigClassNames()
public static function supportedConfigClassNames()
{
return [
Reader\Ini::class => [Reader\Ini::class],
Expand Down
4 changes: 2 additions & 2 deletions test/StandaloneWriterPluginManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class StandaloneWriterPluginManagerTest extends TestCase
/**
* @return string[][]
*/
public function supportedConfigTypes()
public static function supportedConfigTypes()
{
return [
'ini' => ['ini', Writer\Ini::class],
Expand Down Expand Up @@ -55,7 +55,7 @@ public function testCanRetrieveWriterByType($type, $expectedType)
/**
* @return string[][]
*/
public function supportedConfigClassNames()
public static function supportedConfigClassNames()
{
return [
Writer\Ini::class => [Writer\Ini::class],
Expand Down
1 change: 0 additions & 1 deletion test/Writer/TestAssets/DummyWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
class DummyWriter extends AbstractWriter
{
/**
* @param array $config
* @return string
*/
public function processConfig(array $config)
Expand Down
8 changes: 8 additions & 0 deletions test/WriterPluginManagerCompatibilityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,12 @@ protected function getInstanceOf()
{
return AbstractWriter::class;
}

public function testLoadingInvalidElementRaisesException()
{
$manager = $this->getPluginManager();
$manager->setInvokableClass('test', \InvalidArgumentException::class);
$this->expectException($this->getServiceNotFoundException());
$manager->get('test');
}
}

0 comments on commit 4e2cc98

Please sign in to comment.