Skip to content

Commit 57a22dc

Browse files
committed
PHP 8.4 compat
1 parent 7854e7c commit 57a22dc

15 files changed

+37
-48
lines changed

src/Adapters/AdapterTrait.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,18 @@ trait AdapterTrait
4646

4747
/**
4848
* Set working component
49-
* @param object $component
49+
* @param AnnotatedInterface|null $component
5050
*/
51-
public function setComponent(AnnotatedInterface $component = null)
51+
public function setComponent(?AnnotatedInterface $component = null)
5252
{
5353
$this->component = $component;
5454
}
5555

5656
/**
5757
* Set meta options
58-
* @param MetaOptions $options
58+
* @param MetaOptions|null $options
5959
*/
60-
public function setOptions(MetaOptions $options = null)
60+
public function setOptions(?MetaOptions $options = null)
6161
{
6262
$this->options = $options;
6363
}

src/Builder/Builder.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,10 @@ class Builder
5959
*/
6060
private $buildCache = null;
6161

62-
public function __construct(Addendum $addendum = null)
62+
/**
63+
* @param Addendum|null $addendum
64+
*/
65+
public function __construct(?Addendum $addendum = null)
6366
{
6467
$this->addendum = $addendum ?: new Addendum();
6568
$this->buildCache = new BuildOneCache(static::class, null, $this->addendum);

src/Cache/ClassCache.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public function set($className, $data): bool
135135
return $this->writer->write($className, $data);
136136
}
137137

138-
public function setOptions(MetaOptions $options = null)
138+
public function setOptions(?MetaOptions $options = null)
139139
{
140140
$instanceId = $this->getInstanceId($options);
141141
$this->addendum = Addendum::fly($instanceId);
@@ -148,7 +148,7 @@ public function setOptions(MetaOptions $options = null)
148148
$this->nsCache->setOptions($options);
149149
}
150150

151-
private function getInstanceId(MetaOptions $options = null)
151+
private function getInstanceId(?MetaOptions $options = null)
152152
{
153153
if ($options === null)
154154
{

src/Cache/FlyCache.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class FlyCache
4040
* @param MetaOptions $options
4141
* @return ClassCache
4242
*/
43-
public static function instance($metaClass = null, $component = null, MetaOptions $options = null)
43+
public static function instance($metaClass = null, $component = null, ?MetaOptions $options = null)
4444
{
4545
if (empty($options))
4646
{

src/Cache/NsCache.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@ class NsCache
6363
*/
6464
public static $addedNs = true;
6565

66-
public function __construct($path, Addendum $addendum, MetaOptions $options = null)
66+
public function __construct($path, Addendum $addendum, ?MetaOptions $options = null)
6767
{
6868
$this->file = sprintf('%s/%s', $path, self::FileName);
6969
$this->namespaces = $addendum->nameKeys;
7070
$this->ad = $addendum;
7171
$this->setOptions($options);
7272
}
7373

74-
public function setOptions(MetaOptions $options = null)
74+
public function setOptions(?MetaOptions $options = null)
7575
{
7676
if ($options !== null && !empty($options->namespaces))
7777
{

src/Cache/PhpCache.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public function setComponent($component = null)
137137
$this->component = $component;
138138
}
139139

140-
public function setOptions(MetaOptions $options = null)
140+
public function setOptions(?MetaOptions $options = null)
141141
{
142142
$this->fileName = null;
143143
$this->nsCache->setOptions($options);
@@ -375,10 +375,10 @@ private function getCacheKey(): string
375375

376376
/**
377377
* Convert slash separated class name to dot separated name.
378-
* @param string $className
378+
* @param string|null $className
379379
* @return string
380380
*/
381-
private function classToFile(string $className = null): string
381+
private function classToFile(?string $className = null): string
382382
{
383383
return str_replace('\\', '.', (string)$className);
384384
}

src/Collections/Meta.php

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
use Maslosoft\Addendum\Reflection\ReflectionAnnotatedMethod;
2525
use Maslosoft\Addendum\Reflection\ReflectionAnnotatedProperty;
2626
use Maslosoft\Addendum\Utilities\IgnoredChecker;
27+
use ReflectionException;
2728
use ReflectionMethod;
2829
use ReflectionProperty;
2930

@@ -71,11 +72,11 @@ class Meta
7172
public static $addNs = false;
7273

7374
/**
74-
* @param string|object|AnnotatedInterface $model
75-
* @param MetaOptions $options
76-
* @throws Exception
75+
* @param null $model
76+
* @param MetaOptions|null $options
77+
* @throws ReflectionException
7778
*/
78-
protected function __construct($model = null, MetaOptions $options = null)
79+
protected function __construct($model = null, ?MetaOptions $options = null)
7980
{
8081
// For internal use
8182
if (null === $model)
@@ -256,7 +257,7 @@ public static function __set_state($data)
256257
* @param MetaOptions|null $options
257258
* @return static
258259
*/
259-
public static function create($model, MetaOptions $options = null)
260+
public static function create($model, ?MetaOptions $options = null)
260261
{
261262
// Reset local cache if dynamically added namespace
262263
if (self::$addNs)
@@ -320,22 +321,6 @@ public function properties($fieldName, $type = Meta::Field)
320321
return $result;
321322
}
322323

323-
/**
324-
* Get fields annotations for selected field or for all fields
325-
* @param string $fieldName
326-
* @return mixed[]
327-
* @todo Remove this
328-
* @deprecated since version number
329-
*/
330-
public function annotations($fieldName = null)
331-
{
332-
if ($fieldName)
333-
{
334-
return $this->_annotations[$fieldName];
335-
}
336-
return $this->_annotations;
337-
}
338-
339324
/**
340325
* Get class metadata
341326
* @return MetaType

src/Collections/MetaMethod.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ class MetaMethod implements AnnotationEntityInterface
4848

4949
/**
5050
* Class constructor, set some basic metadata
51-
* @param ReflectionMethod $info
51+
* @param ReflectionMethod|null $info
5252
*/
53-
public function __construct(ReflectionMethod $info = null)
53+
public function __construct(?ReflectionMethod $info = null)
5454
{
5555
// For internal use
5656
if (null === $info)

src/Collections/MetaProperty.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ class MetaProperty implements AnnotationEntityInterface
8282

8383
/**
8484
* Class constructor, sets some basic data for field
85-
* @param ReflectionProperty $info
85+
* @param ReflectionProperty|null $info
8686
*/
87-
public function __construct(ReflectionProperty $info = null)
87+
public function __construct(?ReflectionProperty $info = null)
8888
{
8989
// For internal use
9090
if (null === $info)

src/Collections/MetaType.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ class MetaType implements AnnotationEntityInterface
3636

3737
/**
3838
* Class constructor, set some basic metadata
39-
* @param ReflectionClass $info
39+
* @param ReflectionClass|null $info
4040
*/
41-
public function __construct(ReflectionClass $info = null)
41+
public function __construct(?ReflectionClass $info = null)
4242
{
4343
// For internal use
4444
if (null === $info)

0 commit comments

Comments
 (0)