1
+ <?php
2
+ namespace Df \Framework \Module \Dir ;
3
+ use Df \Framework \Config \FileIterator as dfI ;
4
+ use Magento \Framework \Config \FileIterator as I ;
5
+ use Magento \Framework \Module \Dir \Reader as _P ;
6
+ /**
7
+ * 2017-07-26
8
+ * @final Unable to use the PHP «final» keyword here because of the M2 code generation.
9
+ * The purpose of this class is to fix the issue:
10
+ * «bin/magento module:enable --all»: «The file "/composer.json" doesn't exist»
11
+ * https://github.com/mage2pro/stripe/issues/8
12
+ * https://mage2.pro/t/4198
13
+ *
14
+ * @used-by \Df\Framework\Module\PackageInfoFactory::create()
15
+ *
16
+ * Unfortunately, it is impossible to implement this as a plugin because of the recursion:
17
+ * Step 1:
18
+ * @see \Magento\Framework\Config\Reader\Filesystem::read():
19
+ * $fileList = $this->_fileResolver->get($this->_fileName, $scope);
20
+ * https://github.com/magento/magento2/blob/2.2.0-RC1.5/lib/internal/Magento/Framework/Config/Reader/Filesystem.php#L124
21
+ * Step 2:
22
+ * @see \Magento\Framework\App\Config\FileResolver::get():
23
+ * $iterator = $this->_moduleReader->getConfigurationFiles($filename);
24
+ * https://github.com/magento/magento2/blob/2.2.0-RC1.5/lib/internal/Magento/Framework/App/Config/FileResolver.php#L65
25
+ * Step 3:
26
+ * @see \Magento\Framework\Interception\PluginList\PluginList::getNext():
27
+ * $this->_loadScopedData();
28
+ * https://github.com/magento/magento2/blob/2.2.0-RC1.5/lib/internal/Magento/Framework/Interception/PluginList/PluginList.php#L266
29
+ * Step 4:
30
+ * @see \Magento\Framework\Interception\PluginList\PluginList::_loadScopedData():
31
+ * $data = $this->_reader->read($scopeCode);
32
+ * https://github.com/magento/magento2/blob/2.2.0-RC1.5/lib/internal/Magento/Framework/Interception/PluginList/PluginList.php#L298
33
+ * Step 5:
34
+ * @see \Magento\Framework\ObjectManager\Config\Reader\Dom\Proxy::read()
35
+ * @see \Magento\Framework\Config\Reader\Filesystem::read()
36
+ * https://github.com/magento/magento2/blob/2.2.0-RC1.5/lib/internal/Magento/Framework/Config/Reader/Filesystem.php#L124
37
+ */
38
+ class Reader extends _P {
39
+ /**
40
+ * 2017-07-26
41
+ * @override
42
+ * @see \Magento\Framework\Module\Dir\Reader::getComposerJsonFiles()
43
+ * @return I
44
+ */
45
+ function getComposerJsonFiles () {$ r = parent ::getComposerJsonFiles (); /** @var I $r */ return
46
+ dfI::pathsSet ($ r , array_filter (dfI::pathsGet ($ r ), function ($ f ) {return '/composer.json ' !== $ f ;}))
47
+ ;}
48
+ }
0 commit comments