Skip to content

Commit d825faa

Browse files
committed
Merge branch 'develop'
2 parents 9e59f58 + e39ab74 commit d825faa

13 files changed

+61
-138
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/vendor/
2+
.idea
23
.phpcs-cache
34
composer.lock
45
index.php

ConverterAware.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
* Qubus\Inheritance
55
*
66
* @link https://github.com/QubusPHP/inheritance
7-
* @copyright 2021 Joshua Parker <[email protected]>
7+
* @copyright 2022
8+
* @author Joshua Parker <[email protected]>
89
* @license https://opensource.org/licenses/mit-license.php MIT License
910
*
10-
* @since 1.0.0
11+
* @since 2.0.1
1112
*/
1213

1314
declare(strict_types=1);
@@ -25,7 +26,7 @@ trait ConverterAware
2526
* @param array $array Array of data.
2627
* @return object
2728
*/
28-
public function toObject(array $array)
29+
public function toObject(array $array): object
2930
{
3031
foreach ($array as $key => $value) {
3132
if (is_array($value)) {

Helpers/core.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
* Qubus\Inheritance
55
*
66
* @link https://github.com/QubusPHP/inheritance
7-
* @copyright 2022 Joshua Parker <[email protected]>
7+
* @copyright 2022
8+
* @author Joshua Parker <[email protected]>
89
* @license https://opensource.org/licenses/mit-license.php MIT License
910
*
1011
* @since 2.0.1
@@ -19,7 +20,9 @@
1920
/**
2021
* Call the given callable with the given value then return the value.
2122
*
22-
* @param callable|null $callable
23+
* @param mixed $value
24+
* @param callable|null $callback
25+
* @return mixed
2326
*/
2427
function tap(mixed $value, ?callable $callback = null): mixed
2528
{

InvokerAware.php

+9-5
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,19 @@
44
* Qubus\Inheritance
55
*
66
* @link https://github.com/QubusPHP/inheritance
7-
* @copyright 2021 Joshua Parker <[email protected]>
7+
* @copyright 2022
8+
* @author Joshua Parker <[email protected]>
89
* @license https://opensource.org/licenses/mit-license.php MIT License
910
*
10-
* @since 2.0.0
11+
* @since 2.0.1
1112
*/
1213

1314
declare(strict_types=1);
1415

1516
namespace Qubus\Inheritance;
1617

18+
use Closure;
19+
1720
use function call_user_func_array;
1821
use function ob_get_clean;
1922
use function ob_start;
@@ -23,11 +26,12 @@ trait InvokerAware
2326
/**
2427
* Call the given Closure with buffering support.
2528
*
26-
* @param callable|Closure $closure
27-
* @param array $parameters
29+
* @param callable|Closure $closure
30+
* @param array $parameters
31+
* @param bool $buffer
2832
* @return mixed
2933
*/
30-
public function call($closure, array $parameters = [], bool $buffer = false)
34+
public function call(callable|Closure $closure, array $parameters = [], bool $buffer = false): mixed
3135
{
3236
if ($buffer) {
3337
ob_start();

MultitonAware.php

+10-2
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,35 @@
44
* Qubus\Inheritance
55
*
66
* @link https://github.com/QubusPHP/inheritance
7-
* @copyright 2021 Joshua Parker <[email protected]>
7+
* @copyright 2022
8+
* @author Joshua Parker <[email protected]>
89
* @license https://opensource.org/licenses/mit-license.php MIT License
910
*
10-
* @since 1.0.0
11+
* @since 2.0.1
1112
*/
1213

1314
declare(strict_types=1);
1415

1516
namespace Qubus\Inheritance;
1617

1718
use ReflectionClass;
19+
use ReflectionException;
1820

1921
trait MultitonAware
2022
{
2123
use StaticProxyAware;
2224

25+
/**
26+
* @throws ReflectionException
27+
*/
2328
public static function getInstance()
2429
{
2530
return static::getNamedInstance();
2631
}
2732

33+
/**
34+
* @throws ReflectionException
35+
*/
2836
public static function getNamedInstance($key = '__DEFAULT__')
2937
{
3038
if (! isset(static::$instance[$key])) {

Proxy/TapProxy.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
* Qubus\Inheritance
55
*
66
* @link https://github.com/QubusPHP/inheritance
7-
* @copyright 2022 Joshua Parker <[email protected]>
7+
* @copyright 2022
8+
* @author Joshua Parker <[email protected]>
89
* @license https://opensource.org/licenses/mit-license.php MIT License
910
*
1011
* @since 2.0.1

SortCallbackAware.php

+5-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
* Qubus\Inheritance
55
*
66
* @link https://github.com/QubusPHP/inheritance
7-
* @copyright 2021 Joshua Parker <[email protected]>
7+
* @copyright 2022
8+
* @author Joshua Parker <[email protected]>
89
* @license https://opensource.org/licenses/mit-license.php MIT License
910
*
10-
* @since 1.0.0
11+
* @since 2.0.1
1112
*/
1213

1314
declare(strict_types=1);
@@ -21,9 +22,9 @@ trait SortCallbackAware
2122
*
2223
* @param array $a Action or Filter.
2324
* @param array $b Action or Filter.
24-
* @return int Comparision
25+
* @return int Comparison
2526
*/
26-
protected function afsort(array $a, array $b)
27+
protected function afsort(array $a, array $b): int
2728
{
2829
if (isset($a['priority']) && isset($b['priority'])) {
2930
$priority1 = (int) $a['priority'];

StaticProxyAware.php

+7-4
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,19 @@
44
* Qubus\Inheritance
55
*
66
* @link https://github.com/QubusPHP/inheritance
7-
* @copyright 2021 Joshua Parker <[email protected]>
7+
* @copyright 2022
8+
* @author Joshua Parker <[email protected]>
89
* @license https://opensource.org/licenses/mit-license.php MIT License
910
*
10-
* @since 1.0.0
11+
* @since 2.0.1
1112
*/
1213

1314
declare(strict_types=1);
1415

1516
namespace Qubus\Inheritance;
1617

1718
use ReflectionClass;
19+
use ReflectionException;
1820
use RuntimeException;
1921

2022
trait StaticProxyAware
@@ -30,8 +32,9 @@ trait StaticProxyAware
3032
* Creates the original or retrieves the stored singleton instance.
3133
*
3234
* @return self
35+
* @throws ReflectionException
3336
*/
34-
public static function getInstance()
37+
public static function getInstance(): static
3538
{
3639
if (! static::$instance) {
3740
static::$instance = (new ReflectionClass(static::class))
@@ -44,7 +47,7 @@ public static function getInstance()
4447
/**
4548
* Reset the Container instance.
4649
*/
47-
public static function resetInstance()
50+
public static function resetInstance(): void
4851
{
4952
if (self::$instance) {
5053
self::$instance = null;

TapAware.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
* Qubus\Inheritance
55
*
66
* @link https://github.com/QubusPHP/inheritance
7-
* @copyright 2022 Joshua Parker <[email protected]>
7+
* @copyright 2022
8+
* @author Joshua Parker <[email protected]>
89
* @license https://opensource.org/licenses/mit-license.php MIT License
910
*
1011
* @since 2.0.1
@@ -21,7 +22,9 @@ trait TapAware
2122
/**
2223
* Call the given callable with the given value then return the value.
2324
*
24-
* @param callable|null $callable
25+
* @param mixed $value
26+
* @param callable|null $callback
27+
* @return mixed
2528
*/
2629
protected function tap(mixed $value, ?callable $callback = null): mixed
2730
{

TapObjectAware.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
* Qubus\Inheritance
55
*
66
* @link https://github.com/QubusPHP/inheritance
7-
* @copyright 2022 Joshua Parker <[email protected]>
7+
* @copyright 2022
8+
* @author Joshua Parker <[email protected]>
89
* @license https://opensource.org/licenses/mit-license.php MIT License
910
*
1011
* @since 2.0.1
@@ -21,7 +22,8 @@ trait TapObjectAware
2122
/**
2223
* Call the given callable with $this object then return the value.
2324
*
24-
* @param callable|null $callable
25+
* @param callable|null $callback
26+
* @return mixed
2527
*/
2628
public function tap(?callable $callback = null): mixed
2729
{

VERSION.md

-1
This file was deleted.

composer.json

+7-4
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@
77
"authors": [
88
{
99
"name": "Joshua Parker",
10-
"email": "josh@joshuaparker.blog"
10+
"email": "joshua@joshuaparker.dev"
1111
}
1212
],
1313
"support": {
1414
"issues": "https://github.com/QubusPHP/inheritance/issues"
1515
},
1616
"require": {
17-
"php": ">=8.1"
17+
"php": ">=8.2"
1818
},
1919
"require-dev": {
20-
"laminas/laminas-coding-standard": "^2.0",
20+
"qubus/qubus-coding-standard": "^1.1",
2121
"squizlabs/php_codesniffer": "^3.5"
2222
},
2323
"autoload": {
@@ -34,6 +34,9 @@
3434
},
3535
"config": {
3636
"optimize-autoloader": true,
37-
"sort-packages": true
37+
"sort-packages": true,
38+
"allow-plugins": {
39+
"dealerdirect/phpcodesniffer-composer-installer": true
40+
}
3841
}
3942
}

phpcs.xml

+2-108
Original file line numberDiff line numberDiff line change
@@ -22,112 +22,6 @@
2222
<file>./TapAware.php</file>
2323
<file>./TapObjectAware.php</file>
2424

25-
<!-- Additional QubusPHP Coding Standard rules. -->
26-
27-
<!-- File names should be lowercased and class names should be uppercase. -->
28-
<rule ref="Generic.Files.LowercasedFilename">
29-
<exclude name="Generic.Files.LowercasedFilename.NotFound"/>
30-
</rule>
31-
<rule ref="SlevomatCodingStandard.Files.TypeNameMatchesFileName">
32-
<exclude name="SlevomatCodingStandard.Files.TypeNameMatchesFileName.NoMatchBetweenTypeNameAndFileName"/>
33-
</rule>
34-
35-
<!-- A cast statement MUST NOT be preceeded by a single space. -->
36-
<rule ref="Generic.Formatting.SpaceBeforeCast">
37-
<exclude name="Generic.Formatting.SpaceBeforeCast.NoSpace"/>
38-
</rule>
39-
40-
<!-- The Short array syntax MUST be used-->
41-
<rule ref="Generic.Arrays.DisallowShortArraySyntax">
42-
<exclude name="Generic.Arrays.DisallowShortArraySyntax.Found"/>
43-
</rule>
44-
45-
<!-- Opening brace must be on a new line. -->
46-
<rule ref="Generic.Classes.OpeningBraceSameLine">
47-
<exclude name="Generic.Classes.OpeningBraceSameLine.BraceOnNewLine"/>
48-
</rule>
49-
50-
<!-- Opening brace should be on a new line after declaration. -->
51-
<rule ref="Generic.Functions.OpeningFunctionBraceKernighanRitchie">
52-
<exclude name="Generic.Functions.OpeningFunctionBraceKernighanRitchie.BraceOnNewLine"/>
53-
</rule>
54-
55-
<!-- Constants true, false and null MUST be lowercase. -->
56-
<rule ref="Generic.PHP.UpperCaseConstant">
57-
<exclude name="Generic.PHP.UpperCaseConstant.Found"/>
58-
</rule>
59-
<rule ref="Generic.PHP.LowerCaseConstant"/>
60-
61-
<!-- There MUST be at least one space on either side of an equals sign used
62-
to assign a value to a variable. In case of a block of related
63-
assignments, more spaces MUST NOT be inserted before the equal sign. -->
64-
<rule ref="Generic.Formatting.MultipleStatementAlignment">
65-
<exclude name="Generic.Formatting.MultipleStatementAlignment.NotSame"/>
66-
<properties>
67-
<property name="error" value="true"/>
68-
<property name="maxPadding" value="50"/>
69-
</properties>
70-
</rule>
71-
72-
<!-- Code MUST use an indent of 4 spaces for each indent level, and MUST
73-
NOT use tabs for indenting. If tabs are use, indent with 4 spaces. -->
74-
<rule ref="Generic.WhiteSpace.ScopeIndent">
75-
<properties>
76-
<property name="indent" value="4"/>
77-
<property name="exact" value="true"/>
78-
<property name="tabIndent" value="true"/>
79-
<property name="--tab-width" value="4"/>
80-
</properties>
81-
</rule>
82-
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent">
83-
<exclude name="Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed"/>
84-
</rule>
85-
86-
<!-- Abstract classes MUST NOT have an `Abstract` prefix/suffix. -->
87-
<rule ref="WebimpressCodingStandard.NamingConventions.AbstractClass">
88-
<exclude name="WebimpressCodingStandard.NamingConventions.AbstractClass.Prefix"/>
89-
<exclude name="WebimpressCodingStandard.NamingConventions.AbstractClass.Suffix"/>
90-
</rule>
91-
<rule ref="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming"/>
92-
93-
<!-- Exception classes MUST have an `Exception` suffix. -->
94-
<rule ref="SlevomatCodingStandard.Classes.SuperfluousExceptionNaming">
95-
<exclude name="SlevomatCodingStandard.Classes.SuperfluousExceptionNaming.SuperfluousSuffix"/>
96-
</rule>
97-
<rule ref="WebimpressCodingStandard.NamingConventions.Exception"/>
98-
99-
<!-- Interface classes MUST NOT have an `Interface` prefix/suffix. -->
100-
<rule ref="WebimpressCodingStandard.NamingConventions.Interface">
101-
<exclude name="WebimpressCodingStandard.NamingConventions.Interface.Prefix"/>
102-
<exclude name="WebimpressCodingStandard.NamingConventions.Interface.Suffix"/>
103-
</rule>
104-
<rule ref="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming"/>
105-
106-
<!-- Trait classes MUST NOT have a `Trait` prefix/suffix. -->
107-
<rule ref="WebimpressCodingStandard.NamingConventions.Trait">
108-
<exclude name="WebimpressCodingStandard.NamingConventions.Trait.Prefix"/>
109-
<exclude name="WebimpressCodingStandard.NamingConventions.Trait.Suffix"/>
110-
</rule>
111-
<rule ref="SlevomatCodingStandard.Classes.SuperfluousTraitNaming"/>
112-
113-
<!-- The Yoda comparison CAN be used. -->
114-
<rule ref="SlevomatCodingStandard.ControlStructures.DisallowYodaComparison">
115-
<exclude name="SlevomatCodingStandard.ControlStructures.DisallowYodaComparison.DisallowedYodaComparison"/>
116-
</rule>
117-
118-
<!-- @author and @copyright Annotations can be used. -->
119-
<rule ref="SlevomatCodingStandard.Commenting.ForbiddenAnnotations">
120-
<exclude name="SlevomatCodingStandard.Commenting.ForbiddenAnnotations"/>
121-
</rule>
122-
123-
<!-- File names should be lowercased and class names should be uppercase. -->
124-
<rule ref="Generic.Files.LowercasedFilename">
125-
<exclude name="Generic.Files.LowercasedFilename.NotFound"/>
126-
</rule>
127-
<rule ref="SlevomatCodingStandard.Files.TypeNameMatchesFileName">
128-
<exclude name="SlevomatCodingStandard.Files.TypeNameMatchesFileName.NoMatchBetweenTypeNameAndFileName"/>
129-
</rule>
130-
131-
<!-- Include the rest of the rules from the Laminas Coding Standard -->
132-
<rule ref="LaminasCodingStandard"/>
25+
<!-- Include rules from the Qubus Coding Standard -->
26+
<rule ref="QubusCodingStandard"/>
13327
</ruleset>

0 commit comments

Comments
 (0)