Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,26 @@
use PhpCsFixer\Config;
use PhpCsFixer\Finder;

$baseline_file = __DIR__ . '/../../PluginsPhpCsFixer.php';
if (!file_exists($baseline_file)) {
throw new RuntimeException(
sprintf(
'Unable to find "%s". Running php-cs-fixer on a plugin requires a GLPI development checkout that ships PluginsPhpCsFixer.php.',
$baseline_file,
),
);
}

$baseline = require $baseline_file;

$finder = Finder::create()
->in(__DIR__)
->name('*.php')
->ignoreVCSIgnored(true);

$config = new Config();
->ignoreVCSIgnored(true)
->name('*.php');

$rules = [
'@PER-CS' => true, // Latest PER rules.
];
/** @var Config $config */
$config = $baseline($finder);

return $config
->setRules($rules)
->setFinder($finder)
->setCacheFile(__DIR__ . '/var/php-cs-fixer/.php-cs-fixer.cache')
;
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

- Fix search crash when the "Tags - Entity" column is displayed
- Fix tag associate item
- Fix lint by applying GLPI shared coding standards

## [2.15.0] - 2026-10-06

Expand Down
4 changes: 2 additions & 2 deletions hook.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ function plugin_tag_MassiveActions($itemtype = '')
/**
* Plugin install process
*
* @return boolean
* @return bool
*/
function plugin_tag_install()
{
Expand Down Expand Up @@ -309,7 +309,7 @@ function plugin_tag_install()
/**
* Plugin uninstall process
*
* @return boolean
* @return bool
*/
function plugin_tag_uninstall()
{
Expand Down
2 changes: 1 addition & 1 deletion inc/questiontype.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public function getTargetQuestionType(array $rawData): string
public function getAvailableTags(?Form $form = null): array
{
$active_entities_ids = Session::getActiveEntities();
if ($active_entities_ids === [] && $form) {
if ($active_entities_ids === [] && $form instanceof Form) {
$active_entities_ids = [$form->getEntityID()];
}

Expand Down
6 changes: 3 additions & 3 deletions inc/tag.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ public function prepareInputForUpdate($input)
* Check that the color field, if provided, is a valid hexadecimal color
*
* @param array $input
* @return boolean
* @return bool
*/
public function checkColorField($input = [])
{
Expand Down Expand Up @@ -850,7 +850,7 @@ public function encodeSubtypes($input)
* Check all mandatory field are filled
*
* @param array $input
* @return boolean
* @return bool
*/
public function checkMandatoryFields($input = [])
{
Expand All @@ -876,7 +876,7 @@ public function checkMandatoryFields($input = [])
/**
* Retrieve the current itemtype from the current page url
*
* @return string|boolean false if not itemtype found, the string itemtype if found
* @return string|bool false if not itemtype found, the string itemtype if found
*/
public static function getCurrentItemtype()
{
Expand Down
6 changes: 3 additions & 3 deletions inc/tagitem.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public static function uninstall()
/**
* Display the list of available itemtype
*
* @return boolean
* @return bool
*/
public static function showForTag(PluginTagTag $tag)
{
Expand Down Expand Up @@ -467,7 +467,7 @@ public static function showForTag(PluginTagTag $tag)
* Add tags to an item
*
*
* @return boolean
* @return bool
*/
public static function updateItem(CommonDBTM $item, bool $delete_existing_tags = true)
{
Expand Down Expand Up @@ -584,7 +584,7 @@ private static function keepVisibleTags(array $tag_values): array
/**
* Delete all tags associated to an item
*
* @return boolean
* @return bool
*/
public static function purgeItem(CommonDBTM $item)
{
Expand Down
1 change: 1 addition & 0 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
$config = $baseline([
__DIR__ . '/ajax',
__DIR__ . '/inc',
__DIR__ . '/src',
__DIR__ . '/stubs',
__DIR__ . '/tests',
]);
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/TagItemController.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@
use Glpi\Exception\Http\AccessDeniedHttpException;
use Glpi\Exception\Http\BadRequestHttpException;
use Glpi\Http\RedirectResponse;
use Glpi\Routing\Attribute\ItemtypeFormRoute;
use Html;
use PluginTagTag;
use PluginTagTagItem;
use Session;
use Glpi\Routing\Attribute\ItemtypeFormRoute;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

Expand Down
1 change: 0 additions & 1 deletion tests/QuestionTypeTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
use Glpi\Controller\Form\RendererController;
use Glpi\Form\Form;
use Glpi\Tests\FormTesterTrait;
use GlpiPlugin\Tag\Tests\TagTestCase;
use Symfony\Component\DomCrawler\Crawler;
use Symfony\Component\HttpFoundation\Request;

Expand Down
2 changes: 1 addition & 1 deletion tests/Units/TagTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
namespace GlpiPlugin\Tag\Tests\Units;

use DBmysql;
use Glpi\Search\SearchOption;
use GlpiPlugin\Tag\Tests\TagTestCase;
use PluginTagTag;
use Glpi\Search\SearchOption;
use Search;
use Ticket;

Expand Down
Loading