Skip to content

Commit

Permalink
slack interfaces/protocols (#253)
Browse files Browse the repository at this point in the history

Signed-off-by: Jan Kowalleck <[email protected]>
  • Loading branch information
jkowalleck authored Mar 10, 2023
1 parent 2d51103 commit 60ccbbe
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 25 deletions.
6 changes: 5 additions & 1 deletion HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ All notable changes to this project will be documented in this file.
* BREAKING: renamed namespace to `Serialization` ([#5] via [#146])
* `SerializerInterface` interface
* BREAKING: renamed to `Serializer` ([#133] via [#155])
* BREAKING: existing method `serialize()` got a new optional parameter `$prettyPrint` (via [#155])
* BREAKING: method `serialize()` got a new optional parameter `$prettyPrint` (via [#155])
* BREAKING: method `serialize()` may throw `\Throwable`, was `\Exception` (via [#253])
* `BaseSerializer` abstract class
* BREAKING: complete redesign (via [#155])
* `{Json,Xml}Serializer` class
Expand Down Expand Up @@ -187,6 +188,8 @@ All notable changes to this project will be documented in this file.
* BREAKING: removed deprecated method `setSpec()` (via [#144])
* `ValidatorInterface` interface
* BREAKING: renamed interface to `Validator` ([#133] via [#143])
* Removed specification of constructor `__construct()` (via [#253])
* Removed specification of method `getSpec()` (via [#253])
* `Validators\{Json,Xml}Validator` classes
* Added support for CycloneDX v1.4 ([#57] via [#65])
* `Validators\JsonValidator` classes
Expand Down Expand Up @@ -241,6 +244,7 @@ All notable changes to this project will be documented in this file.
[#241]: https://github.com/CycloneDX/cyclonedx-php-library/pull/241
[#247]: https://github.com/CycloneDX/cyclonedx-php-library/issues/247
[#249]: https://github.com/CycloneDX/cyclonedx-php-library/pull/249
[#253]: https://github.com/CycloneDX/cyclonedx-php-library/pull/253

## 1.6.3 - 2022-09-15

Expand Down
2 changes: 0 additions & 2 deletions src/Core/Serialization/BaseSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ abstract protected function realNormalize(Bom $bom) /* : TNormalizedBom */;
*
* @throws Exception
*
* @psalm-return non-empty-string
*
* @SuppressWarnings(PHPMD.BooleanArgumentFlag)
*/
abstract protected function realSerialize(/* TNormalizedBom */ $normalizedBom, ?bool $prettyPrint): string;
Expand Down
8 changes: 3 additions & 5 deletions src/Core/Serialization/Serializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,20 @@
namespace CycloneDX\Core\Serialization;

use CycloneDX\Core\Models\Bom;
use Exception;
use Throwable;

/**
* @author jkowalleck
*/
interface Serializer
{
/**
* Serialize a {@see \CycloneDX\Core\Models\Bom} to {@see string}.
* Serialize a {@see \CycloneDX\Core\Models\Bom} to string.
*
* @param Bom $bom the BOM to serialize
* @param bool $prettyPrint whether to beatify the resulting string. A `null` value means no preference.
*
* @throws Exception
*
* @psalm-return non-empty-string
* @throws Throwable
*
* @SuppressWarnings(PHPMD.BooleanArgumentFlag)
*/
Expand Down
3 changes: 1 addition & 2 deletions src/Core/Serialization/XmlSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,9 @@ protected function realSerialize(/* DOMElement */ $normalizedBom, ?bool $prettyP
$document->formatOutput = $prettyPrint;
}

// option LIBXML_NOEMPTYTAG might lead to errors in consumers
// option LIBXML_NOEMPTYTAG might lead to errors in consumers, do not use it.
$xml = $document->saveXML();
\assert(false !== $xml);
\assert('' !== $xml);

return $xml;
}
Expand Down
9 changes: 0 additions & 9 deletions src/Core/Validation/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,10 @@

namespace CycloneDX\Core\Validation;

use CycloneDX\Core\Spec\Spec;

/**
* @author jkowalleck
*/
interface Validator
{
public function __construct(Spec $spec);

public function getSpec(): Spec;

/**
* @psalm-param non-empty-string $string
*/
public function validateString(string $string): ?ValidationError;
}
2 changes: 0 additions & 2 deletions src/Core/Validation/Validators/JsonValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ protected static function listSchemaFiles(): array
}

/**
* @psalm-param non-empty-string $string
*
* @throws FailedLoadingSchemaException if schema file unknown or not readable
* @throws JsonException if loading the JSON failed
*/
Expand Down
4 changes: 0 additions & 4 deletions src/Core/Validation/Validators/XmlValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ protected static function listSchemaFiles(): array
}

/**
* @psalm-param non-empty-string $string
*
* @throws FailedLoadingSchemaException if schema file unknown or not readable
* @throws DOMException if loading the DOM failed
*/
Expand Down Expand Up @@ -99,8 +97,6 @@ private function validateDomWithSchema(DOMDocument $doc): ?LibXMLError
}

/**
* @psalm-param non-empty-string $xml
*
* @throws DOMException if loading the DOM failed
*/
private function loadDomFromXml(string $xml): DOMDocument
Expand Down

0 comments on commit 60ccbbe

Please sign in to comment.