diff --git a/CHANGELOG.md b/CHANGELOG.md index 293f622..db4b728 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,10 @@ All notable changes to this project will be documented in this file. This project now adheres to [Semantic Versioning](http://semver.org/). -## [Unreleased] +## [2.0.0-beta1] - 2020-12-25 + +Version 2 is a complete rewrite using php8 attributes instead of docblock style +annotation. Major changes include: - Removed built in phpunit integration - Removed the `--named-only` command line option @@ -14,7 +17,6 @@ This project now adheres to [Semantic Versioning](http://semver.org/). - Added the `--input` command line option - Renamed command line option `--format` > `--output` - Added the `--debug` command line option -- Using php8 attributes instead of annotations - Added support for config files - Added the `--config` and `--no-config` command line options - Use a propper event dispatcher diff --git a/README.md b/README.md index 8c9915b..18bcf49 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,10 @@ Validate PHP code examples in documentation. +This file describes version `2` which uses php8 attributes. For version `1` +which uses docblock style annotations see [this link](https://github.com/hanneskod/readme-tester/tree/1.0.0). + + ## Why? Did you update your library, but forgot to update code examples in README? Are diff --git a/docs/01-basic_syntax.md b/docs/01-basic_syntax.md index 52d3850..a9913d5 100644 --- a/docs/01-basic_syntax.md +++ b/docs/01-basic_syntax.md @@ -59,17 +59,6 @@ Attributes unknown to readmetester are simply skipped // The UnknownAttribute is skipped as it is not known ``` -### Case insensitive attributes - -Attributes are case insensitive. - - - ```php - echo "foo"; - ``` - ### Multiple attributes Multiple attributes can be grouped togheter in the same way as php handles diff --git a/spec/Attribute/IgnoreUnmarkedExamplesSpec.php b/spec/Attribute/IgnoreUnmarkedExamplesSpec.php index 51f21ae..805e073 100644 --- a/spec/Attribute/IgnoreUnmarkedExamplesSpec.php +++ b/spec/Attribute/IgnoreUnmarkedExamplesSpec.php @@ -31,14 +31,14 @@ function it_is_a_transformation() function it_ignores_unmaked_example(ExampleObj $example) { - $example->getAttributes()->willReturn([(object)array()]); + $example->hasAttribute(Example::class)->willReturn(false); $example->withActive(false)->willReturn($example)->shouldBeCalled(); $this->transform($example)->shouldReturn($example); } function it_skipps_marked_example(ExampleObj $example) { - $example->getAttributes()->willReturn([new Example]); + $example->hasAttribute(Example::class)->willReturn(true); $example->withActive(false)->shouldNotBeCalled(); $this->transform($example)->shouldReturn($example); } diff --git a/src/Attribute/IgnoreUnmarkedExamples.php b/src/Attribute/IgnoreUnmarkedExamples.php index 6bf8bcd..ce28fff 100644 --- a/src/Attribute/IgnoreUnmarkedExamples.php +++ b/src/Attribute/IgnoreUnmarkedExamples.php @@ -14,10 +14,8 @@ class IgnoreUnmarkedExamples extends AbstractAttribute implements Transformation { public function transform(ExampleObj $example): ExampleObj { - foreach ($example->getAttributes() as $attribute) { - if ($attribute instanceof Example) { - return $example; - } + if ($example->hasAttribute(Example::class)) { + return $example; } return $example->withActive(false); diff --git a/src/FilesystemFacade.php b/src/FilesystemFacade.php index f37b8b1..76232eb 100644 --- a/src/FilesystemFacade.php +++ b/src/FilesystemFacade.php @@ -34,7 +34,7 @@ public function getFilesystemInput(string $cwd, array $paths, array $extensions, ) ); - // Set file extensions (case insensitive) + // Set file extensions $finder->name( array_map(