Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ jobs:
run: composer run-script cs-check

- name: Run Static Analysis
run: |
composer run-script analyse
composer run-script analyse-tests
run: composer run-script analyse

- name: Run Test Coverage
run: composer run-script --timeout=0 test-coverage
Expand Down
6 changes: 2 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
"slevomat/coding-standard": "^7.2",
"phpstan/phpstan-phpunit": "^2.0",
"phpstan/extension-installer": "^1.4",
"swoole/ide-helper": "^6.0"
"swoole/ide-helper": "^6.0",
"shipmonk/dead-code-detector": "^1.2"
},
"minimum-stability": "dev",
"prefer-stable": true,
Expand Down Expand Up @@ -87,9 +88,6 @@
"analyse": [
"phpstan --memory-limit=-1 analyse"
],
"analyse-tests": [
"phpstan --memory-limit=-1 analyse -c phpstan.tests.neon"
],
"cs-check": [
"phpcs --standard=ruleset.xml --extensions=php --tab-width=4 -sp src --runtime-set ignore_warnings_on_exit 1",
"ecs check"
Expand Down
13 changes: 12 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
services:
-
class: Tests\Support\FreeDSx\Ldap\PhpStan\ApiMemberUsageProvider
tags:
- shipmonk.deadCode.memberUsageProvider

parameters:
level: 9
level: 10
paths:
- %currentWorkingDirectory%/src
- %currentWorkingDirectory%/tests
scanDirectories:
- %currentWorkingDirectory%/vendor/swoole/ide-helper/src
treatPhpDocTypesAsCertain: false
reportUnmatchedIgnoredErrors: false
ignoreErrors:
- '#Unsafe usage of new static\(\).#'
shipmonkDeadCode:
usageProviders:
phpunit:
enabled: true
5 changes: 0 additions & 5 deletions phpstan.tests.neon

This file was deleted.

3 changes: 3 additions & 0 deletions src/FreeDSx/Ldap/ClientOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@

use FreeDSx\Ldap\Control\ControlBag;

/**
* @api
*/
final class ClientOptions
{
private int $version = 3;
Expand Down
7 changes: 7 additions & 0 deletions src/FreeDSx/Ldap/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,13 @@ public function get(string $className): object
}

$instance = ($this->instanceFactory[$className])();
if (!$instance instanceof $className) {
throw new RuntimeException(sprintf(
'The factory for "%s" did not return the expected type.',
$className,
));
}

if (!in_array($className, self::FACTORY_ONLY, true)) {
$this->instances[$className] = $instance;
}
Expand Down
2 changes: 2 additions & 0 deletions src/FreeDSx/Ldap/Control/Ad/DirSyncRequestControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
* Cookie OCTET STRING
* }
*
* @api
*
* @see https://msdn.microsoft.com/en-us/library/cc223347.aspx
* @author Chad Sikorra <Chad.Sikorra@gmail.com>
*/
Expand Down
2 changes: 2 additions & 0 deletions src/FreeDSx/Ldap/Control/Ad/DirSyncResponseControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
* CookieServer OCTET STRING
* }
*
* @api
*
* @see https://msdn.microsoft.com/en-us/library/cc223347.aspx
* @author Chad Sikorra <Chad.Sikorra@gmail.com>
*/
Expand Down
2 changes: 2 additions & 0 deletions src/FreeDSx/Ldap/Control/Ad/ExpectedEntryCountControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
* searchEntriesMax INTEGER
* }
*
* @api
*
* @see https://msdn.microsoft.com/en-us/library/jj216720.aspx
* @author Chad Sikorra <Chad.Sikorra@gmail.com>
*/
Expand Down
2 changes: 2 additions & 0 deletions src/FreeDSx/Ldap/Control/Ad/ExtendedDnControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
/**
* Used to represent the Extended DN control.
*
* @api
*
* @see https://msdn.microsoft.com/en-us/library/cc223349.aspx
* @author Chad Sikorra <Chad.Sikorra@gmail.com>
*/
Expand Down
2 changes: 2 additions & 0 deletions src/FreeDSx/Ldap/Control/Ad/PolicyHintsControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
* Flags INTEGER
* }
*
* @api
*
* @see https://msdn.microsoft.com/en-us/library/hh128228.aspx
* @author Chad Sikorra <Chad.Sikorra@gmail.com>
*/
Expand Down
2 changes: 2 additions & 0 deletions src/FreeDSx/Ldap/Control/Ad/SdFlagsControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* Flags INTEGER
* }
*
* @api
*
* @see https://msdn.microsoft.com/en-us/library/cc223323.aspx
* @author Chad Sikorra <Chad.Sikorra@gmail.com>
*/
Expand Down
2 changes: 2 additions & 0 deletions src/FreeDSx/Ldap/Control/Ad/SetOwnerControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
*
* SID octetString
*
* @api
*
* https://msdn.microsoft.com/en-us/library/dn392490.aspx
* @author Chad Sikorra <Chad.Sikorra@gmail.com>
*/
Expand Down
2 changes: 2 additions & 0 deletions src/FreeDSx/Ldap/Control/AssertionControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
*
* The operation proceeds only if the filter matches the target entry.
*
* @api
*
* @author Chad Sikorra <Chad.Sikorra@gmail.com>
*/
class AssertionControl extends Control
Expand Down
2 changes: 2 additions & 0 deletions src/FreeDSx/Ldap/Control/Control.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
* criticality BOOLEAN DEFAULT FALSE,
* controlValue OCTET STRING OPTIONAL }
*
* @api
*
* @author Chad Sikorra <Chad.Sikorra@gmail.com>
*/
class Control implements ProtocolElementInterface, Stringable
Expand Down
2 changes: 2 additions & 0 deletions src/FreeDSx/Ldap/Control/ControlBag.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
/**
* Represents a set of controls.
*
* @api
*
* @implements IteratorAggregate<Control>
* @author Chad Sikorra <Chad.Sikorra@gmail.com>
*/
Expand Down
2 changes: 2 additions & 0 deletions src/FreeDSx/Ldap/Control/PagingControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
* -- result set size estimate from server
* cookie OCTET STRING }
*
* @api
*
* @author Chad Sikorra <Chad.Sikorra@gmail.com>
*/
class PagingControl extends Control
Expand Down
2 changes: 2 additions & 0 deletions src/FreeDSx/Ldap/Control/ProxyAuthorizationControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
/**
* Represents a proxied authorization control. RFC 4370.
*
* @api
*
* @author Chad Sikorra <Chad.Sikorra@gmail.com>
*/
final class ProxyAuthorizationControl extends Control
Expand Down
2 changes: 2 additions & 0 deletions src/FreeDSx/Ldap/Control/PwdPolicyResponseControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
* passwordTooYoung (7),
* passwordInHistory (8) } OPTIONAL }
*
* @api
*
* @author Chad Sikorra <Chad.Sikorra@gmail.com>
*/
class PwdPolicyResponseControl extends Control
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
*
* Carries the entry state as a SearchResultEntry.
*
* @api
*
* @author Chad Sikorra <Chad.Sikorra@gmail.com>
*/
abstract class ReadEntryResponseControl extends Control
Expand Down
2 changes: 2 additions & 0 deletions src/FreeDSx/Ldap/Control/Sorting/SortKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
/**
* Represents a server side sorting request SortKey.
*
* @api
*
* @author Chad Sikorra <Chad.Sikorra@gmail.com>
*/
class SortKey
Expand Down
2 changes: 2 additions & 0 deletions src/FreeDSx/Ldap/Control/Sorting/SortingControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
* orderingRule [0] MatchingRuleId OPTIONAL,
* reverseOrder [1] BOOLEAN DEFAULT FALSE }
*
* @api
*
* @author Chad Sikorra <Chad.Sikorra@gmail.com>
*/
class SortingControl extends Control
Expand Down
2 changes: 2 additions & 0 deletions src/FreeDSx/Ldap/Control/Sorting/SortingResponseControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
* },
* attributeType [0] AttributeDescription OPTIONAL }
*
* @api
*
* @author Chad Sikorra <Chad.Sikorra@gmail.com>
*/
class SortingResponseControl extends Control
Expand Down
2 changes: 2 additions & 0 deletions src/FreeDSx/Ldap/Control/SubentriesControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
/**
* Represents a subentries control. RFC 3672.
*
* @api
*
* @author Chad Sikorra <Chad.Sikorra@gmail.com>
*/
class SubentriesControl extends Control
Expand Down
2 changes: 2 additions & 0 deletions src/FreeDSx/Ldap/Control/Sync/SyncDoneControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
* refreshDeletes BOOLEAN DEFAULT FALSE
* }
*
* @api
*
* @author Chad Sikorra <Chad.Sikorra@gmail.com
* @see https://tools.ietf.org/html/rfc4533
*/
Expand Down
2 changes: 2 additions & 0 deletions src/FreeDSx/Ldap/Control/Sync/SyncRequestControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
* reloadHint BOOLEAN DEFAULT FALSE
* }
*
* @api
*
* @author Chad Sikorra <Chad.Sikorra@gmail.com
* @see https://tools.ietf.org/html/rfc4533
*/
Expand Down
2 changes: 2 additions & 0 deletions src/FreeDSx/Ldap/Control/Sync/SyncStateControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
* cookie syncCookie OPTIONAL
* }
*
* @api
*
* @author Chad Sikorra <Chad.Sikorra@gmail.com
* @see https://tools.ietf.org/html/rfc4533
*/
Expand Down
2 changes: 2 additions & 0 deletions src/FreeDSx/Ldap/Control/Vlv/VlvControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
* greaterThanOrEqual [1] AssertionValue },
* contextID OCTET STRING OPTIONAL }
*
* @api
*
* @author Chad Sikorra <Chad.Sikorra@gmail.com>
*/
class VlvControl extends Control
Expand Down
2 changes: 2 additions & 0 deletions src/FreeDSx/Ldap/Control/Vlv/VlvResponseControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
* ... },
* contextID OCTET STRING OPTIONAL }
*
* @api
*
* @author Chad Sikorra <Chad.Sikorra@gmail.com>
*/
class VlvResponseControl extends Control
Expand Down
2 changes: 2 additions & 0 deletions src/FreeDSx/Ldap/Controls.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
/**
* Provides some simple factory methods for building controls.
*
* @api
*
* @author Chad Sikorra <Chad.Sikorra@gmail.com>
*/
class Controls
Expand Down
2 changes: 2 additions & 0 deletions src/FreeDSx/Ldap/Entry/Attribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
/**
* Represents an entry attribute and any values.
*
* @api
*
* @implements IteratorAggregate<int|string, string>
* @author Chad Sikorra <Chad.Sikorra@gmail.com>
*/
Expand Down
2 changes: 2 additions & 0 deletions src/FreeDSx/Ldap/Entry/Change.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
/**
* Represents an entry change.
*
* @api
*
* @author Chad Sikorra <Chad.Sikorra@gmail.com>
*/
class Change
Expand Down
2 changes: 2 additions & 0 deletions src/FreeDSx/Ldap/Entry/Changes.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
/**
* Represents a set of change objects.
*
* @api
*
* @implements IteratorAggregate<Change>
* @author Chad Sikorra <Chad.Sikorra@gmail.com>
*/
Expand Down
2 changes: 2 additions & 0 deletions src/FreeDSx/Ldap/Entry/Entries.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
/**
* Represents a collection of entry objects.
*
* @api
*
* @author Chad Sikorra <Chad.Sikorra@gmail.com>
*
* @implements IteratorAggregate<Entry>
Expand Down
2 changes: 2 additions & 0 deletions src/FreeDSx/Ldap/Entry/Entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
/**
* Represents an Entry in LDAP.
*
* @api
*
* @implements IteratorAggregate<Attribute>
* @author Chad Sikorra <Chad.Sikorra@gmail.com>
*/
Expand Down
4 changes: 4 additions & 0 deletions src/FreeDSx/Ldap/Entry/EscapeTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,16 @@
/**
* Some common methods around escaping attribute values and RDN values.
*
* @api
*
* @author Chad Sikorra <Chad.Sikorra@gmail.com>
*/
trait EscapeTrait
{
/**
* Escape all characters in a value.
*
* @api
*/
public static function escapeAll(string $value): string
{
Expand Down
2 changes: 2 additions & 0 deletions src/FreeDSx/Ldap/Entry/Option.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
/**
* Represents an attribute option. Described in RFC 4512, Section 2.5.2.
*
* @api
*
* @author Chad Sikorra <Chad.Sikorra@gmail.com>
*/
class Option implements Stringable
Expand Down
2 changes: 2 additions & 0 deletions src/FreeDSx/Ldap/Entry/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
/**
* Represents a collection of attribute options.
*
* @api
*
* @implements IteratorAggregate<Option>
* @author Chad Sikorra <Chad.Sikorra@gmail.com>
*/
Expand Down
2 changes: 2 additions & 0 deletions src/FreeDSx/Ldap/Entry/Rdn.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
/**
* Represents a Relative Distinguished Name.
*
* @api
*
* @author Chad Sikorra <Chad.Sikorra@gmail.com>
*/
class Rdn implements Stringable
Expand Down
2 changes: 2 additions & 0 deletions src/FreeDSx/Ldap/Exception/LdifParseException.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
/**
* Represents an issue encountered while parsing LDIF.
*
* @api
*
* @author Chad Sikorra <Chad.Sikorra@gmail.com>
*/
class LdifParseException extends Exception
Expand Down
Loading
Loading