Skip to content

Commit

Permalink
Update to laminas/laminas-servicemanager:v3.21
Browse files Browse the repository at this point in the history
Signed-off-by: Filippo Tessarotto <zoeslam@gmail.com>
  • Loading branch information
Slamdunk committed May 22, 2023
1 parent 5b1ccda commit a259c78
Show file tree
Hide file tree
Showing 9 changed files with 175 additions and 179 deletions.
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,24 @@
"laminas/laminas-loader": "^2.9.0",
"laminas/laminas-mime": "^2.11.0",
"laminas/laminas-stdlib": "^3.17.0",
"laminas/laminas-validator": "^2.30.1",
"laminas/laminas-validator": "^2.31.0",
"symfony/polyfill-mbstring": "^1.27.0",
"webmozart/assert": "^1.11.0",
"symfony/polyfill-intl-idn": "^1.27.0"
},
"require-dev": {
"laminas/laminas-coding-standard": "~2.5.0",
"laminas/laminas-crypt": "^3.10.0",
"laminas/laminas-db": "^2.17",
"laminas/laminas-servicemanager": "^3.20",
"phpunit/phpunit": "^10.0.17",
"laminas/laminas-db": "^2.18",
"laminas/laminas-servicemanager": "^3.21",
"phpunit/phpunit": "^10.1.3",
"psalm/plugin-phpunit": "^0.18.4",
"symfony/process": "^6.2.7",
"vimeo/psalm": "^5.8"
"symfony/process": "^6.2.10",
"vimeo/psalm": "^5.11"
},
"suggest": {
"laminas/laminas-crypt": "^3.10 Crammd5 support in SMTP Auth",
"laminas/laminas-servicemanager": "^3.20 when using SMTP to deliver messages"
"laminas/laminas-servicemanager": "^3.21 when using SMTP to deliver messages"
},
"config": {
"sort-packages": true,
Expand Down
270 changes: 138 additions & 132 deletions composer.lock

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@
<group>disable</group>
</exclude>
</groups>
<coverage>
<include>
<directory suffix=".php">./src</directory>
</include>
</coverage>
<php>
<ini name="date.timezone" value="UTC"/>
<ini name="error_reporting" value="-1"/>
Expand Down Expand Up @@ -73,4 +68,9 @@
<env name="TESTS_LAMINAS_MAIL_SMTP_PASSWORD" value="testpassword"/>
<env name="TESTS_LAMINAS_MAIL_SMTP_AUTH" value="false"/>
</php>
<source>
<include>
<directory>./src</directory>
</include>
</source>
</phpunit>
35 changes: 8 additions & 27 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="5.8.0@9cf4f60a333f779ad3bc704a555920e81d4fdcda">
<files psalm-version="5.11.0@c9b192ab8400fdaf04b2b13d110575adc879aa90">
<file src="src/Address.php">
<DocblockTypeContradiction>
<code>! is_string($email)</code>
Expand Down Expand Up @@ -297,13 +297,12 @@
<code>is_array($headers)</code>
<code>is_string($headerFieldNameOrLine)</code>
</DocblockTypeContradiction>
<InvalidPropertyAssignmentValue>
<code><![CDATA[$this->headers]]></code>
<code><![CDATA[$this->headers]]></code>
</InvalidPropertyAssignmentValue>
<LessSpecificImplementedReturnType>
<code>mixed</code>
</LessSpecificImplementedReturnType>
<LessSpecificReturnStatement>
<code><![CDATA[$this->pluginClassLoader->load($key) ?: GenericHeader::class]]></code>
</LessSpecificReturnStatement>
<MixedArgument>
<code>$headers</code>
<code>$value</code>
Expand All @@ -325,7 +324,6 @@
<MixedAssignment>
<code>$current</code>
<code>$current</code>
<code>$header</code>
<code>$i</code>
<code>$index</code>
<code>$name</code>
Expand All @@ -336,10 +334,6 @@
<code>HeaderInterface</code>
<code>false|ArrayIterator|HeaderInterface</code>
</MixedInferredReturnType>
<MixedMethodCall>
<code>setEncoding</code>
<code>setEncoding</code>
</MixedMethodCall>
<MixedOperand>
<code>$i</code>
</MixedOperand>
Expand All @@ -349,6 +343,9 @@
<code>$results[0]</code>
<code>$results[0]</code>
</MixedReturnStatement>
<MoreSpecificReturnType>
<code><![CDATA[null|class-string<HeaderInterface>]]></code>
</MoreSpecificReturnType>
<PossiblyInvalidArgument>
<code><![CDATA[Header\GenericMultiHeader::fromString($headerFieldNameOrLine . ':' . $i)]]></code>
</PossiblyInvalidArgument>
Expand Down Expand Up @@ -612,7 +609,6 @@
<code>$endPos</code>
</PossiblyFalseOperand>
<PossiblyInvalidArgument>
<code>$string</code>
<code>$string</code>
<code><![CDATA[$this->escapeString($old, $new)]]></code>
<code><![CDATA[$this->escapeString($reference, $mailbox)]]></code>
Expand All @@ -629,7 +625,6 @@
<code>$tokens[2][3]</code>
</PossiblyInvalidArrayOffset>
<PossiblyInvalidCast>
<code>$string</code>
<code>$tokens</code>
</PossiblyInvalidCast>
<PossiblyNullArgument>
Expand Down Expand Up @@ -852,6 +847,7 @@
</MissingReturnType>
<NonInvariantDocblockPropertyType>
<code>$aliases</code>
<code>$factories</code>
<code>$instanceOf</code>
</NonInvariantDocblockPropertyType>
</file>
Expand Down Expand Up @@ -2307,9 +2303,6 @@
}
}]]></code>
</PropertyNotSetInConstructor>
<UnusedClosureParam>
<code>$type</code>
</UnusedClosureParam>
</file>
<file src="test/Protocol/HttpStatusService/index.php">
<ArgumentTypeCoercion>
Expand All @@ -2319,14 +2312,6 @@
<code><![CDATA[$_GET['sleep']]]></code>
</RiskyCast>
</file>
<file src="test/Protocol/ProtocolTraitTest.php">
<InvalidArgument>
<code>ProtocolTrait::class</code>
</InvalidArgument>
<UndefinedInterfaceMethod>
<code>getCryptoMethod</code>
</UndefinedInterfaceMethod>
</file>
<file src="test/Protocol/Smtp/Auth/Crammd5Test.php">
<MixedAssignment>
<code>$result</code>
Expand Down Expand Up @@ -3177,10 +3162,6 @@
</MixedInferredReturnType>
</file>
<file src="test/Transport/SmtpTest.php">
<DeprecatedMethod>
<code>setMethods</code>
<code>setMethods</code>
</DeprecatedMethod>
<MixedAssignment>
<code>$connectedTimeAfterFirstMail</code>
</MixedAssignment>
Expand Down
4 changes: 4 additions & 0 deletions src/Header/HeaderLocatorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
*/
interface HeaderLocatorInterface
{
/**
* @param class-string<HeaderInterface>|null $default
* @return class-string<HeaderInterface>|null
*/
public function get(string $name, ?string $default = null): ?string;

public function has(string $name): bool;
Expand Down
11 changes: 7 additions & 4 deletions src/Headers.php
Original file line number Diff line number Diff line change
Expand Up @@ -566,8 +566,9 @@ public function loadHeader($headerLine)
{
[$name] = GenericHeader::splitHeaderLine($headerLine);

/** @var HeaderInterface $class */
$class = $this->resolveHeaderClass($name);
assert(null !== $class);

return $class::fromString($headerLine);
}

Expand All @@ -581,16 +582,18 @@ protected function lazyLoadHeader($index)

$key = $this->headersKeys[$index];

/** @var GenericHeader $class */
$class = $this->resolveHeaderClass($key);
assert(null !== $class);

$encoding = $current->getEncoding();
$headers = $class::fromString($current->toString());
if (is_array($headers)) {
$current = array_shift($headers);
assert($current instanceof HeaderInterface);
$current->setEncoding($encoding);
$this->headers[$index] = $current;
foreach ($headers as $header) {
assert($header instanceof HeaderInterface);
$header->setEncoding($encoding);
$this->headersKeys[] = $key;
$this->headers[] = $header;
Expand All @@ -617,9 +620,9 @@ protected function normalizeFieldName($fieldName)

/**
* @param string $key
* @return null|string
* @return null|class-string<HeaderInterface>
*/
private function resolveHeaderClass($key)
private function resolveHeaderClass($key): ?string
{
if ($this->pluginClassLoader) {
return $this->pluginClassLoader->load($key) ?: GenericHeader::class;
Expand Down
4 changes: 2 additions & 2 deletions test/Header/HeaderLocatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public static function provideHeaderNames(): array
}

/**
* @param null|class-string $expected
* @param null|class-string $default
* @param null|class-string<Header\HeaderInterface> $expected
* @param null|class-string<Header\HeaderInterface> $default
* @dataProvider provideHeaderNames
*/
public function testHeaderIsProperlyLoaded(string $name, ?string $expected, ?string $default = null): void
Expand Down
4 changes: 3 additions & 1 deletion test/Protocol/ProtocolTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ class ProtocolTraitTest extends TestCase
{
public function testTls12Version(): void
{
$mock = $this->getMockForTrait(ProtocolTrait::class);
$mock = new class {
use ProtocolTrait;
};

$this->assertNotEmpty(
STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT & $mock->getCryptoMethod(),
Expand Down
2 changes: 1 addition & 1 deletion test/Protocol/SmtpPluginManagerCompatibilityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class SmtpPluginManagerCompatibilityTest extends TestCase
{
use CommonPluginManagerTrait;

protected function getPluginManager(): SmtpPluginManager
protected static function getPluginManager(): SmtpPluginManager
{
return new SmtpPluginManager(new ServiceManager());
}
Expand Down

0 comments on commit a259c78

Please sign in to comment.