Skip to content

Commit 2b796db

Browse files
sreicheltmotyl
authored andcommitted
fix for php8.4
1 parent 348ab68 commit 2b796db

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

phpstan-bootstrap-mage-autoload.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<?php
2+
23
declare(strict_types=1);
34

45
use PHPStanMagento1\Autoload\Magento\ModuleControllerAutoloader;
56

67
/**
7-
* @var $container \PHPStan\DependencyInjection\MemoizingContainer
8+
* @var \PHPStan\DependencyInjection\MemoizingContainer $container
89
*/
910
$magentoRootPath = $container->getParameter('magentoRootPath');
1011
if (empty($magentoRootPath)) {
@@ -23,11 +24,11 @@
2324
* We replace the original Varien_Autoload autoloader with a custom one in order to prevent errors with invalid classes
2425
* that are used throughout the Magento core code.
2526
* The original autoloader would in this case return false and lead to an error in phpstan because the type alias in extension.neon
26-
* is evaluated afterwards.
27+
* is evaluated afterward.
2728
*
2829
* @see \Varien_Autoload::autoload()
2930
*/
30-
spl_autoload_register(static function($className) {
31+
spl_autoload_register(static function ($className) {
3132
spl_autoload_unregister([Varien_Autoload::instance(), 'autoload']);
3233

3334
$classFile = str_replace(' ', DIRECTORY_SEPARATOR, ucwords(str_replace('_', ' ', $className)));

phpstan-bootstrap.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<?php
2+
23
declare(strict_types=1);
34

45
use PHPStanMagento1\Autoload\Magento\ModuleControllerAutoloader;
56

67
/**
7-
* @var $container \PHPStan\DependencyInjection\MemoizingContainer
8+
* @var \PHPStan\DependencyInjection\MemoizingContainer $container
89
*/
910
$magentoRootPath = $container->getParameter('magentoRootPath');
1011
if (empty($magentoRootPath)) {
@@ -35,7 +36,7 @@
3536

3637
$appPath = implode(PS, $paths);
3738
set_include_path($appPath . PS . get_include_path());
38-
include_once "Mage/Core/functions.php";
39+
include_once 'Mage/Core/functions.php';
3940

4041
(new ModuleControllerAutoloader('local'))->register();
4142
(new ModuleControllerAutoloader('core'))->register();
@@ -46,8 +47,7 @@
4647
* Autoloading is needed only for the PHPStanMagento1\Config\MagentoCore which inherits from some magento classes.
4748
* PHPStan uses static analysis, so doesn't require autoloading.
4849
*/
49-
spl_autoload_register(static function($className) {
50-
50+
spl_autoload_register(static function ($className) {
5151
$classFile = str_replace(' ', DIRECTORY_SEPARATOR, ucwords(str_replace('_', ' ', $className)));
5252
$classFile .= '.php';
5353

src/Autoload/Magento/ModuleControllerAutoloader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ final class ModuleControllerAutoloader
1515
/** @var string */
1616
private $codePool;
1717

18-
public function __construct(string $codePool, string $magentoRoot = null)
18+
public function __construct(string $codePool, ?string $magentoRoot = null)
1919
{
2020
if (empty($magentoRoot)) {
2121
$magentoRoot = BP;

src/Config/MagentoCore.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ protected function _getDeclaredModuleFiles()
531531
*/
532532
protected function _makeEventsLowerCase($area, \Varien_Simplexml_Config $mergeModel)
533533
{
534-
$events = $mergeModel->getNode($area . "/" . \Mage_Core_Model_App_Area::PART_EVENTS);
534+
$events = $mergeModel->getNode($area . '/' . \Mage_Core_Model_App_Area::PART_EVENTS);
535535
if ($events !== false) {
536536
$children = clone $events->children();
537537
/** @var \Mage_Core_Model_Config_Element $event */

0 commit comments

Comments
 (0)