-
-
Notifications
You must be signed in to change notification settings - Fork 441
Shorter copyright header #4467
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shorter copyright header #4467
Conversation
Hi, What do you think of what piwigo has done? The copyright is available in a single file COPYING.txt |
I would agree IDEs are more important than a static documentation website, but I do like both. 😃 I'm back at my computer now, so to be clear here's an example, but I don't have a current PHPStorm license to check how it shows. <?php
/**
* Base html block
*
* Example usage, etc...
*
* @category Mage
* @package Mage_Core
* @copyright This file is part of OpenMage. For copyright and license information, please view the COPYING.txt file that was distributed with this source code.
* @license Open Software License (OSL 3.0)
*
* @method $this setContentHeading(string $value)
* @method $this setDestElementId(string $value)
* @method $this setFormAction(string $value)
* @method $this setIdSuffix(string $value)
* @method $this setProduct(Mage_Catalog_Model_Product $value)
* @method $this setDisplayMinimalPrice(bool $value)
*/
class Mage_Core_Block_Template extends Mage_Core_Block_Abstract
{ Edit: I lengthened the |
Thanks for the example, that looks great to me, a nice improvement. If you agree, do you mind applying that method to class files @sreichel ? No changes needed for all other files (phtml, css, etc). |
I think there is room for improvement on the phtml files too, for example: It could be something like: <?php
/**
* Attribute manage options form
*
* This template is responsible for rendering the form at Catalog > Attributes > Manage Attributes > Manage Labels / Options tab.
* You can customize it by... (etc)
*
* @category design
* @package default_default
* @copyright This file is part of OpenMage[...]
* @license Academic Free License (AFL 3.0)
*/
/** @var Mage_Eav_Block_Adminhtml_Attribute_Edit_Options_Abstract $this */
?>
<div>
<ul class="messages">
<li class="notice-msg">
<!-- ... --> I'm not tied to any format specific format or wording either. Whatever is decided we should test on various IDEs. It would be nice to make this the final docblock update. |
And my memory could be hazy, so I'll confirm my findings before @sreichel were to change anything in this PR. I would like to hear other people's opinions too. 😃 |
Really often I use "my time". The PR was about to remove some "duplicate" content. Not touching the years. Not touching the copyrights ... |
I had a chance to double check things with the official phpdoc package. Regardless of the outcome of this PR, here are some more notes: 1. The
2. Just the 3. Using the Updated docblock template proposalNot a final docblock template by any means, just updating the previous post to remove # app/code/core/Mage/Core/Block/Template.php
<?php
/**
* Base html block
*
* Example usage, etc. Can use markdown:
* ```php
* $filename = Mage::getDesign()->getTemplateFilename($this->getTemplate(), $params);
* ```
*
* @package Mage_Core
* @copyright This file is part of OpenMage. For copyright and license information, please view the COPYING.txt file that was distributed with this source code.
* @license Open Software License (OSL 3.0)
*
* @method $this setContentHeading(string $value)
* @method $this setDestElementId(string $value)
* @method $this setFormAction(string $value)
* @method $this setIdSuffix(string $value)
* @method $this setProduct(Mage_Catalog_Model_Product $value)
* @method $this setDisplayMinimalPrice(bool $value)
*/
class Mage_Core_Block_Template extends Mage_Core_Block_Abstract # app/design/adminhtml/default/default/template/eav/attribute/options.phtml
<?php
/**
* Attribute manage options form
*
* This template is responsible for rendering the form at Catalog > Attributes > Manage Attributes > Manage Labels / Options tab.
* You can customize it by... (etc)
*
* @copyright This file is part of OpenMage. For copyright and license information, please view the COPYING.txt file that was distributed with this source code.
* @license Academic Free License (AFL 3.0)
*/
/** @var Mage_Eav_Block_Adminhtml_Attribute_Edit_Options_Abstract $this */
?>
<div>
<ul class="messages"> ScreenshotsHere's some screenshots of how each option (current main branch, this PR, and my proposed docblock) render. 1. Class: This is the page that shows the Class Definition of The current screenshot shows a useless "category: Mage" tag when we already know we're in the Mage package. There is also no copyright or license information. Unrelated, but I added some markdown to that file in the proposed version just to show what's possible. 2. File: 3. File: <?php
/**
* OpenMage
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available at https://opensource.org/license/afl-3-0-php
*
* @category design
* @package default_default
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
* @copyright Copyright (c) 2021-2024 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
?>
<?php
/**
* Attribute options control
*
* @see Mage_Eav_Block_Adminhtml_Attribute_Edit_Options_Abstract
* @var Mage_Eav_Block_Adminhtml_Attribute_Edit_Options_Abstract $this
*/
?> |
I support moving most of the copyright into a root file. Just a small comment related to this line "@copyright This file is part of OpenMage. For copyright and license information, please view the COPYING.txt file that was distributed with this source code." If it is required make it smaller, for example "@copyright For copyright and license information please read the COPYING.txt file." |
I like all the proposed changes by @justinbeaty and @addison74. Sorry if I hijacked the original PR purpose, @sreichel, but I think it was only after you added the workflow to update the copyright years so I didn't think that was outside of the scope. I was just asking about what method you were using in case you had a smarter method than mine so I could help. I'd probably just use a the obvious "Find and Replace" personally, but I'm sure there are other more clever ways.. I'll make the changes if you prefer me to do it, just let me know. |
@colinmollenhour have you tried those updated docblocks in your IDE? Presumably you only see the class docblocks and not the file level docblocks anywhere, so just want to make sure those look good on your end. I should also check if putting the <?php
/**
* Adminhtml manage attribute options form block
*
* Long description...
*
* @var Mage_Eav_Block_Adminhtml_Attribute_Edit_Options_Abstract $this <-- This line
* @see Some value...
* @copyright For copyright and license information please read the COPYING.txt file
* @license Academic Free License (AFL 3.0)
*/
?> |
I think for |
- phpdoc -c .phpdoc.dist.xml
@justinbeaty @colinmollenhour @addison74 thanks for suggestions. To reproduce output i've added phpdocumentor. To not run it run for whole code you can add this to root. Takes 10s to have docs at phpdoc.xml<?xml version="1.0" encoding="UTF-8" ?>
<phpdocumentor
configVersion="3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://www.phpdoc.org"
xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/phpDocumentor/phpDocumentor/master/data/xsd/phpdoc.xsd"
>
<setting name="template.color" value="blue"/>
<paths>
<output>build/phpdoc-test/api</output>
<cache>build/phpdoc-test/cache</cache>
</paths>
<version number="3.0.0">
<api>
<source dsn=".">
<path>app/code/core/Mage/Admin</path>
<path>COPYING.txt</path>
</source>
<extensions>
<extension>php</extension>
<extension>txt</extension>
</extensions>
<visibility>public</visibility>
<visibility>protected</visibility>
<visibility>private</visibility>
</api>
</version>
</phpdocumentor>
Run vendor/bin/phpdoc run From my tests ...
For php-files we have this atm? Added link ... /**
* Class description
*
* @copyright For copyright and license information read COPYING.txt file
* @copyright ... additional info ....
* @link /COPYING.txt
* @package Mage_Xml
*
* ... methods, etc ...
*/
class Some_Class (note: slash is requird to linkt to copying.txt) @colinmollenhour i am happy for every improvent, but its bit wiered ... there are other PRs that deserve more attention. I have used simple "find&replace", later with regex pattern. Now i think about a script to automate all suggestion ... lol. "Problem" is, it takes time to process 5k files (again and again). Espaccially running on old hardware (core-i3, 16gb 😢)
As for every PR, pleae fork and submit a PR to improve. PS: can you please prepare a subdomain to publish phpdocumentor? |
Yeah, as often happens, a small suggestion becomes a bigger one... But I think we arrived at a good solution. What subdomain do you want? phpdoc.openmage.org? |
I looks good, but how to do it all files? How to move class descripion on top, put methods below copright? You are fine with regex, any ideas for complex replace pattern? phpdoc.openmage.org is good 👍 |
|
I used a script generated by AI to make the changes. I think it worked, but it needs more review as it's possible there are some mistakes.. Not sure how to go about reviewing 5000 files. See #4624 |
Whats sooo unique?
Why not to put that energy into a "RWD v2" or "Maho"-Theme? Why add CLI commands instead of supporting n98? |
I'd like to add the Maho-theme as addition to RWD., so we need to place copyrights in phtmls too. |
@sreichel This is why there are not enough maintainers. 😞 |
See #4624 |
Description (*)
No need to mention license again.