tormjens / eventy

WordPress-like actions and filters for Laravel
422 stars 48 forks source link

Fix typings #35

Closed Stevemoretz closed 2 years ago

Stevemoretz commented 2 years ago

Hi I use idehelper to generate autocompletion, and noticed that your plugin types had a few problems in autocompletion, this fixed it for me so I wanted to create a pull request for it too.

Here's the final result in idehelp generated file :

namespace TorMorten\Eventy\Facades {
    /**
     *
     *
     */
    class Events {
        /**
         * Get the action instance.
         *
         * @return \TorMorten\Eventy\TorMorten\Events\Action
         * @static
         */
        public static function getAction() {
            /** @var \TorMorten\Eventy\Events $instance */
            return $instance->getAction();
        }
        /**
         * Get the action instance.
         *
         * @return \TorMorten\Eventy\TorMorten\Events\Filter
         * @static
         */
        public static function getFilter() {
            /** @var \TorMorten\Eventy\Events $instance */
            return $instance->getFilter();
        }
        /**
         * Add an action.
         *
         * @param string $hook Hook name
         * @param mixed $callback Function to execute
         * @param int $priority Priority of the action
         * @param int $arguments Number of arguments to accept
         * @static
         */
        public static function addAction(
            $hook,
            $callback,
            $priority = 20,
            $arguments = 1
        ) {
            /** @var \TorMorten\Eventy\Events $instance */
            return $instance->addAction(
                $hook,
                $callback,
                $priority,
                $arguments
            );
        }
        /**
         * Remove an action.
         *
         * @param string $hook Hook name
         * @param mixed $callback Function to execute
         * @param int $priority Priority of the action
         * @static
         */
        public static function removeAction($hook, $callback, $priority = 20) {
            /** @var \TorMorten\Eventy\Events $instance */
            return $instance->removeAction($hook, $callback, $priority);
        }
        /**
         * Remove all actions.
         *
         * @param string $hook Hook name
         * @static
         */
        public static function removeAllActions($hook = null) {
            /** @var \TorMorten\Eventy\Events $instance */
            return $instance->removeAllActions($hook);
        }
        /**
         * Adds a filter.
         *
         * @param string $hook Hook name
         * @param mixed $callback Function to execute
         * @param int $priority Priority of the action
         * @param int $arguments Number of arguments to accept
         * @static
         */
        public static function addFilter(
            $hook,
            $callback,
            $priority = 20,
            $arguments = 1
        ) {
            /** @var \TorMorten\Eventy\Events $instance */
            return $instance->addFilter(
                $hook,
                $callback,
                $priority,
                $arguments
            );
        }
        /**
         * Remove a filter.
         *
         * @param string $hook Hook name
         * @param mixed $callback Function to execute
         * @param int $priority Priority of the action
         * @static
         */
        public static function removeFilter($hook, $callback, $priority = 20) {
            /** @var \TorMorten\Eventy\Events $instance */
            return $instance->removeFilter($hook, $callback, $priority);
        }
        /**
         * Remove all filters.
         *
         * @param string $hook Hook name
         * @static
         */
        public static function removeAllFilters($hook = null) {
            /** @var \TorMorten\Eventy\Events $instance */
            return $instance->removeAllFilters($hook);
        }
        /**
         * Set a new action.
         *
         * Actions never return anything. It is merely a way of executing code at a specific time in your code.
         *
         * You can add as many parameters as you'd like.
         *
         * @param string $action Name of hook
         * @param mixed $parameters
         * @return void
         * @static
         */
        public static function action($action, ...$parameters) {
            /** @var \TorMorten\Eventy\Events $instance */
            $instance->action($action, ...$parameters);
        }
        /**
         * Set a new filter.
         *
         * Filters should always return something. The first parameter will always be the default value.
         *
         * You can add as many parameters as you'd like.
         *
         * @param string $action Name of hook
         * @param mixed $value The original filter value
         * @param mixed $parameters
         * @return mixed
         * @static
         */
        public static function filter($action, $value, ...$parameters) {
            /** @var \TorMorten\Eventy\Events $instance */
            return $instance->filter($action, $value, ...$parameters);
        }
    }
}
Stevemoretz commented 2 years ago

I can't see the output of your ci test.

You do not have access to github.styleci.io.

The site owner may have set restrictions that prevent you from accessing the site. Contact the site owner for access or try loading the page again.

It has probably something to do with the braces only

Stevemoretz commented 2 years ago

Okay fixed the style too, that was annoying :( Enjoy it!

tormjens commented 2 years ago

Cool! :D Thank you very much!

Stevemoretz commented 2 years ago

Cool! :D Thank you very much!

Thank you for the great library!