Skip to content
Draft
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
1 change: 0 additions & 1 deletion .rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@
Php80\Class_\AnnotationToAttributeRector::class, # todo: wait for php80
Php80\Class_\ClassPropertyAssignToConstructorPromotionRector::class, # todo: wait for php80
Php80\Class_\StringableForToStringRector::class, # todo: wait for php80
Php80\ClassMethod\AddParamBasedOnParentClassMethodRector::class, # todo: TMP
Php81\Array_\FirstClassCallableRector::class, # todo: TMP
Php81\FuncCall\NullToStrictStringFuncCallArgRector::class, # todo: check later
Strict\Empty_\DisallowedEmptyRuleFixerRector::class, # todo: TMP
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Adminhtml/Controller/Rss/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ protected function checkFeedEnable($code)
* @return Mage_Core_Helper_Abstract
* @deprecated this method is incompatible with parent class. Use Mage::helper instead
*/
protected function _getHelper($name)
protected function _getHelper($name = null)
{
return Mage::helper($name);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Mage_Core_Model_Mysql4_Design_Theme_Collection extends Varien_Directory_Co
/**
* @return $this
*/
public function load()
public function load($printQuery = false, $logQuery = false)
{
$packages = $this->getData('themes');
if (is_null($packages)) {
Expand Down
73 changes: 23 additions & 50 deletions lib/Varien/Directory/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ class Varien_Directory_Collection extends Varien_Data_Collection implements IFac
* Constructor
*
* @param string $path - path to directory
* @param bool $is_recursion - use or not recursion
* @return none
* @param bool $isRecursion - use or not recursion
* @return void
*/
public function __construct($path, $isRecursion = true, $recursionLevel = 0)
{
Expand Down Expand Up @@ -92,7 +92,8 @@ public function getPath()
* Set path to this directory
* @param string $path - path to this directory
* @param bool $isRecursion - use or not recursion
* @return none
* @return void
* @throws Exception
*/
public function setPath($path, $isRecursion = '')
{
Expand All @@ -116,7 +117,7 @@ public function setPath($path, $isRecursion = '')
* Set recursion
*
* @param bool $isRecursion - use or not recursion
* @return none
* @return void
*/
public function setRecursion($isRecursion)
{
Expand All @@ -127,7 +128,7 @@ public function setRecursion($isRecursion)
* Set level of recursion
*
* @param int $recursionLevel - level of recursion
* @return none
* @return void
*/
public function setRecursionLevel($recursionLevel)
{
Expand All @@ -137,7 +138,6 @@ public function setRecursionLevel($recursionLevel)
/**
* get latest dir in the path
*
* @param string $path - path to directory
* @return string - latest dir in the path
*/
public function lastDir()
Expand All @@ -161,7 +161,7 @@ public static function getLastDir($path)
* add item to collection
*
* @param IFactory $item - item of collection
* @return none
* @return void
*/
public function addItem(IFactory $item)
{
Expand All @@ -171,7 +171,7 @@ public function addItem(IFactory $item)
/**
* parse this directory
*
* @return none
* @return void
*/
protected function parseDir()
{
Expand All @@ -191,7 +191,7 @@ protected function parseDir()
* set filter using
*
* @param bool $useFilter - filter using
* @return none
* @return void
*/
public function useFilter($useFilter)
{
Expand All @@ -215,7 +215,7 @@ public function filesName()
* get files names of current collection
*
* @param array $files - array of files names
* @return none
* @return void
*/
public function getFilesName(&$files)
{
Expand All @@ -237,8 +237,8 @@ public function filesPaths()
/**
* get files paths of current collection
*
* @param array $files - array of files paths
* @return none
* @param array &$paths - array of files paths
* @return void
*/
public function getFilesPaths(&$paths)
{
Expand All @@ -261,7 +261,7 @@ public function filesObj()
* get SplFileObject objects of files of current collection
*
* @param array $objs - array of SplFileObject objects
* @return none
* @return void
*/
public function getFilesObj(&$objs)
{
Expand All @@ -284,7 +284,7 @@ public function dirsName()
* get names of dirs of current collection
*
* @param array $dirs - array of names of dirs
* @return none
* @return void
*/
public function getDirsName(&$dirs)
{
Expand All @@ -298,7 +298,7 @@ public function getDirsName(&$dirs)
* set filters for files
*
* @param array $filter - array of filters
* @return none
* @return void
*/
protected function setFilesFilter($filter)
{
Expand All @@ -320,7 +320,7 @@ public function __toArray()
/**
* display this collection as array
* @param array &$arr - this collection array
* @return none
* @return void
*/
public function toArray(&$arr)
{
Expand All @@ -336,7 +336,7 @@ public function toArray(&$arr)
* get this collection as xml
* @param bool $addOpenTag - add or not header of xml
* @param string $rootName - root element name
* @return none
* @return string
*/
public function __toXml($addOpenTag = true, $rootName = 'Struct')
{
Expand All @@ -350,9 +350,9 @@ public function __toXml($addOpenTag = true, $rootName = 'Struct')
* @param string &$xml - xml
* @param bool $addOpenTag - add or not header of xml
* @param string $rootName - root element name
* @return none
* @return void
*/
public function toXml(&$xml, $recursionLevel = 0, $addOpenTag = true, $rootName = 'Struct')
public function toXml(&$xml = null, $recursionLevel = 0, $addOpenTag = true, $rootName = 'Struct')
Copy link

Copilot AI Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The &$xml parameter should not have a default value of null when passed by reference. The method initializes $xml = '' at line 358 when $recursionLevel == 0, but the reference parameter with a null default could cause issues when the method is called without arguments. Consider making $xml required or handling the null case explicitly before using it as a string reference.

Suggested change
public function toXml(&$xml = null, $recursionLevel = 0, $addOpenTag = true, $rootName = 'Struct')
public function toXml(&$xml, $recursionLevel = 0, $addOpenTag = true, $rootName = 'Struct')

Copilot uses AI. Check for mistakes.
{
if ($recursionLevel == 0) {
$xml = '';
Expand All @@ -374,7 +374,7 @@ public function toXml(&$xml, $recursionLevel = 0, $addOpenTag = true, $rootName

/**
* apply filters
* @return none
* @return void
*/
protected function _renderFilters()
{
Expand Down Expand Up @@ -440,44 +440,17 @@ protected function _renderFilters()

/**
* add filter
Copy link

Copilot AI Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new $type parameter is not documented in the method's docblock. Add a @param tag to describe this parameter and its purpose, including the default value and expected values.

Suggested change
* add filter
* Add a filter to the collection.
*
* @param string $field The field to filter on.
* @param mixed $value The value to filter by.
* @param string $type Logical operator for the filter ('and' or 'or'). Default is 'and'.

Copilot uses AI. Check for mistakes.
* @return none
* @return $this
*/
public function addFilter($field, $value)
public function addFilter($field, $value, $type = 'and')
{
$filter = [];
$filter['field'] = $field;
$filter['value'] = $value;
$this->_filters[] = $filter;
$this->_isFiltersRendered = false;
$this->walk('addFilter', [$field, $value]);

return $this;
}
}

/* Example */
/*
$a = new Varien_Directory_Collection('/usr/home/vasily/dev/magento/lib',false);

$a->addFilter("extension","php");

$a->useFilter(true);

print "-----------------------\n";
print_r($a->filesName());

$a->setPath('/usr/home/vasily/dev/magento/lib/Varien/Image',true);
$a->useFilter(true);

print "-----------------------\n";
print_r($a->filesName());

print "-----------------------\n";
$filesObj = $a->filesObj();
print $filesObj[0]->fgets();
print $filesObj[0]->fgets();
print $filesObj[0]->fgets();
print $filesObj[0]->fgets();
print $filesObj[0]->fgets();
print $filesObj[0]->fgets();

*/
Loading