diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index a9e4b1c..ae9dd4a 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -5,7 +5,7 @@ $finder = PhpCsFixer\Finder::create() ; return (new PhpCsFixer\Config()) ->setRules([ - '@PSR2' => true, + '@PSR12' => true, 'array_syntax' => ['syntax' => 'short'], 'braces_position' => [ 'functions_opening_brace' => 'same_line', diff --git a/src/Backend/ISearchBackend.php b/src/Backend/ISearchBackend.php index 277f284..b636a86 100644 --- a/src/Backend/ISearchBackend.php +++ b/src/Backend/ISearchBackend.php @@ -1,4 +1,6 @@ - * diff --git a/src/Backend/SearchPropertyDefinition.php b/src/Backend/SearchPropertyDefinition.php index 4dca05b..fa5572a 100644 --- a/src/Backend/SearchPropertyDefinition.php +++ b/src/Backend/SearchPropertyDefinition.php @@ -1,4 +1,6 @@ - * @@ -22,14 +24,14 @@ namespace SearchDAV\Backend; class SearchPropertyDefinition { - const XS = '{http://www.w3.org/2001/XMLSchema}'; - const DATATYPE_STRING = self::XS . 'string'; - const DATATYPE_INTEGER = self::XS . 'integer'; - const DATATYPE_NONNEGATIVE_INTEGER = self::XS . 'nonNegativeInteger'; - const DATATYPE_NON_NEGATIVE_INTEGER = self::XS . 'nonNegativeInteger'; - const DATATYPE_DECIMAL = self::XS . 'decimal'; - const DATATYPE_DATETIME = self::XS . 'dateTime'; - const DATATYPE_BOOLEAN = self::XS . 'boolean'; + public const XS = '{http://www.w3.org/2001/XMLSchema}'; + public const DATATYPE_STRING = self::XS . 'string'; + public const DATATYPE_INTEGER = self::XS . 'integer'; + public const DATATYPE_NONNEGATIVE_INTEGER = self::XS . 'nonNegativeInteger'; + public const DATATYPE_NON_NEGATIVE_INTEGER = self::XS . 'nonNegativeInteger'; + public const DATATYPE_DECIMAL = self::XS . 'decimal'; + public const DATATYPE_DATETIME = self::XS . 'dateTime'; + public const DATATYPE_BOOLEAN = self::XS . 'boolean'; /** @var boolean */ diff --git a/src/Backend/SearchResult.php b/src/Backend/SearchResult.php index af48506..bde0d10 100644 --- a/src/Backend/SearchResult.php +++ b/src/Backend/SearchResult.php @@ -1,4 +1,6 @@ - * diff --git a/src/DAV/DiscoverHandler.php b/src/DAV/DiscoverHandler.php index 9b1f36b..25c404e 100644 --- a/src/DAV/DiscoverHandler.php +++ b/src/DAV/DiscoverHandler.php @@ -1,4 +1,6 @@ - * diff --git a/src/DAV/PathHelper.php b/src/DAV/PathHelper.php index 0b25915..2a9f607 100644 --- a/src/DAV/PathHelper.php +++ b/src/DAV/PathHelper.php @@ -1,4 +1,6 @@ - * diff --git a/src/DAV/QueryParser.php b/src/DAV/QueryParser.php index a225fe0..d61e774 100644 --- a/src/DAV/QueryParser.php +++ b/src/DAV/QueryParser.php @@ -1,4 +1,6 @@ - * @@ -30,6 +32,7 @@ use SearchDAV\XML\Literal; use SearchDAV\XML\Operator; use SearchDAV\XML\Order; use SearchDAV\XML\Scope; + use function Sabre\Xml\Deserializer\keyValue; use function Sabre\Xml\Deserializer\repeatingElements; diff --git a/src/DAV/SearchHandler.php b/src/DAV/SearchHandler.php index 5750f09..6fc10d4 100644 --- a/src/DAV/SearchHandler.php +++ b/src/DAV/SearchHandler.php @@ -1,4 +1,6 @@ - * diff --git a/src/DAV/SearchPlugin.php b/src/DAV/SearchPlugin.php index 7c03b5a..b38665d 100644 --- a/src/DAV/SearchPlugin.php +++ b/src/DAV/SearchPlugin.php @@ -1,4 +1,6 @@ - * @@ -32,7 +34,7 @@ use SearchDAV\Backend\ISearchBackend; use SearchDAV\XML\SupportedQueryGrammar; class SearchPlugin extends ServerPlugin { - const SEARCHDAV_NS = 'https://github.com/icewind1991/SearchDAV/ns'; + public const SEARCHDAV_NS = 'https://github.com/icewind1991/SearchDAV/ns'; /** @var ISearchBackend */ private $searchBackend; diff --git a/src/Query/Limit.php b/src/Query/Limit.php index f59550f..9966dd3 100644 --- a/src/Query/Limit.php +++ b/src/Query/Limit.php @@ -1,4 +1,6 @@ - * diff --git a/src/Query/Literal.php b/src/Query/Literal.php index 99ce07a..66150f3 100644 --- a/src/Query/Literal.php +++ b/src/Query/Literal.php @@ -1,4 +1,6 @@ - * diff --git a/src/Query/Operator.php b/src/Query/Operator.php index 182f264..1b4f5a4 100644 --- a/src/Query/Operator.php +++ b/src/Query/Operator.php @@ -1,4 +1,6 @@ - * @@ -22,18 +24,18 @@ namespace SearchDAV\Query; class Operator { - const OPERATION_AND = '{DAV:}and'; - const OPERATION_OR = '{DAV:}or'; - const OPERATION_NOT = '{DAV:}not'; - const OPERATION_EQUAL = '{DAV:}eq'; - const OPERATION_LESS_THAN = '{DAV:}lt'; - const OPERATION_LESS_OR_EQUAL_THAN = '{DAV:}lte'; - const OPERATION_GREATER_THAN = '{DAV:}gt'; - const OPERATION_GREATER_OR_EQUAL_THAN = '{DAV:}gte'; - const OPERATION_IS_COLLECTION = '{DAV:}is-collection'; - const OPERATION_IS_DEFINED = '{DAV:}is-defined'; - const OPERATION_IS_LIKE = '{DAV:}like'; - const OPERATION_CONTAINS = '{DAV:}contains'; + public const OPERATION_AND = '{DAV:}and'; + public const OPERATION_OR = '{DAV:}or'; + public const OPERATION_NOT = '{DAV:}not'; + public const OPERATION_EQUAL = '{DAV:}eq'; + public const OPERATION_LESS_THAN = '{DAV:}lt'; + public const OPERATION_LESS_OR_EQUAL_THAN = '{DAV:}lte'; + public const OPERATION_GREATER_THAN = '{DAV:}gt'; + public const OPERATION_GREATER_OR_EQUAL_THAN = '{DAV:}gte'; + public const OPERATION_IS_COLLECTION = '{DAV:}is-collection'; + public const OPERATION_IS_DEFINED = '{DAV:}is-defined'; + public const OPERATION_IS_LIKE = '{DAV:}like'; + public const OPERATION_CONTAINS = '{DAV:}contains'; /** * @var string diff --git a/src/Query/Order.php b/src/Query/Order.php index 20f69f6..e5c06cb 100644 --- a/src/Query/Order.php +++ b/src/Query/Order.php @@ -1,4 +1,6 @@ - * @@ -24,8 +26,8 @@ namespace SearchDAV\Query; use SearchDAV\Backend\SearchPropertyDefinition; class Order { - const ASC = 'ascending'; - const DESC = 'descending'; + public const ASC = 'ascending'; + public const DESC = 'descending'; /** * @var SearchPropertyDefinition diff --git a/src/Query/Query.php b/src/Query/Query.php index 82f237c..30ee439 100644 --- a/src/Query/Query.php +++ b/src/Query/Query.php @@ -1,4 +1,6 @@ - * diff --git a/src/Query/Scope.php b/src/Query/Scope.php index 76b41ae..57787e1 100644 --- a/src/Query/Scope.php +++ b/src/Query/Scope.php @@ -1,4 +1,6 @@ - * diff --git a/src/XML/BasicSearch.php b/src/XML/BasicSearch.php index 237b279..37f4170 100644 --- a/src/XML/BasicSearch.php +++ b/src/XML/BasicSearch.php @@ -1,4 +1,6 @@ - * @@ -24,6 +26,7 @@ namespace SearchDAV\XML; use Sabre\Xml\ParseException; use Sabre\Xml\Reader; use Sabre\Xml\XmlDeserializable; + use function Sabre\Xml\Deserializer\keyValue; /** diff --git a/src/XML/BasicSearchSchema.php b/src/XML/BasicSearchSchema.php index c68aabe..d558cf2 100644 --- a/src/XML/BasicSearchSchema.php +++ b/src/XML/BasicSearchSchema.php @@ -1,4 +1,6 @@ - * diff --git a/src/XML/Limit.php b/src/XML/Limit.php index b00809f..572c493 100644 --- a/src/XML/Limit.php +++ b/src/XML/Limit.php @@ -1,4 +1,6 @@ - * @@ -24,6 +26,7 @@ namespace SearchDAV\XML; use Sabre\Xml\Reader; use Sabre\Xml\XmlDeserializable; use SearchDAV\DAV\SearchPlugin; + use function Sabre\Xml\Deserializer\keyValue; /** diff --git a/src/XML/Literal.php b/src/XML/Literal.php index dc1f69d..630cd6b 100644 --- a/src/XML/Literal.php +++ b/src/XML/Literal.php @@ -1,4 +1,6 @@ - * diff --git a/src/XML/Operator.php b/src/XML/Operator.php index fb44ba8..4c8a608 100644 --- a/src/XML/Operator.php +++ b/src/XML/Operator.php @@ -1,4 +1,6 @@ - * diff --git a/src/XML/Order.php b/src/XML/Order.php index 74eab7e..c0caf03 100644 --- a/src/XML/Order.php +++ b/src/XML/Order.php @@ -1,4 +1,6 @@ - * @@ -23,6 +25,7 @@ namespace SearchDAV\XML; use Sabre\Xml\Reader; use Sabre\Xml\XmlDeserializable; + use function Sabre\Xml\Deserializer\keyValue; class Order implements XmlDeserializable { diff --git a/src/XML/PropDesc.php b/src/XML/PropDesc.php index 43ada6a..5eb461f 100644 --- a/src/XML/PropDesc.php +++ b/src/XML/PropDesc.php @@ -1,4 +1,6 @@ - * diff --git a/src/XML/QueryDiscoverResponse.php b/src/XML/QueryDiscoverResponse.php index 0d8b6a2..8aff073 100644 --- a/src/XML/QueryDiscoverResponse.php +++ b/src/XML/QueryDiscoverResponse.php @@ -1,4 +1,6 @@ - * @@ -23,6 +25,7 @@ namespace SearchDAV\XML; use Sabre\DAV\Xml\Element\Response; use Sabre\Xml\Writer; + use function Sabre\HTTP\encodePath; class QueryDiscoverResponse extends Response { diff --git a/src/XML/Scope.php b/src/XML/Scope.php index 90a2384..c425211 100644 --- a/src/XML/Scope.php +++ b/src/XML/Scope.php @@ -1,4 +1,6 @@ - * @@ -23,6 +25,7 @@ namespace SearchDAV\XML; use Sabre\Xml\Reader; use Sabre\Xml\XmlDeserializable; + use function Sabre\Xml\Deserializer\keyValue; class Scope extends \SearchDAV\Query\Scope implements XmlDeserializable { diff --git a/src/XML/SupportedQueryGrammar.php b/src/XML/SupportedQueryGrammar.php index a24e7b1..edd6588 100644 --- a/src/XML/SupportedQueryGrammar.php +++ b/src/XML/SupportedQueryGrammar.php @@ -1,4 +1,6 @@ - * @@ -25,7 +27,7 @@ use Sabre\Xml\Writer; use Sabre\Xml\XmlSerializable; class SupportedQueryGrammar implements XmlSerializable { - const GRAMMAR_BASIC_SEARCH = '{DAV:}basicsearch'; + public const GRAMMAR_BASIC_SEARCH = '{DAV:}basicsearch'; public function xmlSerialize(Writer $writer): void { $writer->startElement('{DAV:}supported-query-grammar'); diff --git a/tests/DummyBackend.php b/tests/DummyBackend.php index 822a392..e62e75b 100644 --- a/tests/DummyBackend.php +++ b/tests/DummyBackend.php @@ -1,4 +1,5 @@ * diff --git a/tests/PathHelperTest.php b/tests/PathHelperTest.php index e224ec4..79a923a 100644 --- a/tests/PathHelperTest.php +++ b/tests/PathHelperTest.php @@ -1,4 +1,5 @@ * diff --git a/tests/QueryParserTest.php b/tests/QueryParserTest.php index 84e6b8c..c47cd2e 100644 --- a/tests/QueryParserTest.php +++ b/tests/QueryParserTest.php @@ -1,4 +1,5 @@ * diff --git a/tests/SearchPluginTest.php b/tests/SearchPluginTest.php index 7ce28d6..33661d2 100644 --- a/tests/SearchPluginTest.php +++ b/tests/SearchPluginTest.php @@ -1,4 +1,5 @@ *