Skip to content

Commit

Permalink
reduce number of imports by mutualisation of namespace qualifer
Browse files Browse the repository at this point in the history
  • Loading branch information
llaville committed Jul 1, 2024
1 parent 61decc7 commit 6aeb6dd
Show file tree
Hide file tree
Showing 52 changed files with 574 additions and 990 deletions.
31 changes: 11 additions & 20 deletions src/Definition/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,7 @@
namespace Bartlett\Sarif\Definition;

use Bartlett\Sarif\Internal\JsonSerializable;
use Bartlett\Sarif\Property\AbsoluteAddress;
use Bartlett\Sarif\Property\AddressKind;
use Bartlett\Sarif\Property\FullyQualifiedName;
use Bartlett\Sarif\Property\Index;
use Bartlett\Sarif\Property\Length;
use Bartlett\Sarif\Property\Name;
use Bartlett\Sarif\Property\OffsetFromParent;
use Bartlett\Sarif\Property\ParentIndex;
use Bartlett\Sarif\Property\Properties;
use Bartlett\Sarif\Property\RelativeAddress;
use Bartlett\Sarif\Property;

/**
* A physical or virtual address, or a range of addresses, in an 'addressable region' (memory or a binary file).
Expand All @@ -31,54 +22,54 @@ final class Address extends JsonSerializable
/**
* The address expressed as a byte offset from the start of the addressable region.
*/
use AbsoluteAddress;
use Property\AbsoluteAddress;

/**
* The address expressed as a byte offset from the absolute address of the top-most parent object.
*/
use RelativeAddress;
use Property\RelativeAddress;

/**
* The number of bytes in this range of addresses.
*/
use Length;
use Property\Length;

/**
* An open-ended string that identifies the address kind.
* 'data', 'function', 'header','instruction', 'module', 'page', 'section', 'segment', 'stack', 'stackFrame',
* 'table' are well-known values.
*/
use AddressKind;
use Property\AddressKind;

/**
* A name that is associated with the address, e.g., '.text'.
*/
use Name;
use Property\Name;

/**
* A human-readable fully qualified name that is associated with the address.
*/
use FullyQualifiedName;
use Property\FullyQualifiedName;

/**
* The byte offset of this address from the absolute or relative address of the parent object.
*/
use OffsetFromParent;
use Property\OffsetFromParent;

/**
* The index within run.addresses of the cached object for this address.
*/
use Index;
use Property\Index;

/**
* The index within run.addresses of the parent object.
*/
use ParentIndex;
use Property\ParentIndex;

/**
* Key/value pairs that provide additional information about the address.
*/
use Properties;
use Property\Properties;

public function __construct()
{
Expand Down
37 changes: 13 additions & 24 deletions src/Definition/Artifact.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,7 @@
namespace Bartlett\Sarif\Definition;

use Bartlett\Sarif\Internal\JsonSerializable;
use Bartlett\Sarif\Property\ContentsArtifact;
use Bartlett\Sarif\Property\Description;
use Bartlett\Sarif\Property\Encoding;
use Bartlett\Sarif\Property\Hashes;
use Bartlett\Sarif\Property\Length;
use Bartlett\Sarif\Property\LocationArtifact;
use Bartlett\Sarif\Property\MimeType;
use Bartlett\Sarif\Property\Offset;
use Bartlett\Sarif\Property\ParentIndex;
use Bartlett\Sarif\Property\Properties;
use Bartlett\Sarif\Property\Roles;
use Bartlett\Sarif\Property\SourceLanguage;
use Bartlett\Sarif\Property;

/**
* A single artifact. In some cases, this artifact might be nested within another artifact.
Expand All @@ -33,63 +22,63 @@ final class Artifact extends JsonSerializable
/**
* A short description of the artifact.
*/
use Description;
use Property\Description;

/**
* The location of the artifact.
*/
use LocationArtifact;
use Property\LocationArtifact;

/**
* Identifies the index of the immediate parent of the artifact, if this artifact is nested.
*/
use ParentIndex;
use Property\ParentIndex;

/**
* The offset in bytes of the artifact within its containing artifact.
*/
use Offset;
use Property\Offset;

/**
* The length of the artifact in bytes.
*/
use Length;
use Property\Length;

/**
* The role or roles played by the artifact in the analysis.
*/
use Roles;
use Property\Roles;

/**
* The MIME type (RFC 2045) of the artifact.
*/
use MimeType;
use Property\MimeType;

/**
* The contents of the artifact.
*/
use ContentsArtifact;
use Property\ContentsArtifact;

/**
* Specifies the encoding for an artifact object that refers to a text file.
*/
use Encoding;
use Property\Encoding;

/**
* Specifies the source language for any artifact object that refers to a text file that contains source code.
*/
use SourceLanguage;
use Property\SourceLanguage;

/**
* A dictionary, each of whose keys are the name of a hash function
* and each of whose values are the hashed value of the artifact produced by the specified hash function.
*/
use Hashes;
use Property\Hashes;

/**
* Key/value pairs that provide additional information about the artifact.
*/
use Properties;
use Property\Properties;

public function __construct()
{
Expand Down
10 changes: 4 additions & 6 deletions src/Definition/ArtifactChange.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
namespace Bartlett\Sarif\Definition;

use Bartlett\Sarif\Internal\JsonSerializable;
use Bartlett\Sarif\Property\LocationArtifact;
use Bartlett\Sarif\Property\Properties;
use Bartlett\Sarif\Property\Replacements;
use Bartlett\Sarif\Property;

/**
* A change to a single artifact.
Expand All @@ -24,18 +22,18 @@ final class ArtifactChange extends JsonSerializable
/**
* The location of the artifact to change.
*/
use LocationArtifact;
use Property\LocationArtifact;

/**
* An array of replacement objects,
* each of which represents the replacement of a single region in a single artifact specified by 'artifactLocation'.
*/
use Replacements;
use Property\Replacements;

/**
* Key/value pairs that provide additional information about the change.
*/
use Properties;
use Property\Properties;

/**
* @param ArtifactLocation $artifactLocation
Expand Down
13 changes: 5 additions & 8 deletions src/Definition/ArtifactContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
namespace Bartlett\Sarif\Definition;

use Bartlett\Sarif\Internal\JsonSerializable;
use Bartlett\Sarif\Property\Binary;
use Bartlett\Sarif\Property\Properties;
use Bartlett\Sarif\Property\Rendered;
use Bartlett\Sarif\Property\Text;
use Bartlett\Sarif\Property;

/**
* Represents the contents of an artifact.
Expand All @@ -25,22 +22,22 @@ final class ArtifactContent extends JsonSerializable
/**
* UTF-8-encoded content from a text artifact.
*/
use Text;
use Property\Text;

/**
* MIME Base64-encoded content from a binary artifact, or from a text artifact in its original encoding.
*/
use Binary;
use Property\Binary;

/**
* An alternate rendered representation of the artifact (e.g., a decompiled representation of a binary region).
*/
use Rendered;
use Property\Rendered;

/**
* Key/value pairs that provide additional information about the artifact content.
*/
use Properties;
use Property\Properties;

public function __construct()
{
Expand Down
16 changes: 6 additions & 10 deletions src/Definition/ArtifactLocation.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@
namespace Bartlett\Sarif\Definition;

use Bartlett\Sarif\Internal\JsonSerializable;
use Bartlett\Sarif\Property\Description;
use Bartlett\Sarif\Property\Index;
use Bartlett\Sarif\Property\Properties;
use Bartlett\Sarif\Property\Uri;
use Bartlett\Sarif\Property\UriBaseId;
use Bartlett\Sarif\Property;

/**
* Specifies the location of an artifact.
Expand All @@ -25,28 +21,28 @@ final class ArtifactLocation extends JsonSerializable
/**
* A string containing a valid relative or absolute URI.
*/
use Uri;
use Property\Uri;

/**
* A string which indirectly specifies the absolute URI
* with respect to which a relative URI in the "uri" property is interpreted.
*/
use UriBaseId;
use Property\UriBaseId;

/**
* The index within the run artifacts array of the artifact object associated with the artifact location.
*/
use Index;
use Property\Index;

/**
* A short description of the artifact location.
*/
use Description;
use Property\Description;

/**
* Key/value pairs that provide additional information about the artifact location.
*/
use Properties;
use Property\Properties;

public function __construct()
{
Expand Down
16 changes: 6 additions & 10 deletions src/Definition/Attachment.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@
namespace Bartlett\Sarif\Definition;

use Bartlett\Sarif\Internal\JsonSerializable;
use Bartlett\Sarif\Property\Description;
use Bartlett\Sarif\Property\LocationAttachment;
use Bartlett\Sarif\Property\Properties;
use Bartlett\Sarif\Property\Rectangles;
use Bartlett\Sarif\Property\Regions;
use Bartlett\Sarif\Property;

/**
* An artifact relevant to a result.
Expand All @@ -26,27 +22,27 @@ final class Attachment extends JsonSerializable
/**
* A message describing the role played by the attachment.
*/
use Description;
use Property\Description;

/**
* The location of the attachment.
*/
use LocationAttachment;
use Property\LocationAttachment;

/**
* An array of regions of interest within the attachment.
*/
use Regions;
use Property\Regions;

/**
* An array of rectangles specifying areas of interest within the image.
*/
use Rectangles;
use Property\Rectangles;

/**
* Key/value pairs that provide additional information about the attachment.
*/
use Properties;
use Property\Properties;

public function __construct()
{
Expand Down
10 changes: 4 additions & 6 deletions src/Definition/CodeFlow.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
namespace Bartlett\Sarif\Definition;

use Bartlett\Sarif\Internal\JsonSerializable;
use Bartlett\Sarif\Property\MessageString;
use Bartlett\Sarif\Property\Properties;
use Bartlett\Sarif\Property\ThreadFlows;
use Bartlett\Sarif\Property;

/**
* A set of threadFlows which together describe a pattern of code execution relevant to detecting a result.
Expand All @@ -24,18 +22,18 @@ final class CodeFlow extends JsonSerializable
/**
* A message relevant to the code flow.
*/
use MessageString;
use Property\MessageString;

/**
* An array of one or more unique threadFlow objects,
* each of which describes the progress of a program through a thread of execution.
*/
use ThreadFlows;
use Property\ThreadFlows;

/**
* Key/value pairs that provide additional information about the code flow.
*/
use Properties;
use Property\Properties;

/**
* @param ThreadFlow[] $threadFlows
Expand Down
Loading

0 comments on commit 6aeb6dd

Please sign in to comment.