Skip to content

Commit

Permalink
Remove support for "autoload.exclude-from-files"
Browse files Browse the repository at this point in the history
This non-standard use of the "autoloads" property should never have been supported.

Changed:
- Example in README to use "extra.exclude…"

Removed:
- Deprecation notice and processing of "autoload" in `ExcludeFilePluginTest::getExcludedFiles()`
- Test of "autoload" in `ExcludeFilePluginTest`

Closes #8
  • Loading branch information
mcaskill committed Sep 25, 2020
1 parent bbbe0bc commit f8b5656
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 34 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ $ composer require mcaskill/composer-exclude-files
> You can only ignore files from your main `composer.json`.
> File exclusions of dependencies' `composer.json`s are ignored.
From your main `composer.json`, add the `exclude-from-files` property to either the 'autoload' section or the 'extra' section.
The list of paths must be absolute from the vendor directory.
From your main `composer.json`, add the `exclude-from-files` property to either the `extra` section.
The list of paths must be relative to the composer manifest.

This plugin is invoked before the autoloader is dumped, either during `install`/`update`, or via the `dump-autoload` command.

Expand All @@ -36,7 +36,7 @@ Example:
"require": {
"illuminate/support": "^5.5"
},
"autoload": {
"extra": {
"exclude-from-files": [
"illuminate/support/helpers.php"
]
Expand Down
14 changes: 0 additions & 14 deletions src/ExcludeFilePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ class ExcludeFilePlugin implements
*/
private $composer;

/**
* @var IOInterface
*/
private $io;

/**
* Apply plugin modifications to Composer.
*
Expand All @@ -46,7 +41,6 @@ class ExcludeFilePlugin implements
public function activate(Composer $composer, IOInterface $io)
{
$this->composer = $composer;
$this->io = $io;
}

/**
Expand Down Expand Up @@ -184,14 +178,6 @@ private function getExcludedFiles(PackageInterface $package)
{
$type = self::EXCLUDE_FILES_PROPERTY;

$autoload = $package->getAutoload();

// Skip misconfigured or empty packages
if (isset($autoload[$type]) && is_array($autoload[$type])) {
$this->io->writeError('<warning>Using the "'.$type.'" property from "autoload" is deprecated and will be removed in mcaskill/composer-exclude-files v2.0. Use the property from "extra" instead.</warning>');
return $autoload[$type];
}

$extra = $package->getExtra();

if (isset($extra[$type]) && is_array($extra[$type])) {
Expand Down
17 changes: 0 additions & 17 deletions tests/ExcludeFilePluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,23 +191,6 @@ public function testAutoloadDump()
// Check standard autoload
$this->assertAutoloadFiles('files1', $this->vendorDir.'/composer', 'files');

$package->setAutoload(array(
'exclude-from-files' => array(
'b/b/test2.php',
'c/c/foo/bar/test3.php',
),
));

// 3. Check plugin filters autoloads if the root package
// excludes files from "autoload" section
$plugin->parseAutoloads();

$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_1');

// Make autoload has excluded specified files
$this->assertAutoloadFiles('files2', $this->vendorDir.'/composer', 'files');

$package->setAutoload(array());
$package->setExtra(array(
'exclude-from-files' => array(
'b/b/test2.php',
Expand Down

0 comments on commit f8b5656

Please sign in to comment.