Merge branch 'dev' into prod

This commit is contained in:
2026-03-17 02:01:13 -07:00
5 changed files with 22 additions and 15 deletions

View File

@@ -14,7 +14,7 @@
} }
], ],
"require": { "require": {
"php": ">=8.1", "php": ">=8.2",
"cakephp/cakephp": "^5.0" "cakephp/cakephp": "^5.0"
}, },
"require-dev": { "require-dev": {

View File

@@ -8,3 +8,5 @@ parameters:
bootstrapFiles: bootstrapFiles:
- tests/bootstrap.php - tests/bootstrap.php
treatPhpDocTypesAsCertain: false treatPhpDocTypesAsCertain: false
ignoreErrors:
- identifier: trait.unused

View File

@@ -3,7 +3,7 @@ declare(strict_types=1);
namespace CheeseCake\Controller; namespace CheeseCake\Controller;
use App\Controller\AppController as BaseController; use Cake\Controller\Controller;
class AppController extends BaseController { class AppController extends Controller {
} }

View File

@@ -5,9 +5,12 @@ namespace CheeseCake\View\Helper;
use Cake\Routing\Router; use Cake\Routing\Router;
use Cake\View\Helper; use Cake\View\Helper;
use Cake\View\Helper\HtmlHelper;
/** /**
* ActiveLink helper * ActiveLink helper
*
* @property HtmlHelper $Html
*/ */
class ActiveLinkHelper extends Helper { class ActiveLinkHelper extends Helper {
@@ -42,11 +45,11 @@ class ActiveLinkHelper extends Helper {
if (!array_key_exists('target', $options) || !$currentUrl) { if (!array_key_exists('target', $options) || !$currentUrl) {
return $this->Html->link($title, $url, $options); return $this->Html->link($title, $url, $options);
} }
$target = $options['target'];
$activeClass = $options['activeClass'] ?? $this->getConfig('activeClass');
unset($options['target']); $target = $options['target'];
unset($options['activeClass']); $activeClass = $options['activeClass'] ?? $this->getConfig('activeClass');
unset($options['target']);
unset($options['activeClass']);
if (is_string($target)) { if (is_string($target)) {
return $this->_linkFromStringTarget($currentUrl, $target, $title, $url, $activeClass, $options); return $this->_linkFromStringTarget($currentUrl, $target, $title, $url, $activeClass, $options);
@@ -113,6 +116,7 @@ class ActiveLinkHelper extends Helper {
/** /**
* @param array $providedOptions * @param array $providedOptions
* @param string $toAdd
* *
* @return string * @return string
*/ */
@@ -120,11 +124,12 @@ class ActiveLinkHelper extends Helper {
return array_key_exists('class', $providedOptions) ? $providedOptions['class'] . ' ' . $toAdd : $toAdd; return array_key_exists('class', $providedOptions) ? $providedOptions['class'] . ' ' . $toAdd : $toAdd;
} }
/** /**
* @param array $current * @param array $current
* @param string $targetString * @param string $targetString
* @param string $title * @param string $title
* @param array|string|null $url * @param array|string|null $url
* @param string $activeClass
* @param array $options * @param array $options
* *
* @return string * @return string
@@ -139,7 +144,7 @@ class ActiveLinkHelper extends Helper {
return $this->Html->link($title, $url, $options); return $this->Html->link($title, $url, $options);
} }
/** /**
* @param array $current * @param array $current
* @param array $targetUrl * @param array $targetUrl
* *

View File

@@ -108,7 +108,7 @@ class ActiveLinkHelperTest extends TestCase {
// matches specific controller action // matches specific controller action
$specificActionResult = $helper->link('goto', ['prefix' => 'Admin', 'controller' => 'Users', 'action' => 'index'], [ $specificActionResult = $helper->link('goto', ['prefix' => 'Admin', 'controller' => 'Users', 'action' => 'index'], [
'target' => ['controller' => 'Events', 'action' => 'index'], 'target' => ['controller' => 'Events', 'action' => 'index'],
'current' => ['prefix' => 'Admin', 'controller' => 'Users', 'action' => 'index'], 'current' => ['prefix' => 'Admin', 'controller' => 'Users', 'action' => 'index'],
'activeClass' => 'awesome-active-class', 'activeClass' => 'awesome-active-class',
'class' => 'link-class', 'class' => 'link-class',
]); ]);