angelxmoreno/get-set-annotations

Helper for the GetSetTrait

v1.1.0 2018-03-05 18:48 UTC

This package is auto-updated.

Last update: 2021-01-15 20:05:15 UTC


README

A CLI script for reporting missing getter/setter methods due to the use of magic methods.

License Total Downloads Latest Stable Version Build Status Codacy Badge Maintainability Test Coverage

Why this project?

I really enjoy using the GetSetTrait provided by mikebarlow. One of the issues with using magic getters and setters is that most IDEs lose knowledge about the class methods available. This can easily be addressed by adding proper @method entries to the class doc blocks. This can sometimes prove to be time consuming and open to typos.

I created this CLI script to generate the @method entries for classes missing defined getters/setters. Thought it was created to support the GetSetTrait, it can be used for any implementation of magic getters and setters

Installation

composer require --dev angelxmoreno/get-set-annotations

Usage

./bin/get-set-scan [directory]

This prints out a report similar to the following:

Array
(
    [2] => Array
        (
            [path] => /Users/amoreno/Projects/GetSetAnnotations/src/PropertyInfo.php
            [class] => Axm\GetSetAnnotations\PropertyInfo
            [doc] => 
* @method \ReflectionProperty getReflector()
* @method void setReflector(\ReflectionProperty $reflector)
* @method string getName()
* @method void setName(string $name)
* @method string getComment()
* @method void setComment(string $comment)
* @method string getType()
* @method void setType(string $type)
* @method bool getNeedsSetter()
* @method void setNeedsSetter(bool $needs_setter)
* @method bool getNeedsGetter()
* @method void setNeedsGetter(bool $needs_getter)
        )

)

License

Copyright 2018 Angel S. Moreno (angelxmoreno). All rights reserved.

Licensed under the MIT License. Redistributions of the source code included in this repository must retain the copyright notice found in each file.