diff --git a/composer.json b/composer.json index ce1fd809..519ca8c7 100644 --- a/composer.json +++ b/composer.json @@ -45,7 +45,8 @@ }, "config": { "allow-plugins": { - "composer/package-versions-deprecated": true + "composer/package-versions-deprecated": true, + "dealerdirect/phpcodesniffer-composer-installer": true } } } diff --git a/src/AbstractElement.php b/src/AbstractElement.php index a4b39b69..4bbce476 100644 --- a/src/AbstractElement.php +++ b/src/AbstractElement.php @@ -6,10 +6,10 @@ use DOMElement; use RuntimeException; +use SimpleSAML\Assert\Assert; use SimpleSAML\XML\Exception\MissingAttributeException; use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\SerializableElementTrait; -use SimpleSAML\Assert\Assert; use function array_slice; use function defined; diff --git a/src/ArrayizableElementInterface.php b/src/ArrayizableElementInterface.php index bb11436c..27a995a3 100644 --- a/src/ArrayizableElementInterface.php +++ b/src/ArrayizableElementInterface.php @@ -4,8 +4,6 @@ namespace SimpleSAML\XML; -use DOMElement; - /** * interface class to be implemented by all the classes that represent an arrayizable XML element * diff --git a/src/Base64ElementTrait.php b/src/Base64ElementTrait.php index e72e524c..0a604a0e 100644 --- a/src/Base64ElementTrait.php +++ b/src/Base64ElementTrait.php @@ -6,10 +6,8 @@ use DOMElement; use SimpleSAML\Assert\Assert; -use SimpleSAML\XML\Constants; -use SimpleSAML\XML\StringElementTrait; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\Exception\SchemaViolationException; +use SimpleSAML\XML\StringElementTrait; use function str_replace; diff --git a/src/Chunk.php b/src/Chunk.php index 4215aa70..97926ff9 100644 --- a/src/Chunk.php +++ b/src/Chunk.php @@ -9,9 +9,7 @@ use SimpleSAML\XML\Exception\MissingAttributeException; use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\SerializableElementTrait; -use SimpleSAML\XML\Utils; -use function func_num_args; use function in_array; use function intval; diff --git a/src/DOMDocumentFactory.php b/src/DOMDocumentFactory.php index 31a2f79c..25998ac5 100644 --- a/src/DOMDocumentFactory.php +++ b/src/DOMDocumentFactory.php @@ -5,7 +5,6 @@ namespace SimpleSAML\XML; use DOMDocument; -use InvalidArgumentException; use RuntimeException; use SimpleSAML\Assert\Assert; use SimpleSAML\XML\Exception\IOException; @@ -13,8 +12,6 @@ use function defined; use function file_get_contents; -use function is_file; -use function is_readable; use function libxml_clear_errors; use function libxml_get_last_error; use function libxml_use_internal_errors; diff --git a/src/ExtendableElementTrait.php b/src/ExtendableElementTrait.php index ead62b8b..6b91aa96 100644 --- a/src/ExtendableElementTrait.php +++ b/src/ExtendableElementTrait.php @@ -4,7 +4,6 @@ namespace SimpleSAML\XML; -use DOMElement; use RuntimeException; use SimpleSAML\Assert\Assert; use SimpleSAML\XML\Chunk; diff --git a/src/QNameElementTrait.php b/src/QNameElementTrait.php index d24eb843..5cf5095d 100644 --- a/src/QNameElementTrait.php +++ b/src/QNameElementTrait.php @@ -6,7 +6,6 @@ use DOMElement; use SimpleSAML\Assert\Assert; -use SimpleSAML\XML\Constants; use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\StringElementTrait; diff --git a/src/SerializableElementTrait.php b/src/SerializableElementTrait.php index b58d9b9d..a97e1f42 100644 --- a/src/SerializableElementTrait.php +++ b/src/SerializableElementTrait.php @@ -5,8 +5,6 @@ namespace SimpleSAML\XML; use DOMElement; -use RuntimeException; -use SimpleSAML\Assert\Assert; use SimpleSAML\XML\DOMDocumentFactory; use function array_pop; diff --git a/src/StringElementTrait.php b/src/StringElementTrait.php index 08ff9b2e..835ca906 100644 --- a/src/StringElementTrait.php +++ b/src/StringElementTrait.php @@ -6,7 +6,6 @@ use DOMElement; use SimpleSAML\Assert\Assert; -use SimpleSAML\XML\Constants; use SimpleSAML\XML\Exception\InvalidDOMElementException; /** diff --git a/src/TestUtils/ArrayizableElementTestTrait.php b/src/TestUtils/ArrayizableElementTestTrait.php index 8a3eecfe..2ff77584 100644 --- a/src/TestUtils/ArrayizableElementTestTrait.php +++ b/src/TestUtils/ArrayizableElementTestTrait.php @@ -4,8 +4,6 @@ namespace SimpleSAML\XML\TestUtils; -use DOMDocument; - use function class_exists; /** diff --git a/src/Utils/XPath.php b/src/Utils/XPath.php index c7203db8..4449ffa0 100644 --- a/src/Utils/XPath.php +++ b/src/Utils/XPath.php @@ -5,10 +5,8 @@ namespace SimpleSAML\XML\Utils; use DOMDocument; -use DOMElement; use DOMNode; use DOMXPath; -use InvalidArgumentException; use SimpleSAML\Assert\Assert; /** diff --git a/tests/Utils/ExtendableAttributesElement.php b/tests/Utils/ExtendableAttributesElement.php index faebdbda..17bb59d9 100644 --- a/tests/Utils/ExtendableAttributesElement.php +++ b/tests/Utils/ExtendableAttributesElement.php @@ -6,11 +6,10 @@ use DOMElement; use SimpleSAML\Assert\Assert; -use SimpleSAML\Assert\AssertionFailedException; use SimpleSAML\XML\AbstractElement; -use SimpleSAML\XML\XsNamespace as NS; -use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\Exception\InvalidDOMElementException; +use SimpleSAML\XML\ExtendableAttributesTrait; +use SimpleSAML\XML\XsNamespace as NS; /** * Empty shell class for testing ExtendableAttributesTrait. diff --git a/tests/Utils/ExtendableElement.php b/tests/Utils/ExtendableElement.php index 9ba5166d..9469aa2b 100644 --- a/tests/Utils/ExtendableElement.php +++ b/tests/Utils/ExtendableElement.php @@ -5,13 +5,11 @@ namespace SimpleSAML\Test\XML; use DOMElement; -use SimpleSAML\Assert\Assert; use SimpleSAML\XML\AbstractElement; use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\XsNamespace as NS; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\SerializableElementTrait; +use SimpleSAML\XML\XsNamespace as NS; /** * Empty shell class for testing ExtendableElementTrait. diff --git a/tests/Utils/QNameElement.php b/tests/Utils/QNameElement.php index 502e0af8..6739765d 100644 --- a/tests/Utils/QNameElement.php +++ b/tests/Utils/QNameElement.php @@ -4,8 +4,8 @@ namespace SimpleSAML\Test\XML; -use SimpleSAML\XML\QNameElementTrait; use SimpleSAML\XML\AbstractElement; +use SimpleSAML\XML\QNameElementTrait; /** * Empty shell class for testing QNameElement. diff --git a/tests/Utils/StringElement.php b/tests/Utils/StringElement.php index d3dc8990..93cef670 100644 --- a/tests/Utils/StringElement.php +++ b/tests/Utils/StringElement.php @@ -5,7 +5,6 @@ namespace SimpleSAML\Test\XML; use SimpleSAML\XML\AbstractElement; -use SimpleSAML\XML\SerializableElementTrait; use SimpleSAML\XML\StringElementTrait; /** diff --git a/tests/XML/AbstractElementTest.php b/tests/XML/AbstractElementTest.php index cf6a3300..2412ddfd 100644 --- a/tests/XML/AbstractElementTest.php +++ b/tests/XML/AbstractElementTest.php @@ -6,7 +6,6 @@ use PHPUnit\Framework\TestCase; use SimpleSAML\Test\XML\Element; -use SimpleSAML\XML\AbstractElement; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\Exception\MissingAttributeException; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; diff --git a/tests/XML/AttributeTest.php b/tests/XML/AttributeTest.php index 4798edae..92dce9ef 100644 --- a/tests/XML/AttributeTest.php +++ b/tests/XML/AttributeTest.php @@ -6,13 +6,10 @@ use DOMDocument; use PHPUnit\Framework\TestCase; -use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\Attribute; +use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; -use function dirname; - /** * Class \SimpleSAML\XML\AttributeTest * diff --git a/tests/XML/Base64ElementTraitTest.php b/tests/XML/Base64ElementTraitTest.php index 8b5e140c..29d33895 100644 --- a/tests/XML/Base64ElementTraitTest.php +++ b/tests/XML/Base64ElementTraitTest.php @@ -5,12 +5,8 @@ namespace SimpleSAML\Test\XML; use PHPUnit\Framework\TestCase; -use SimpleSAML\Assert\Assert; -use SimpleSAML\Test\XML\Base64EStringlement; use SimpleSAML\Test\XML\XMLDumper; -use SimpleSAML\XML\AbstractElement; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\Base64ElementTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use function dirname; diff --git a/tests/XML/DOMDocumentFactoryTest.php b/tests/XML/DOMDocumentFactoryTest.php index ea640dfa..c15d1738 100644 --- a/tests/XML/DOMDocumentFactoryTest.php +++ b/tests/XML/DOMDocumentFactoryTest.php @@ -4,9 +4,8 @@ namespace SimpleSAML\Test\XML; -use InvalidArgumentException; -use RuntimeException; use PHPUnit\Framework\TestCase; +use RuntimeException; use SimpleSAML\Assert\AssertionFailedException; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\Exception\UnparseableXMLException; diff --git a/tests/XML/Exception/IOExceptionTest.php b/tests/XML/Exception/IOExceptionTest.php index 94eadc0f..6aec9750 100644 --- a/tests/XML/Exception/IOExceptionTest.php +++ b/tests/XML/Exception/IOExceptionTest.php @@ -4,7 +4,6 @@ namespace SimpleSAML\Test\XML; -use LibXMLError; use PHPUnit\Framework\TestCase; use SimpleSAML\XML\Exception\IOException; diff --git a/tests/XML/Exception/UnparseableXMLExceptionTest.php b/tests/XML/Exception/UnparseableXMLExceptionTest.php index f93a7e6c..557d004d 100644 --- a/tests/XML/Exception/UnparseableXMLExceptionTest.php +++ b/tests/XML/Exception/UnparseableXMLExceptionTest.php @@ -5,7 +5,6 @@ namespace SimpleSAML\Test\XML; use LibXMLError; -use LIBXML_ERR_ERROR; use PHPUnit\Framework\TestCase; use SimpleSAML\XML\Exception\UnparseableXMLException; diff --git a/tests/XML/ExtendableAttributesTraitTest.php b/tests/XML/ExtendableAttributesTraitTest.php index a5cb94f8..307c72d8 100644 --- a/tests/XML/ExtendableAttributesTraitTest.php +++ b/tests/XML/ExtendableAttributesTraitTest.php @@ -5,16 +5,11 @@ namespace SimpleSAML\Test\XML; use PHPUnit\Framework\TestCase; -use SimpleSAML\Assert\Assert; use SimpleSAML\Assert\AssertionFailedException; use SimpleSAML\Test\XML\ExtendableAttributesElement; -use SimpleSAML\Test\XML\ExtendableAttributesTestTrait; use SimpleSAML\XML\Attribute; -use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\XsNamespace as NS; -use function dirname; - /** * Class \SimpleSAML\XML\ExtendableAttributesTraitTest * diff --git a/tests/XML/ExtendableElementTest.php b/tests/XML/ExtendableElementTest.php index 8e5238c9..d0ae1fcd 100644 --- a/tests/XML/ExtendableElementTest.php +++ b/tests/XML/ExtendableElementTest.php @@ -5,14 +5,13 @@ namespace SimpleSAML\Test\XML; use PHPUnit\Framework\TestCase; -use SimpleSAML\Test\XML\ExtendableElementElement; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; -use SimpleSAML\XML\Attribute; use function dirname; +use function strval; /** * Class \SimpleSAML\XML\ExtendableElementTest diff --git a/tests/XML/ExtendableElementTraitTest.php b/tests/XML/ExtendableElementTraitTest.php index c2efe832..744da6f8 100644 --- a/tests/XML/ExtendableElementTraitTest.php +++ b/tests/XML/ExtendableElementTraitTest.php @@ -12,8 +12,6 @@ use SimpleSAML\XML\ElementInterface; use SimpleSAML\XML\XsNamespace as NS; -use function dirname; - /** * Class \SimpleSAML\XML\ExtendableElementTraitTest * diff --git a/tests/XML/LocalizedStringElementTraitTest.php b/tests/XML/LocalizedStringElementTraitTest.php index 968b8e5c..c4198ade 100644 --- a/tests/XML/LocalizedStringElementTraitTest.php +++ b/tests/XML/LocalizedStringElementTraitTest.php @@ -6,9 +6,7 @@ use PHPUnit\Framework\TestCase; use SimpleSAML\Test\XML\LocalizedStringElement; -use SimpleSAML\XML\AbstractElement; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\StringElementTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use function dirname; diff --git a/tests/XML/QNameElementTraitTest.php b/tests/XML/QNameElementTraitTest.php index 35f2fa2c..100a64b3 100644 --- a/tests/XML/QNameElementTraitTest.php +++ b/tests/XML/QNameElementTraitTest.php @@ -5,9 +5,6 @@ namespace SimpleSAML\Test\XML; use PHPUnit\Framework\TestCase; -use SimpleSAML\Assert\Assert; -use SimpleSAML\Test\XML\QNamelement; -use SimpleSAML\XML\AbstractElement; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; diff --git a/tests/XML/StringElementTraitTest.php b/tests/XML/StringElementTraitTest.php index 14893ab3..5b2750cb 100644 --- a/tests/XML/StringElementTraitTest.php +++ b/tests/XML/StringElementTraitTest.php @@ -6,9 +6,7 @@ use PHPUnit\Framework\TestCase; use SimpleSAML\Test\XML\StringElement; -use SimpleSAML\XML\AbstractElement; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\StringElementTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use function dirname;