Removed php 8.4 deprications

This commit is contained in:
2025-04-25 20:38:26 -04:00
parent ad88f128b9
commit c56226ca7d
13 changed files with 77 additions and 20 deletions

8
.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

11
.idea/config.iml generated Normal file
View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" packagePrefix="Siteworx\Config\" />
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" packagePrefix="Siteworx\Config\Test\" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="PhpComposerExtensionStubsInspection" enabled="false" level="WARNING" enabled_by_default="false" />
</profile>
</component>

8
.idea/modules.xml generated Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/config.iml" filepath="$PROJECT_DIR$/.idea/config.iml" />
</modules>
</component>
</project>

17
.idea/php.xml generated Normal file
View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MessDetectorOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PHPCSFixerOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PHPCodeSnifferOptionsConfiguration">
<option name="highlightLevel" value="WARNING" />
<option name="transferred" value="true" />
</component>
<component name="PhpProjectSharedConfiguration" php_language_level="8.4" />
<component name="PhpStanOptionsConfiguration">
<option name="transferred" value="true" />
</component>
</project>

7
.idea/vcs.xml generated Normal file
View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@@ -17,7 +17,7 @@
}
],
"require": {
"php": "^8.1"
"php": "^8.4"
},
"require-dev": {
"phpunit/phpunit": "^9.5",

View File

@@ -85,7 +85,7 @@ class Config extends AbstractConfig
* @throws FileNotFoundException
* @throws UnsupportedFormatException
*/
private function __construct(string | array $values, ParserInterface $parser = null, bool $loadFromString = false)
private function __construct(string | array $values, ?ParserInterface $parser = null, bool $loadFromString = false)
{
if ($loadFromString && !is_array($values) && !file_exists($values)) {
if ($parser === null) {
@@ -156,7 +156,7 @@ class Config extends AbstractConfig
* @throws Exception\WriteException if the data could not be written to the file
* @throws UnsupportedFormatException
*/
public function toFile(string $filename, WriterInterface $writer = null): void
public function toFile(string $filename, ?WriterInterface $writer = null): void
{
if ($writer === null) {
// Get file information

View File

@@ -8,11 +8,11 @@ class WriteException extends ErrorException
{
public function __construct(array $error)
{
$message = isset($error['message']) ? $error['message'] : 'There was an error writing the file';
$code = isset($error['code']) ? $error['code'] : 0;
$severity = isset($error['type']) ? $error['type'] : 1;
$filename = isset($error['file']) ? $error['file'] : __FILE__;
$exception = isset($error['exception']) ? $error['exception'] : null;
$message = $error['message'] ?? 'There was an error writing the file';
$code = $error['code'] ?? 0;
$severity = $error['type'] ?? 1;
$filename = $error['file'] ?? __FILE__;
$exception = $error['exception'] ?? null;
parent::__construct($message, $code, $severity, $filename, $exception);
}

View File

@@ -55,7 +55,7 @@ class Json implements ParserInterface
*
* @throws ParseException If there is an error parsing the JSON data
*/
protected function parse(array $data = null, string $filename = null): ?array
protected function parse(?array $data = null, ?string $filename = null): ?array
{
if (json_last_error() !== JSON_ERROR_NONE) {
$error_message = 'Syntax error';

View File

@@ -89,7 +89,7 @@ class Php implements ParserInterface
* @return array | null
* @throws UnsupportedFormatException
*/
protected function parse(array | callable $data = null, string $filename = null): ?array
protected function parse(array | callable|null $data = null, ?string $filename = null): ?array
{
// If we have a callable, run it and expect an array back
if (is_callable($data)) {

View File

@@ -44,7 +44,7 @@ class Serialize implements ParserInterface
*
* @throws ParseException If there is an error parsing the serialized data
*/
protected function parse(string $data = null, string $filename = null): ?array
protected function parse(?string $data = null, ?string $filename = null): ?array
{
try {
$serializedData = unserialize($data, ['allowed_classes' => false]);

View File

@@ -20,7 +20,7 @@ class Xml implements ParserInterface
* {@inheritDoc}
* Parses an XML file as an array
*
* @throws ParseException If there is an error parsing the XML file
* @throws ParseException|\JsonException If there is an error parsing the XML file
*/
public function parseFile(string $filename): array
{
@@ -59,7 +59,7 @@ class Xml implements ParserInterface
* @throws ParseException If there is an error parsing the XML data
* @throws \JsonException
*/
protected function parse(\SimpleXMLElement $data = null, string $filename = null): ?array
protected function parse(?\SimpleXMLElement $data = null, ?string $filename = null): ?array
{
if ($data === false) {
$errors = libxml_get_errors();