Skip to content

Commit

Permalink
Merge pull request #123 from andrewnicols/fixPhpStanDetectedIssues
Browse files Browse the repository at this point in the history
Fix incorrect class names
  • Loading branch information
mudrd8mz committed Apr 25, 2024
2 parents 3ca7b1a + 10e9664 commit 98c118c
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 11 deletions.
1 change: 0 additions & 1 deletion classes/local/skel/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ public function set_attribute(string $attribute, $value = true) {
* Render the file contents.
*
* @param renderer_base $renderer
* @return The file source code contents.
*/
public function render($renderer) {
$this->content = $this->normalize($renderer->render($this->get_template_name(), $this->get_template_data()));
Expand Down
2 changes: 1 addition & 1 deletion classes/local/skel/external_function_file.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class external_function_file extends php_single_file {
public function generate_external_function_code(array $external): void {

if (empty($this->data)) {
throw new coding_exception('Skeleton data not set');
throw new \coding_exception('Skeleton data not set');
}

$this->set_attribute('has_extra_requirements');
Expand Down
2 changes: 1 addition & 1 deletion classes/local/skel/lib_php_file.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

namespace tool_pluginskel\local\skel;

use tool_pluginskel\local\util\exception;
use coding_exception;

/**
* Class representing the lib.php file.
Expand Down
4 changes: 3 additions & 1 deletion classes/local/skel/locallib_php_file.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

namespace tool_pluginskel\local\skel;

use coding_exception;

/**
* Class representing the locallib.php file.
*
Expand All @@ -45,7 +47,7 @@ class locallib_php_file extends php_library_file {
public function add_event_callback($callback, $event) {

if (empty($this->data)) {
throw new exception('Skeleton data not set');
throw new coding_exception('Skeleton data not set');
}

if (empty($this->data['self'])) {
Expand Down
10 changes: 6 additions & 4 deletions classes/local/skel/observer_file.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

namespace tool_pluginskel\local\skel;

use coding_exception;

/**
* Class representing a Moodle observer class file.
*
Expand All @@ -41,11 +43,11 @@ class observer_file extends php_single_file {
public function set_observer_name($name) {

if (empty($this->data)) {
throw new exception('Skeleton data not set');
throw new coding_exception('Skeleton data not set');
}

if (!empty($this->data['observer']['observer_name'])) {
throw new exception("Observer: '$name' already set");
throw new coding_exception("Observer: '$name' already set");
}

$this->data['observer']['observer_name'] = $name;
Expand All @@ -60,7 +62,7 @@ public function set_observer_name($name) {
public function add_event_callback($callback, $event) {

if (empty($this->data)) {
throw new exception('Skeleton data not set');
throw new coding_exception('Skeleton data not set');
}

if (empty($this->data['observer']['callbacks'])) {
Expand All @@ -78,7 +80,7 @@ public function add_event_callback($callback, $event) {
public function set_file_namespace($namespace) {

if (empty($this->data)) {
throw new exception('Skeleton data not set');
throw new coding_exception('Skeleton data not set');
}

$this->data['observer']['namespace'] = 'namespace '.$namespace.';';
Expand Down
4 changes: 1 addition & 3 deletions classes/local/skel/phpunit_test_file.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

namespace tool_pluginskel\local\skel;

use tool_pluginskel\local\util\exception;
use coding_exception;

/**
* Class representing the phpunit test file.
Expand All @@ -34,14 +34,12 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class phpunit_test_file extends php_single_file {

/**
* Adds the classname of the class.
*
* @param string $classname
*/
public function set_classname($classname) {

if (empty($this->data)) {
throw new coding_exception('Skeleton data not set');
}
Expand Down

0 comments on commit 98c118c

Please sign in to comment.