Skip to content

Commit e3bc2d8

Browse files
committed
Deprecated FileResource::changeDetector()
1 parent dfe9374 commit e3bc2d8

3 files changed

Lines changed: 7 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## 0.3.0
8+
## 0.3.1
99

1010
- Implemented `getType()`, `getReturnType()`, `getTentativeReturnType()`, `hasTentativeReturnType()`, `hasReturnType()`.
11+
- Deprecated `FileResource::changeDetector()`.

FileResource.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,13 @@ public function contents(): string
5454
}
5555

5656
/**
57+
* @deprecated will be removed in 0.4.0
5758
* @throws FileNotReadable
5859
*/
5960
public function changeDetector(): ChangeDetector
6061
{
62+
trigger_deprecation('typhoon/reflection', '0.3.1', 'Method %s() is deprecated and will be removed on 0.4.0.', __METHOD__);
63+
6164
return $this->changeDetector ??= ChangeDetector::fromFileContents($this->file, $this->contents());
6265
}
6366

PhpParserReflector/ContextualPhpParserReflector.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use PHPStan\PhpDocParser\Ast\Type\UnionTypeNode;
1414
use Typhoon\Reflection\FileResource;
1515
use Typhoon\Reflection\Metadata\AttributeMetadata;
16+
use Typhoon\Reflection\Metadata\ChangeDetector;
1617
use Typhoon\Reflection\Metadata\ClassConstantMetadata;
1718
use Typhoon\Reflection\Metadata\ClassMetadata;
1819
use Typhoon\Reflection\Metadata\InheritedName;
@@ -82,7 +83,7 @@ trait: $trait,
8283
return new ClassMetadata(
8384
name: $name,
8485
modifiers: ClassReflections::modifiers($node),
85-
changeDetector: $this->file->changeDetector(),
86+
changeDetector: ChangeDetector::fromFileContents($this->file->file, $this->file->contents()),
8687
internal: $this->file->isInternal(),
8788
extension: $this->file->extension,
8889
file: $this->file->isInternal() ? false : $this->file->file,

0 commit comments

Comments
 (0)